📄 gridbagwindow.java~2~
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
public class GridBagWindow extends JFrame {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JLabel jLabel1 = new JLabel();
JList jList1 = new JList();
JButton jButton1 = new JButton();
JCheckBox jCheckBox1 = new JCheckBox();
JButton jButton2 = new JButton();
JCheckBox jCheckBox2 = new JCheckBox();
JPanel jPanel3 = new JPanel();
JList jList2 = new JList();
JLabel jLabel2 = new JLabel();
JPanel jPanel4 = new JPanel();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
JButton jButton5 = new JButton();
GridBagLayout gridBagLayout1 = new GridBagLayout();
GridBagLayout gridBagLayout2 = new GridBagLayout();
GridBagLayout gridBagLayout3 = new GridBagLayout();
GridLayout gridLayout1 = new GridLayout();
//Construct the frame
public GridBagWindow() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Sort");
jPanel1.setLayout(gridBagLayout3);
jPanel2.setBorder(BorderFactory.createRaisedBevelBorder());
jPanel2.setLayout(gridBagLayout2);
jLabel1.setFont(new java.awt.Font("SansSerif", 0, 12));
jLabel1.setForeground(Color.black);
jLabel1.setText("Available columns");
jList1.setBorder(BorderFactory.createLoweredBevelBorder());
jButton1.setFont(new java.awt.Font("SansSerif", 0, 12));
jButton1.setBorder(BorderFactory.createRaisedBevelBorder());
jButton1.setText("Add to Sort");
jCheckBox1.setText("Case insensitive");
jCheckBox1.setFont(new java.awt.Font("Dialog", 0, 12));
jButton2.setText("Remove from Sort");
jButton2.setBorder(BorderFactory.createRaisedBevelBorder());
jButton2.setFont(new java.awt.Font("SansSerif", 0, 12));
jCheckBox2.setFont(new java.awt.Font("Dialog", 0, 12));
jCheckBox2.setText("Descending");
jPanel3.setLayout(gridBagLayout1);
jPanel3.setBorder(BorderFactory.createRaisedBevelBorder());
jList2.setBorder(BorderFactory.createLoweredBevelBorder());
jLabel2.setFont(new java.awt.Font("SansSerif", 0, 12));
jLabel2.setForeground(Color.black);
jLabel2.setText("Sorted columns");
jButton3.setText("Help");
jButton4.setText("OK");
jButton5.setText("Cancel");
jPanel4.setLayout(gridLayout1);
gridLayout1.setHgap(10);
gridLayout1.setVgap(10);
contentPane.add(jPanel1, BorderLayout.CENTER);
jPanel1.add(jPanel2, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6, 10, 0, 19), 0, 2));
jPanel2.add(jList1, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 7, 0, 9), 160, 106));
jPanel2.add(jButton1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(8, 7, 0, 9), 90, 2));
jPanel2.add(jCheckBox1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(11, 13, 15, 15), 31, 0));
jPanel2.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 7, 0, 15), 54, 8));
jPanel1.add(jPanel3, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6, 9, 0, 0), 0, 2));
jPanel3.add(jList2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 7, 0, 9), 160, 106));
jPanel3.add(jButton2, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(8, 7, 0, 9), 50, 2));
jPanel3.add(jCheckBox2, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(11, 13, 15, 15), 56, 0));
jPanel3.add(jLabel2, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 7, 0, 15), 67, 8));
jPanel1.add(jPanel4, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(15, 71, 13, 75), 106, 0));
jPanel4.add(jButton4, null);
jPanel4.add(jButton5, null);
jPanel4.add(jButton3, null);
}
//Overridden so we can exit on System Close
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -