private void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20); contentPane.setBorder(border1); contentPane.setLayout(borderLayout1); controlsPane.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setHgap(10); gridLayout1.setRows(0); gridLayout1.setVgap(10); okButton.setVerifyInputWhenFocusTarget(true); okButton.setMnemonic('O'); okButton.setText("OK"); buttonsPane.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.CENTER); messagePane.setEditable(false); messagePane.setText(""); borderLayout1.setHgap(10); borderLayout1.setVgap(10); this.setTitle("Subscription Authorization"); this.getContentPane().add(contentPane, BorderLayout.CENTER); contentPane.add(controlsPane, BorderLayout.SOUTH); controlsPane.add(responsesComboBox, null); controlsPane.add(buttonsPane, null); buttonsPane.add(okButton, null); contentPane.add(messageScrollPane, BorderLayout.CENTER); messageScrollPane.getViewport().add(messagePane, null); }
/** * Static Init * * @throws Exception */ void jbInit() throws Exception { mainPanel.setLayout(mainLayout); mainLayout.setHgap(2); mainLayout.setVgap(2); infoPane.setBorder(BorderFactory.createLoweredBevelBorder()); infoPane.setPreferredSize(new Dimension(500, 400)); getContentPane().add(mainPanel); mainPanel.add(infoPane, BorderLayout.CENTER); mainPanel.add(confirmPanel, BorderLayout.SOUTH); infoPane.getViewport().add(info, null); confirmPanel.addActionListener(this); } // jbInit
protected JComponent createCenterPanel() { myList.setCellRenderer(new CvsListCellRenderer()); myCenterPanelLayout.setHgap(6); myCenterPanel.add(createActionsPanel(), BorderLayout.NORTH); JComponent listPanel = createListPanel(); myCenterPanel.add(listPanel, BorderLayout.CENTER); myCenterPanel.add(createCvsConfigurationPanel(), BorderLayout.EAST); myCenterPanel.add(new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); myList.setModel(myModel); addSelectionListener(); int minWidth = myList.getFontMetrics(myList.getFont()).stringWidth(SAMPLE_CVSROOT) + 40; Dimension minSize = new Dimension(minWidth, myList.getMaximumSize().height); listPanel.setMinimumSize(minSize); listPanel.setPreferredSize(minSize); return myCenterPanel; }
private void jbInit() throws Exception { titledBorder1 = new TitledBorder(""); this.setLayout(baseLayout); double[][] lower_size = { {TableLayout.PREFERRED, TableLayout.FILL, 25}, {25, 25, TableLayout.FILL} }; mLowerPanelLayout = new TableLayout(lower_size); mLowerPanel.setLayout(mLowerPanelLayout); double[][] dir_size = { {TableLayout.FILL, TableLayout.PREFERRED}, {TableLayout.PREFERRED, TableLayout.FILL} }; mDirectionsPanelLayout = new TableLayout(dir_size); mDirectionsPanel.setLayout(mDirectionsPanelLayout); // Try to get icons for the toolbar buttons try { ClassLoader loader = getClass().getClassLoader(); mAddIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/add.gif")); mRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove.gif")); mDisabledRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove_disabled.gif")); mAddNodeBtn.setIcon(mAddIcon); mRemoveNodeBtn.setIcon(mRemoveIcon); mRemoveNodeBtn.setDisabledIcon(mDisabledRemoveIcon); } catch (Exception e) { // Ack! No icons. Use text labels instead mAddNodeBtn.setText("Add"); mRemoveNodeBtn.setText("Remove"); } /* mAddNodeBtn.setMaximumSize(new Dimension(130, 33)); mAddNodeBtn.setMinimumSize(new Dimension(130, 33)); mAddNodeBtn.setPreferredSize(new Dimension(130, 33)); mAddNodeBtn.setText("Add Node"); */ mAddNodeBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mAddNodeBtn_actionPerformed(e); } }); /* mRemoveNodeBtn.setMaximumSize(new Dimension(130, 33)); mRemoveNodeBtn.setMinimumSize(new Dimension(130, 33)); mRemoveNodeBtn.setPreferredSize(new Dimension(130, 33)); mRemoveNodeBtn.setText("Remove Node"); */ mRemoveNodeBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mRemoveNode(); } }); mHostnameLabel.setHorizontalAlignment(SwingConstants.TRAILING); mHostnameLabel.setLabelFor(mHostnameField); mHostnameLabel.setText("Hostname:"); mHostnameField.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mAddNodeBtn_actionPerformed(e); } }); mDirectionsPanel.setBorder(BorderFactory.createEtchedBorder()); mTitleLabel.setFont(new java.awt.Font("Serif", 1, 20)); mTitleLabel.setHorizontalAlignment(SwingConstants.CENTER); mTitleLabel.setText("Add Cluster Nodes"); mDirectionsLabel.setText("Click on the add button to add nodes to your cluster configuration."); mDirectionsLabel.setLineWrap(true); mDirectionsLabel.setEditable(false); mDirectionsLabel.setBackground(mTitleLabel.getBackground()); baseLayout.setHgap(5); baseLayout.setVgap(5); mLowerPanel.add( mHostnameLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mHostnameField, new TableLayoutConstraints(1, 0, 1, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mListScrollPane1, new TableLayoutConstraints(0, 1, 1, 2, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mAddNodeBtn, new TableLayoutConstraints(2, 0, 2, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mRemoveNodeBtn, new TableLayoutConstraints(2, 1, 2, 1, TableLayout.FULL, TableLayout.FULL)); this.add(mLowerPanel, BorderLayout.CENTER); mListScrollPane1.getViewport().add(lstNodes, null); mDirectionsPanel.add( mTitleLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL)); mDirectionsPanel.add( mDirectionsLabel, new TableLayoutConstraints(0, 1, 0, 1, TableLayout.FULL, TableLayout.FULL)); mDirectionsPanel.add( mIconLabel, new TableLayoutConstraints(1, 0, 1, 1, TableLayout.FULL, TableLayout.FULL)); this.add(mDirectionsPanel, BorderLayout.NORTH); }