Java Code Examples for java.awt.GridLayout#setVgap()

The following examples show how to use java.awt.GridLayout#setVgap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusPanel.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method initializes this
 *
 * @return void
 */
private void initialize() {
    double[][] size = {{5, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5}};
    this.setLayout(new TableLayout(size));
    final GridLayout gridLayout3 = new GridLayout();
    JPanel child = new JPanel(gridLayout3);
    this.setSize(351, 105);
    gridLayout3.setRows(3);
    gridLayout3.setColumns(2);
    gridLayout3.setHgap(5);
    gridLayout3.setVgap(5);
    child.add(getJRadioButton(), null);
    child.add(getJRadioButton1(), null);
    child.add(getJRadioButton2(), null);
    child.add(getJRadioButton3(), null);
    child.add(getJRadioButton4(), null);
    child.add(getJTextField(), null);
    this.add(child, "1,1");
}
 
Example 2
Source File: OperatorInfoScreen.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
public static JPanel createCapabilitiesPanel(Operator operator) {
	CapabilityProvider capabilityProvider = (CapabilityProvider) operator;
	int length = OperatorCapability.values().length;
	GridLayout layout = new GridLayout(length / 2, 2);
	layout.setHgap(GAP);
	layout.setVgap(GAP);
	JPanel capabilitiesPanel = new JPanel(layout);
	for (OperatorCapability capability : OperatorCapability.values()) {
		JLabel capabilityLabel = new JLabel(capability.getDescription());
		try {
			if (capabilityProvider.supportsCapability(capability)) {
				capabilityLabel.setIcon(SwingTools.createIcon("16/ok.png"));
			} else {
				capabilityLabel.setIcon(SwingTools.createIcon("16/error.png"));
			}
		} catch (Exception e) {
			break;
		}
		capabilitiesPanel.add(capabilityLabel);
	}
	return capabilitiesPanel;
}
 
Example 3
Source File: PopupPane.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public PopupPane() {
    listComponents = new HashSet<ListComponent>();
    view = new JPanel();
    GridLayout grid = new GridLayout(0, 1);
    grid.setHgap(0);
    grid.setVgap(0);
    view.setLayout(grid);
    view.setBorder(BorderFactory.createEmptyBorder());
    setName("progresspopup"); //NOI18N
    setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    setViewportView(view);
    setFocusable(true);
    setRequestFocusEnabled(true);

    Action down = new MoveDownAction();
    getActionMap().put("Move-Down", down);
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "Move-Down");
    getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "Move-Down");
    
    Action up = new MoveUpAction();
    getActionMap().put("Move-Up", up);
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "Move-Up");
    getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "Move-Up");
    Action cancel = new CancelAction();
    getActionMap().put("Cancel-Task", cancel);
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "Cancel-Task");
    getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "Cancel-Task");
    
    Action select = new SelectAction();
    getActionMap().put("select-task", select);
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "select-task");
    getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "select-task");
    
    
    setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
 
Example 4
Source File: DatabaseIFrame.java    From LibraryManagementSystem with MIT License 5 votes vote down vote up
public DatabaseIFrame() {
	super("���ݿⱸ����ָ�");
	this.setLayout(new GridLayout(2, 1));
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setBounds(100, 50, 500, 350);
	
	backupTextField = new JTextField(20);
	restoreTextField = new JTextField(20);
	
	GridLayout grid = new GridLayout(2, 1);
	grid.setVgap(10);
	backupPanel.setLayout(grid);
	backupPanel.setBorder(BorderFactory.createTitledBorder("���ݿⱸ��"));
	backupPanel.add(backupTextField);
	JPanel button1 = new JPanel();
	button1.add(getBrowseButton1());
	button1.add(getBackupButton());
	backupPanel.add(button1);
	getContentPane().add(backupPanel);
	
	restorePanel.setLayout(grid);
	restorePanel.setBorder(BorderFactory.createTitledBorder("���ݿ�ָ�"));
	JPanel button2 = new JPanel();
	restorePanel.add(restoreTextField);
	button2.add(getBrowseButton2());
	button2.add(getRestoreButton());
	restorePanel.add(button2);
	getContentPane().add(restorePanel);
	
	setVisible(true);
}
 
Example 5
Source File: DialogUtils.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
public ComponentListPanel() {
    final GridLayout grid = new GridLayout(0, 1);
    grid.setVgap(5);

    labelPanel = new JPanel(grid);
    fieldPanel = new JPanel(new GridLayout(0, 1));

    this.add(labelPanel, BorderLayout.CENTER);
    this.add(fieldPanel, BorderLayout.LINE_END);
}
 
Example 6
Source File: PreferencesDialog.java    From petscii-bbs with Mozilla Public License 2.0 4 votes vote down vote up
public PreferencesDialog(JFrame parent, Preferences preferences,
                         DisplaySettings settings) {
  
  super(parent, "Preferences...", true);
  this.preferences = preferences;
  this.settings = settings;
  
  // Control panel
  GridLayout grid = new GridLayout(5, 2);
  grid.setVgap(3);
  grid.setHgap(3);
  
  JPanel mainpanel = new JPanel(grid);
  
  JLabel stdfontLabel = new JLabel("Size of standard font: ");
  mainpanel.add(stdfontLabel);
  stdfontSpinner = new JSpinner();
  stdfontSpinner.setValue(settings.getStdFontSize());
  mainpanel.add(stdfontSpinner);

  JLabel fixedfontLabel = new JLabel("Size of fixed font: ");
  mainpanel.add(fixedfontLabel);    
  fixedfontSpinner = new JSpinner();
  fixedfontSpinner.setValue(settings.getFixedFontSize());
  mainpanel.add(fixedfontSpinner);
  
  JLabel backgroundLabel = new JLabel("Default background: ");
  mainpanel.add(backgroundLabel);
  backgroundCB = new JComboBox(colors);
  mainpanel.add(backgroundCB);
  preselect(backgroundCB, settings.getDefaultBackground());
  
  JLabel foregroundLabel = new JLabel("Default foreground: ");
  mainpanel.add(foregroundLabel);
  foregroundCB = new JComboBox(colors);
  mainpanel.add(foregroundCB);
  preselect(foregroundCB, settings.getDefaultForeground());

  JLabel antialiasLabel = new JLabel("Antialiased text: ");
  mainpanel.add(antialiasLabel);
  antialiasCB = new JCheckBox();
  antialiasCB.setSelected(settings.getAntialias());
  mainpanel.add(antialiasCB);
  
  // Button panel
  Box lowpanel = new Box(BoxLayout.Y_AXIS);
  lowpanel.add(new JSeparator());
  JPanel buttonpanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
  lowpanel.add(buttonpanel);
  
  JButton okbutton = new JButton("Ok");
  JButton cancelbutton = new JButton("Cancel");
  getRootPane().setDefaultButton(okbutton);
  buttonpanel.add(okbutton);
  buttonpanel.add(cancelbutton);
  okbutton.addActionListener(this);
  cancelbutton.addActionListener(this);
  
  getContentPane().add(mainpanel, BorderLayout.NORTH);
  getContentPane().add(
      new JLabel("<html><body><i>(Note: Changes only take effect after a " +
                 "restart)</i></body></html>"),
                 BorderLayout.CENTER);
  getContentPane().add(lowpanel, BorderLayout.SOUTH);
  
  Border border = BorderFactory.createEmptyBorder(5, 5, 5, 3);
  ((JPanel) getContentPane()).setBorder(border);
  ((BorderLayout) getContentPane().getLayout()).setVgap(5);

  pack();
  
}
 
Example 7
Source File: BookAdd2IFrame.java    From LibraryManagementSystem with MIT License 4 votes vote down vote up
public BookAdd2IFrame() {
	super();
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setTitle("����ͼ�����");						// ���ô�����⣭��������
	setBounds(100, 50, 500, 225);

	//������ͷͼƬ
	final JLabel logoLabel = new JLabel();
	ImageIcon readerAddIcon=CreateIcon.add("tback.jpg");
	logoLabel.setIcon(readerAddIcon);
	logoLabel.setOpaque(true);
	logoLabel.setBackground(Color.white);
	logoLabel.setPreferredSize(new Dimension(400, 60));
	getContentPane().add(logoLabel, BorderLayout.NORTH);

	//����һ�������������
	final JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	getContentPane().add(panel);

	//�������������Ƕ�����1,���ڷ��÷ǰ�ť���
	final JPanel panel_1 = new JPanel();
	final GridLayout gridLayout = new GridLayout(2, 2);
	gridLayout.setVgap(20);
	panel_1.setLayout(gridLayout);
	panel.add(panel_1);

	final JLabel label_2 = new JLabel();
	label_2.setText("ͼ���ţ�");
	panel_1.add(label_2);
	id = new JTextField(10);
	panel_1.add(id);
	
	final JLabel label_3 = new JLabel();
	label_3.setText("���������");
	panel_1.add(label_3);
	num = new JTextField(10);
	panel_1.add(num);
	
	//����������Ƕ��һ�����ڷ��Ű�ť�����
	final JPanel panel_2 = new JPanel();
	panel_2.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_2);
	
	final JRadioButton radioButton1 = new JRadioButton();

	//�����������
	final JButton submit = new JButton();
	panel_2.add(submit);
	submit.setText("�ύ");
	submit.addActionListener((ActionListener) new ButtonAddListener(radioButton1));
	
	//�����������
	final JButton back = new JButton();
	panel_2.add(back);
	back.setText("����");
	back.addActionListener(new CloseActionListener());

	setVisible(true);
}
 
Example 8
Source File: ReaderAddIFrame.java    From LibraryManagementSystem with MIT License 4 votes vote down vote up
public ReaderAddIFrame() {
	super();
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setTitle("������Ϣ���");						// ���ô�����⣭��������
	setBounds(100, 30, 500, 250);

	//������ͷͼƬ
	final JLabel logoLabel = new JLabel();
	ImageIcon readerAddIcon=CreateIcon.add("tback.jpg");
	logoLabel.setIcon(readerAddIcon);
	logoLabel.setOpaque(true);
	logoLabel.setBackground(Color.white);
	logoLabel.setPreferredSize(new Dimension(400, 60));
	getContentPane().add(logoLabel, BorderLayout.NORTH);

	//����һ�������������
	final JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	getContentPane().add(panel);

	//�������������Ƕ�����1,���ڷ��÷ǰ�ť���
	final JPanel panel_1 = new JPanel();
	final GridLayout gridLayout = new GridLayout(0, 4);
	gridLayout.setVgap(15);
	gridLayout.setHgap(10);
	panel_1.setLayout(gridLayout);
	panel_1.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_1);

	final JLabel label_2 = new JLabel();
	label_2.setText("��ַ��");
	panel_1.add(label_2);
	address = new JTextField();
	address.setDocument(new MyDocument(256));
	panel_1.add(address);
	
	final JLabel label_3 = new JLabel();
	label_3.setText("��     �ţ�");
	panel_1.add(label_3);
	id = new JTextField();
	id.setDocument(new MyDocument(256));
	panel_1.add(id);
	
	final JLabel label_4 = new JLabel();
	label_4.setText("���� ��");
	panel_1.add(label_4);
	name = new JTextField();
	name.setDocument(new MyDocument(256));
	panel_1.add(name);
	
	final JLabel label_5 = new JLabel();
	label_5.setText("Ƿ�");
	panel_1.add(label_5);
	own = new JTextField();
	own.setDocument(new MyDocument(256));
	panel_1.add(own);
	
	final JLabel label_6 = new JLabel();
	label_6.setText("�绰��");
	panel_1.add(label_6);
	phone = new JTextField();
	phone.setDocument(new MyDocument(256));
	panel_1.add(phone);
	
	final JLabel label_7 = new JLabel();
	label_7.setText("�Ա�");
	panel_1.add(label_7);
	sex = new JTextField();
	sex.setDocument(new MyDocument(256));
	panel_1.add(sex);

	//����������Ƕ��һ�����ڷ��Ű�ť�����
	final JPanel panel_2 = new JPanel();
	panel_2.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_2);
	
	final JRadioButton radioButton1 = new JRadioButton();

	//�����������
	final JButton submit = new JButton();
	panel_2.add(submit);
	submit.setText("�ύ");
	submit.addActionListener((ActionListener) new ButtonAddListener(radioButton1));
	
	//�����������
	final JButton back = new JButton();
	panel_2.add(back);
	back.setText("����");
	back.addActionListener(new CloseActionListener());

	setVisible(true);
}
 
