本文共 2680 字,大约阅读时间需要 8 分钟。
packageFAA;importjava.awt.BorderLayout;importjava.awt.Container;importjava.awt.FlowLayout;importjava.awt.GridLayout;importjava.awt.Panel;importjava.awt.Toolkit;importjava...
package FAA;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.Toolkit;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.text.JTextComponent;
import javax.swing.text.AbstractDocument.Content;
public class FAIM extends JFrame {
JLabel lblLocation = new JLabel("坐落位置");
JLabel lblBuildTime = new JLabel("建成年代");
JLabel lblUsage = new JLabel("房屋用途");
JLabel lblNumber = new JLabel("房屋套数");
JLabel lblType = new JLabel("房屋类型");
JLabel lblArea = new JLabel("建筑面积");
JLabel lblUsageArea = new JLabel("使用面积");
JTextField txtLocation = new JTextField(30);
JTextField txtBuildTime = new JTextField(8);
JTextField txtNumber = new JTextField(8);
JTextField txtArea = new JTextField(8);
JTextField txtUsageArea = new JTextField(8);
JComboBox cmbUsage = new JComboBox();
JComboBox cmbType = new JComboBox();
JButton btnAdd = new JButton("新增");
JButton btnUpdate = new JButton("修改");
JButton btnDel = new JButton("删除");
JButton btnSave =new JButton("保存");
JButton btnExit = new JButton("退出");
FAIM(String title)
{
super(title);
Container p = getContentPane();
p.setLayout(new BorderLayout());
Panel pCenter = new Panel(new GridLayout(3,4));
Panel pNorth = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel pSouth = new Panel(new FlowLayout());
pNorth.add(lblLocation);pNorth.add(txtLocation);
pCenter.add(lblBuildTime);pCenter.add(txtBuildTime);
pCenter.add(lblUsage);pCenter.add(cmbUsage);
pCenter.add(lblNumber);pCenter.add(txtNumber);
pCenter.add(lblType);pCenter.add(cmbType);
pCenter.add(lblArea);pCenter.add(txtArea);
pCenter.add(lblUsageArea);pCenter.add(txtUsageArea);
pSouth.add(btnAdd);pSouth.add(btnUpdate);pSouth.add(btnDel);
pSouth.add(new JLabel(" "));pSouth.add(btnSave);pSouth.add(btnExit);
p.add(pNorth,"North");p.add(pSouth,"South");
p.add(pCenter);
pack();
int FrWidth = getWidth();int FrHeight = getHeight();
int SrcWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
int SrcHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
setLocation((SrcWidth-FrWidth)/2, (SrcHeight-FrHeight)/2);
//db.initCombo(cmbUsage, "HouseUsage");
//db.initCombo(cmbType, "HouseType");
cmbUsage.addItem(1);cmbUsage.addItem(2);
cmbType.addItem(1);cmbType.addItem(2);
setVisible(true);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
new FAIM("房产信息维护");
}
}
展开
转载地址:http://kmvqa.baihongyu.com/