JAVA的SWING的JTabbedPane的问题,只有在窗体大小变化一下后控件就显示,请问这是为什么?
publicclassLOGINextendsJFrame{JPaneljPanel_L;JPaneljPanel_R;JTabbedPanejTabbedPane;JL...
public class LOGIN extends JFrame{
JPanel jPanel_L;
JPanel jPanel_R;
JTabbedPane jTabbedPane;
JLabel jLabel_NAME;
JLabel jLabel_PASSWORD;
JTextField jTextField_NAME;
JPasswordField jPasswordField;
public LOGIN(){
super("Login");
this.setSize(450,180);
this.setVisible(true);
this.setLocationRelativeTo(null);
//this.setResizable(false);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
jPanel_L=new JPanel(new FlowLayout(0));
jPanel_L.setBackground(Color.gray);
jPanel_R=new JPanel(null);
jTabbedPane=new JTabbedPane(JTabbedPane.TOP);
jTabbedPane.addTab("Login",jPanel_L);
jTabbedPane.addTab("Register",jPanel_R);
jLabel_NAME=new JLabel("Name");
jPanel_L.add(jLabel_NAME);
jTextField_NAME= new JTextField();
jPanel_L.add(jTextField_NAME);
jTabbedPane.setPreferredSize(new Dimension(430,160));
this.add(jTabbedPane,BorderLayout.CENTER);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
LOGIN login= new LOGIN(null);
}
}
涉及到JAVA里SWING编程的小伙伴们你们好,这个问题我已经解决了,问题的答案就在http://zhidao.baidu.com/link?url=AbfcnTh6JZEno4Tcd-X4vhTxHVgq_tU8YQLm7QEIm1ENAl3Zw1LJzMqCbPfPBsyvMWQQQt-WpBDrn_pJzVBBLK这里面,看看吧省得像我一样费事吧 展开
JPanel jPanel_L;
JPanel jPanel_R;
JTabbedPane jTabbedPane;
JLabel jLabel_NAME;
JLabel jLabel_PASSWORD;
JTextField jTextField_NAME;
JPasswordField jPasswordField;
public LOGIN(){
super("Login");
this.setSize(450,180);
this.setVisible(true);
this.setLocationRelativeTo(null);
//this.setResizable(false);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
jPanel_L=new JPanel(new FlowLayout(0));
jPanel_L.setBackground(Color.gray);
jPanel_R=new JPanel(null);
jTabbedPane=new JTabbedPane(JTabbedPane.TOP);
jTabbedPane.addTab("Login",jPanel_L);
jTabbedPane.addTab("Register",jPanel_R);
jLabel_NAME=new JLabel("Name");
jPanel_L.add(jLabel_NAME);
jTextField_NAME= new JTextField();
jPanel_L.add(jTextField_NAME);
jTabbedPane.setPreferredSize(new Dimension(430,160));
this.add(jTabbedPane,BorderLayout.CENTER);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
LOGIN login= new LOGIN(null);
}
}
涉及到JAVA里SWING编程的小伙伴们你们好,这个问题我已经解决了,问题的答案就在http://zhidao.baidu.com/link?url=AbfcnTh6JZEno4Tcd-X4vhTxHVgq_tU8YQLm7QEIm1ENAl3Zw1LJzMqCbPfPBsyvMWQQQt-WpBDrn_pJzVBBLK这里面,看看吧省得像我一样费事吧 展开
1个回答
2016-06-27
展开全部
JTabbedPane的标签栏,可以放置在顶、侧边看APIJTabbedPane(inttabPlacement)CreatesanemptyTabbedPanewiththespecifiedtabplacementofeither:JTabbedPane.TOP,JTabbedPane.BOTTOM,JTabbedPane.LEFT,orJTabbedPane.RIGHT.
追问
更改标签栏是没用的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询