Example 9
Source File: UserAddIFrame.java    From LibraryManagementSystem with MIT License 4 votes vote down vote up
public UserAddIFrame() {
	super();
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setTitle("��ӹ���Ա");						// ���ô�����⣭��������
	setBounds(100, 50, 500, 225);

	//������ͷͼƬ
	final JLabel logoLabel = new JLabel();
	ImageIcon userAddIcon=CreateIcon.add("tback.jpg");
	logoLabel.setIcon(userAddIcon);
	logoLabel.setOpaque(true);
	logoLabel.setBackground(Color.white);
	logoLabel.setPreferredSize(new Dimension(400, 60));
	getContentPane().add(logoLabel, BorderLayout.NORTH);

	//����һ�������������
	final JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	getContentPane().add(panel);

	//�������������Ƕ�����1,���ڷ��÷ǰ�ť���
	final JPanel panel_1 = new JPanel();
	final GridLayout gridLayout = new GridLayout(2, 2);
	gridLayout.setVgap(20);
	panel_1.setLayout(gridLayout);
	panel.add(panel_1);

	final JLabel label_2 = new JLabel();
	label_2.setText("�û�����");
	panel_1.add(label_2);
	name = new JTextField(10);
	name.setDocument(new MyDocument(20));
	panel_1.add(name);
	
	final JLabel label_3 = new JLabel();
	label_3.setText("���룺");
	panel_1.add(label_3);
	password = new JTextField(10);
	password.setDocument(new MyDocument(15));
	panel_1.add(password);
	
	//����������Ƕ��һ�����ڷ��Ű�ť�����
	final JPanel panel_2 = new JPanel();
	panel_2.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_2);
	
	final JRadioButton radioButton1 = new JRadioButton();

	//�����������
	final JButton submit = new JButton();
	panel_2.add(submit);
	submit.setText("�ύ");
	submit.addActionListener((ActionListener) new ButtonAddListener(radioButton1));
	
	//�����������
	final JButton back = new JButton();
	panel_2.add(back);
	back.setText("����");
	back.addActionListener(new CloseActionListener());

	setVisible(true);
}
 
Example 10
Source File: BookPriceIFrame.java    From LibraryManagementSystem with MIT License 4 votes vote down vote up
public BookPriceIFrame() {
	super();
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setTitle("�޸�ͼ��۸�");						// ���ô�����⣭��������
	setBounds(100, 50, 500, 225);

	//������ͷͼƬ
	final JLabel logoLabel = new JLabel();
	ImageIcon userAddIcon=CreateIcon.add("tback.jpg");
	logoLabel.setIcon(userAddIcon);
	logoLabel.setOpaque(true);
	logoLabel.setBackground(Color.white);
	logoLabel.setPreferredSize(new Dimension(400, 60));
	getContentPane().add(logoLabel, BorderLayout.NORTH);

	//����һ�������������
	final JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	getContentPane().add(panel);

	//�������������Ƕ�����1,���ڷ��÷ǰ�ť���
	final JPanel panel_1 = new JPanel();
	final GridLayout gridLayout = new GridLayout(2, 2);
	gridLayout.setVgap(20);
	panel_1.setLayout(gridLayout);
	panel.add(panel_1);

	final JLabel label_2 = new JLabel();
	label_2.setText("ͼ��id��");
	panel_1.add(label_2);
	id = new JTextField(10);
	id.setDocument(new MyDocument(20));
	panel_1.add(id);
	
	final JLabel label_3 = new JLabel();
	label_3.setText("���ļ۸�Ϊ ��");
	panel_1.add(label_3);
	money = new JTextField(10);
	money.setDocument(new MyDocument(15));
	panel_1.add(money);
	
	//����������Ƕ��һ�����ڷ��Ű�ť�����
	final JPanel panel_2 = new JPanel();
	panel_2.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_2);
	
	final JRadioButton radioButton1 = new JRadioButton();

	//�����������
	final JButton submit = new JButton();
	panel_2.add(submit);
	submit.setText("�ύ");
	submit.addActionListener((ActionListener) new ButtonAddListener(radioButton1));
	
	//�����������
	final JButton back = new JButton();
	panel_2.add(back);
	back.setText("����");
	back.addActionListener(new CloseActionListener());

	setVisible(true);
}
 
