Topic: 高手帮我看看代码(点fields或buttons时按纽看不见) |
Print this page |
1.高手帮我看看代码(点fields或buttons时按纽看不见) | Copy to clipboard |
Posted by: yezongbo Posted on: 2005-09-24 21:07 import java.awt.*; import javax.swing.*; import java.awt.event.*; public class clientPane extends JFrame implements ActionListener { private Container container; private JLabel label1,label2; private JTextField field1,field2; private JButton button1,button2,button3; private JPanel panel; public clientPane() { setBounds(300,200,450,450); label1=new JLabel("客户姓名:"); label2=new JLabel("密 码"); field1=new JTextField(); field2=new JTextField(); button1=new JButton(" 确定"); button2=new JButton("取消"); button3=new JButton("新用户注册"); label1.setBounds(80,80,80,30); label2.setBounds(80,120,80,20); field1.setBounds(160,80,80,20); field2.setBounds(160,120,80,30); button1.setBounds(90,160,80,30); button2.setBounds(200,160,80,30); button3.setBounds(250,80,100,50); Container container=this.getContentPane(); container.add(label1); container.add(label2); container.add(field1); container.add(field2); container.add(button1); container.add(button2); container.add(button3); button1.addActionListener(this); button2.addActionListener(this); button3.addActionListener(this); /*container.setLayout(new BorderLayout()); panel=new JPanel(); panel.setLayout(new GridLayout(3,2)); panel.add(label1); panel.add(field1); panel.add(label2); panel.add(field2); panel.add(button1); panel.add(button2); container.add(panel,BorderLayout.CENTER); container.add(button3,BorderLayout.SOUTH);*/ show(); } public void Actionpeerformed(ActionEvent e) { } public static void main(String[] args) { clientPane application=new clientPane(); application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } 为什么当我点里面的fields或者buttons时里面的安纽看不见了 并且界面发生了很多的变化 为什么? |
2.Re:高手帮我看看代码 [Re: yezongbo] | Copy to clipboard |
Posted by: q_yuan Posted on: 2005-09-26 16:43 ActionPerformed(ActionEvent evt){ 这中是什么代码?你查一查是不是有关? } |
3.Re:高手帮我看看代码 [Re: yezongbo] | Copy to clipboard |
Posted by: q_yuan Posted on: 2005-09-26 16:46 对getContentPane设置为null试一试! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |