private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents ResourceBundle bundle = ResourceBundle.getBundle("messages"); DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); separator1 = compFactory.createSeparator("Contact"); panelMain = new JPanel(); lblFirstName = new JLabel(); txtFirstName = new JTextField(); lblLastName = new JLabel(); txtLastName = new JTextField(); tabbedPane = new JTabbedPane(); panelActions = new JPanel(); btnAccept = new JButton(); btnCancel = new JButton(); CellConstraints cc = new CellConstraints(); // ======== this ======== setTitle("Dialog Contact"); Container contentPane = getContentPane(); contentPane.setLayout( new FormLayout( "11dlu, $lcgap, 170dlu:grow, $lcgap, 25dlu", "2*(default, $lgap), 37dlu, $lgap, default, $lgap, 79dlu:grow, 2*($lgap, default)")); contentPane.add(separator1, cc.xy(3, 3)); // ======== panelMain ======== { panelMain.setLayout(new FormLayout("73dlu, $lcgap, 111dlu", "2*(default, $lgap), default")); // ---- lblFirstName ---- lblFirstName.setText("First name:"); lblFirstName.setLabelFor(txtFirstName); panelMain.add(lblFirstName, cc.xy(1, 1)); panelMain.add(txtFirstName, cc.xy(3, 1)); // ---- lblLastName ---- lblLastName.setText("Last name:"); lblLastName.setLabelFor(txtLastName); panelMain.add(lblLastName, cc.xy(1, 3)); panelMain.add(txtLastName, cc.xy(3, 3)); } contentPane.add(panelMain, cc.xy(3, 5)); // ======== tabbedPane ======== { tabbedPane.setTabPlacement(SwingConstants.LEFT); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } contentPane.add(tabbedPane, cc.xywh(3, 9, 1, 1, CellConstraints.FILL, CellConstraints.FILL)); // ======== panelActions ======== { panelActions.setLayout(new FormLayout("default:grow, 2*($lcgap, default)", "default")); // ---- btnAccept ---- btnAccept.setText(bundle.getString("common.accept")); btnAccept.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { btnAcceptActionPerformed(e); } }); panelActions.add(btnAccept, cc.xy(3, 1)); // ---- btnCancel ---- btnCancel.setText(bundle.getString("common.cancel")); btnCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { btnCancelActionPerformed(e); } }); panelActions.add(btnCancel, cc.xy(5, 1)); } contentPane.add(panelActions, cc.xy(3, 11)); setSize(525, 370); setLocationRelativeTo(getOwner()); // //GEN-END:initComponents }
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); dialogPane = new JPanel(); contentPanel = new JPanel(); separator1 = compFactory.createSeparator("Country properties"); panelProperties = new JPanel(); lblName = new JLabel(); txtName = new JTextField(); buttonBar = new JPanel(); okButton = new JButton(); cancelButton = new JButton(); CellConstraints cc = new CellConstraints(); // ======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(Borders.DIALOG_BORDER); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { contentPanel.setLayout( new FormLayout( "17dlu, $lcgap, 160dlu:grow, $lcgap, 17dlu", "2*(default, $lgap), default")); contentPanel.add(separator1, cc.xy(3, 1)); // ======== panelProperties ======== { panelProperties.setLayout( new FormLayout("25dlu, $lcgap, 18dlu, $lcgap, default:grow", "default")); // ---- lblName ---- lblName.setText("Name:"); lblName.setLabelFor(txtName); panelProperties.add(lblName, cc.xy(1, 1)); panelProperties.add(txtName, cc.xy(5, 1)); } contentPanel.add(panelProperties, cc.xy(3, 5)); } dialogPane.add(contentPanel, BorderLayout.CENTER); // ======== buttonBar ======== { buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER); buttonBar.setLayout(new FormLayout("$glue, $button, $rgap, $button", "pref")); // ---- okButton ---- okButton.setText("Save"); buttonBar.add(okButton, cc.xy(2, 1)); // ---- cancelButton ---- cancelButton.setText("Cancel"); buttonBar.add(cancelButton, cc.xy(4, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // //GEN-END:initComponents }