Example 11
Source File: ReaderOwnIFrame.java    From LibraryManagementSystem with MIT License 4 votes vote down vote up
public ReaderOwnIFrame() {
	super();
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setTitle("�޸Ķ���Ƿ��");						// ���ô�����⣭��������
	setBounds(100, 50, 500, 225);

	//������ͷͼƬ
	final JLabel logoLabel = new JLabel();
	ImageIcon userAddIcon=CreateIcon.add("tback.jpg");
	logoLabel.setIcon(userAddIcon);
	logoLabel.setOpaque(true);
	logoLabel.setBackground(Color.white);
	logoLabel.setPreferredSize(new Dimension(400, 60));
	getContentPane().add(logoLabel, BorderLayout.NORTH);

	//����һ�������������
	final JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	getContentPane().add(panel);

	//�������������Ƕ�����1,���ڷ��÷ǰ�ť���
	final JPanel panel_1 = new JPanel();
	final GridLayout gridLayout = new GridLayout(2, 2);
	gridLayout.setVgap(20);
	panel_1.setLayout(gridLayout);
	panel.add(panel_1);

	final JLabel label_2 = new JLabel();
	label_2.setText("���� id��");
	panel_1.add(label_2);
	id = new JTextField(10);
	id.setDocument(new MyDocument(20));
	panel_1.add(id);
	
	final JLabel label_3 = new JLabel();
	label_3.setText("����Ƿ��Ϊ ��");
	panel_1.add(label_3);
	money = new JTextField(10);
	money.setDocument(new MyDocument(15));
	panel_1.add(money);
	
	//����������Ƕ��һ�����ڷ��Ű�ť�����
	final JPanel panel_2 = new JPanel();
	panel_2.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_2);
	
	final JRadioButton radioButton1 = new JRadioButton();

	//�����������
	final JButton submit = new JButton();
	panel_2.add(submit);
	submit.setText("�ύ");
	submit.addActionListener((ActionListener) new ButtonAddListener(radioButton1));
	
	//�����������
	final JButton back = new JButton();
	panel_2.add(back);
	back.setText("����");
	back.addActionListener(new CloseActionListener());

	setVisible(true);
}
 
Example 12
Source File: ReturnIFrame.java    From LibraryManagementSystem with MIT License 4 votes vote down vote up
public ReturnIFrame() {
	super();
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setTitle("��ӹ黹��Ϣ");						// ���ô�����⣭��������
	setBounds(100, 50, 500, 225);

	//������ͷͼƬ
	final JLabel logoLabel = new JLabel();
	ImageIcon readerAddIcon=CreateIcon.add("tback.jpg");
	logoLabel.setIcon(readerAddIcon);
	logoLabel.setOpaque(true);
	logoLabel.setBackground(Color.white);
	logoLabel.setPreferredSize(new Dimension(400, 60));
	getContentPane().add(logoLabel, BorderLayout.NORTH);

	//����һ�������������
	final JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	getContentPane().add(panel);

	//�������������Ƕ�����1,���ڷ��÷ǰ�ť���
	final JPanel panel_1 = new JPanel();
	final GridLayout gridLayout = new GridLayout(2, 2);
	gridLayout.setVgap(20);
	panel_1.setLayout(gridLayout);
	panel.add(panel_1);

	final JLabel label_2 = new JLabel();
	label_2.setText("���ļ�¼��ţ�");
	panel_1.add(label_2);
	id = new JTextField(10);
	id.setDocument(new MyDocument(256));
	panel_1.add(id);
	
	final JLabel label_3 = new JLabel();
	label_3.setText("�黹���ڣ�");
	panel_1.add(label_3);
	return_date = new JFormattedTextField();
	return_date.setValue("XXXX-XX-XX");
	return_date.addKeyListener(new DateListener());
	panel_1.add(return_date);
	
	//����������Ƕ��һ�����ڷ��Ű�ť�����
	final JPanel panel_2 = new JPanel();
	panel_2.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_2);
	
	final JRadioButton radioButton1 = new JRadioButton();

	//�����������
	final JButton submit = new JButton();
	panel_2.add(submit);
	submit.setText("�ύ");
	submit.addActionListener((ActionListener) new ButtonAddListener(radioButton1));
	
	//�����������
	final JButton back = new JButton();
	panel_2.add(back);
	back.setText("����");
	back.addActionListener(new CloseActionListener());

	setVisible(true);
}
 
