你好,欢迎来到电脑编程技巧与维护杂志社! 杂志社简介广告服务读者反馈编程社区  
合订本订阅
 
 
您的位置:技术专栏 / Java专栏
Java布局管理器使用方法探讨(3)
 

public Frame1() {
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
Frame1 frame1 = new Frame1();
frame1.setSize(new Dimension(400, 350));
frame1.show();

}

private void jbInit() throws Exception {
this.getContentPane().setLayout(borderLayout1);
jPanel1.setBackground(Color.red);
jPanel1.setLayout(flowLayout1);
jPanel2.setBackground(Color.red);
jPanel2.setLayout(flowLayout2);
jPanel3.setBackground(Color.pink);
jPanel3.setLayout(gridLayout1);
jLabel1.setPreferredSize(new Dimension(100, 16));
jLabel1.setText("请输入查询条件");
jTextField1.setPreferredSize(new Dimension(140, 22));
jTextField1.setText("");
jButton1.setText("查询");
jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
flowLayout1.setAlignment(FlowLayout.LEFT);
flowLayout1.setHgap(5);
flowLayout1.setVgap(10);
jButton2.setText("增加");
jButton3.setText("删除");
jButton4.setText("修改");
flowLayout2.setHgap(30);
flowLayout2.setVgap(5);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.getContentPane().add(jPanel1, BorderLayout.NORTH);
jPanel1.add(jLabel1, null);
jPanel1.add(jTextField1, null);
jPanel1.add(jButton1, null);
this.getContentPane().add(jPanel2, BorderLayout.SOUTH);
jPanel2.add(jButton2, null);
jPanel2.add(jButton3, null);
jPanel2.add(jButton4, null);
this.getContentPane().add(jPanel3, BorderLayout.CENTER);
jPanel3.add(jScrollPane1, null);
jScrollPane1.getViewport().add(jTable1, null);
}

(编辑:aniston)

  推荐精品文章

·2024年12月目录 
·2024年11月目录 
·2024年10月目录 
·2024年9月目录 
·2024年8月目录 
·2024年7月目录 
·2024年6月目录 
·2024年5月目录 
·2024年4月目录 
·2024年3月目录 
·2024年2月目录 
·2024年1月目录
·2023年12月目录
·2023年11月目录

  联系方式
TEL:010-82561037
Fax: 010-82561614
QQ: 100164630
Mail:gaojian@comprg.com.cn

  友情链接
 
Copyright 2001-2010, www.comprg.com.cn, All Rights Reserved
京ICP备14022230号-1,电话/传真:010-82561037 82561614 ,Mail:gaojian@comprg.com.cn
地址:北京市海淀区远大路20号宝蓝大厦E座704,邮编:100089