java swing编程_Java Swing编程

importjava.awt.Font;importjavax.swing.GroupLayout;importjavax.swing.GroupLayout.Alignment;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JScrollPane;importjavax.swing.JTable;importjavax.swing.JTextField;importjavax.swing.LayoutStyle.ComponentPlacement;importjavax.swing.table.DefaultTableModel;importjavax.swing.JCheckBox;importjavax.swing.JTextPane;importjava.awt.Color;public class Test04 extendsJFrame {privateJTextField textField;privateJTextField textField_1;privateJTextField textField_2;privateJTextField textField_3;private final JCheckBox checkBox = new JCheckBox("");private final JCheckBox checkBox_1 = new JCheckBox("");private final JCheckBox checkBox_2 = new JCheckBox("");publicTest04() {

JLabel lblNewLabel= new JLabel("·��");

lblNewLabel.setFont(new Font("����", Font.BOLD, 13));

textField= newJTextField();

textField.setColumns(10);

JButton btnNewButton= new JButton("Select");

btnNewButton.setFont(new Font("����", Font.BOLD, 13));

JLabel lblNewLabel_1= new JLabel("New label");

textField_1= newJTextField();

textField_1.setEditable(false);//if(!checkBox.isSelected()) {//textField_1.setEditable();//}

textField_1.setColumns(10);

JLabel lblNewLabel_2= new JLabel("New label");

textField_2= newJTextField();

textField_2.setColumns(10);

JLabel lblNewLabel_3= new JLabel("New label");

textField_3= newJTextField();

textField_3.setColumns(10);

JTextPane txtpnShennsShensjSenshhhs= newJTextPane();

txtpnShennsShensjSenshhhs.setBackground(new Color(255, 255, 255));

txtpnShennsShensjSenshhhs.setFont(new Font("楷体", Font.PLAIN, 13));

txtpnShennsShensjSenshhhs.setText("shenns\r\nshensj\r\nsenshhhs\r\nshenshhhe\r\nsheshjskksksk\r\nsjskskkskskkskks");

GroupLayout groupLayout= newGroupLayout(getContentPane());

groupLayout.setHorizontalGroup(

groupLayout.createParallelGroup(Alignment.LEADING)

.addGroup(groupLayout.createSequentialGroup()

.addGap(59)

.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)

.addComponent(lblNewLabel, Alignment.TRAILING)

.addComponent(lblNewLabel_1, Alignment.TRAILING)

.addComponent(lblNewLabel_3, Alignment.TRAILING)

.addComponent(lblNewLabel_2, Alignment.TRAILING))

.addGap(18)

.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)

.addComponent(textField, GroupLayout.PREFERRED_SIZE,479, GroupLayout.PREFERRED_SIZE)

.addGroup(groupLayout.createSequentialGroup()

.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)

.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING,false)

.addComponent(textField_1, Alignment.LEADING)

.addComponent(textField_3, Alignment.LEADING,234, 234, Short.MAX_VALUE))

.addComponent(textField_2,234, 234, 234))

.addGap(28)

.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)

.addComponent(checkBox, GroupLayout.DEFAULT_SIZE,29, Short.MAX_VALUE)

.addComponent(checkBox_1, GroupLayout.DEFAULT_SIZE,29, Short.MAX_VALUE)

.addComponent(checkBox_2, GroupLayout.PREFERRED_SIZE,30, GroupLayout.PREFERRED_SIZE))))

.addGap(18)

.addComponent(btnNewButton)

.addContainerGap(15, Short.MAX_VALUE))

.addGroup(groupLayout.createSequentialGroup()

.addGap(50)

.addComponent(txtpnShennsShensjSenshhhs, GroupLayout.PREFERRED_SIZE,461, GroupLayout.PREFERRED_SIZE)

.addContainerGap(205, Short.MAX_VALUE))

);

groupLayout.setVerticalGroup(

groupLayout.createParallelGroup(Alignment.LEADING)

.addGroup(groupLayout.createSequentialGroup()

.addContainerGap()

.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)

.addComponent(lblNewLabel)

.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)

.addComponent(btnNewButton))

.addGap(26)

.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)

.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)

.addComponent(textField_1, GroupLayout.PREFERRED_SIZE,21, GroupLayout.PREFERRED_SIZE)

.addComponent(lblNewLabel_1))

.addComponent(checkBox))

.addGap(30)

.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)

.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)

.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)

.addComponent(lblNewLabel_3))

.addComponent(checkBox_1))

.addGap(29)

.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)

.addComponent(checkBox_2)

.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)

.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)

.addComponent(lblNewLabel_2)))

.addPreferredGap(ComponentPlacement.RELATED,28, Short.MAX_VALUE)

.addComponent(txtpnShennsShensjSenshhhs, GroupLayout.PREFERRED_SIZE,207, GroupLayout.PREFERRED_SIZE)

.addGap(23))

);

getContentPane().setLayout(groupLayout);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值