Example 13
Source File: BorrowIFrame.java    From LibraryManagementSystem with MIT License 4 votes vote down vote up
public BorrowIFrame() {
	super();
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setTitle("������Ϣ���");						// ���ô�����⣭��������
	setBounds(100, 30, 500, 250);

	//������ͷͼƬ
	final JLabel logoLabel = new JLabel();
	ImageIcon readerAddIcon=CreateIcon.add("tback.jpg");
	logoLabel.setIcon(readerAddIcon);
	logoLabel.setOpaque(true);
	logoLabel.setBackground(Color.white);
	logoLabel.setPreferredSize(new Dimension(400, 60));
	getContentPane().add(logoLabel, BorderLayout.NORTH);

	//����һ�������������
	final JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	getContentPane().add(panel);

	//�������������Ƕ�����1,���ڷ��÷ǰ�ť���
	final JPanel panel_1 = new JPanel();
	final GridLayout gridLayout = new GridLayout(0, 4);
	gridLayout.setVgap(15);
	gridLayout.setHgap(10);
	panel_1.setLayout(gridLayout);
	panel_1.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_1);

	final JLabel label_2 = new JLabel();
	label_2.setText("�������ڣ�");
	panel_1.add(label_2);
	borrowDate = new JFormattedTextField();
	borrowDate.setValue("XXXX-XX-XX");
	borrowDate.addKeyListener(new DateListener());
	panel_1.add(borrowDate);
	
	final JLabel label_3 = new JLabel();
	label_3.setText("��     �ţ�");
	panel_1.add(label_3);
	id = new JTextField();
	id.setDocument(new MyDocument(256));
	panel_1.add(id);
	
	final JLabel label_4 = new JLabel();
	label_4.setText("�鱾��� ��");
	panel_1.add(label_4);
	bid = new JTextField();
	bid.setDocument(new MyDocument(256));
	panel_1.add(bid);
	
	final JLabel label_5 = new JLabel();
	label_5.setText("���߱�ţ�");
	panel_1.add(label_5);
	rid = new JTextField();
	rid.setDocument(new MyDocument(256));
	panel_1.add(rid);
	
	final JLabel label_6 = new JLabel();
	label_6.setText("����Ա���֣�");
	panel_1.add(label_6);
	name = new JTextField();
	name.setDocument(new MyDocument(256));
	panel_1.add(name);

	//����������Ƕ��һ�����ڷ��Ű�ť�����
	final JPanel panel_2 = new JPanel();
	panel_2.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_2);
	
	final JRadioButton radioButton1 = new JRadioButton();

	//�����������
	final JButton submit = new JButton();
	panel_2.add(submit);
	submit.setText("�ύ");
	submit.addActionListener((ActionListener) new ButtonAddListener(radioButton1));
	
	//�����������
	final JButton back = new JButton();
	panel_2.add(back);
	back.setText("����");
	back.addActionListener(new CloseActionListener());

	setVisible(true);
}
 
Example 14
Source File: BSAddIFrame.java    From LibraryManagementSystem with MIT License 4 votes vote down vote up
public BSAddIFrame() {
	super();
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setTitle("������");						// ���ô�����⣭��������
	setBounds(100, 50, 500, 225);

	//������ͷͼƬ
	final JLabel logoLabel = new JLabel();
	ImageIcon readerAddIcon=CreateIcon.add("tback.jpg");
	logoLabel.setIcon(readerAddIcon);
	logoLabel.setOpaque(true);
	logoLabel.setBackground(Color.white);
	logoLabel.setPreferredSize(new Dimension(400, 60));
	getContentPane().add(logoLabel, BorderLayout.NORTH);

	//����һ�������������
	final JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	getContentPane().add(panel);

	//�������������Ƕ�����1,���ڷ��÷ǰ�ť���
	final JPanel panel_1 = new JPanel();
	final GridLayout gridLayout = new GridLayout(2, 2);
	gridLayout.setVgap(20);
	panel_1.setLayout(gridLayout);
	panel.add(panel_1);

	final JLabel label_2 = new JLabel();
	label_2.setText("��ܱ�ţ�");
	panel_1.add(label_2);
	id = new JTextField(10);
	id.setDocument(new MyDocument(256));
	panel_1.add(id);
	
	final JLabel label_3 = new JLabel();
	label_3.setText("���λ�ã�");
	panel_1.add(label_3);
	position = new JTextField(10);
	position.setDocument(new MyDocument(256));
	panel_1.add(position);
	
	//����������Ƕ��һ�����ڷ��Ű�ť�����
	final JPanel panel_2 = new JPanel();
	panel_2.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_2);
	
	final JRadioButton radioButton1 = new JRadioButton();

	//�����������
	final JButton submit = new JButton();
	panel_2.add(submit);
	submit.setText("�ύ");
	submit.addActionListener((ActionListener) new ButtonAddListener(radioButton1));
	
	//�����������
	final JButton back = new JButton();
	panel_2.add(back);
	back.setText("����");
	back.addActionListener(new CloseActionListener());

	setVisible(true);
}