List of usage examples for com.jgoodies.forms.builder DefaultFormBuilder setRowGroupingEnabled
@Deprecated public void setRowGroupingEnabled(boolean enabled)
From source file:org.columba.addressbook.gui.dialog.group.EditGroupDialog.java
License:Mozilla Public License
private JPanel createGroupNamePanel() { JPanel panel = new JPanel(); FormLayout layout = new FormLayout("12px, right:default, 6px, default:grow", ""); //$NON-NLS-1$ //$NON-NLS-2$ DefaultFormBuilder b = new DefaultFormBuilder(layout, panel); b.setRowGroupingEnabled(true); b.setLeadingColumnOffset(1);/*w w w . j av a 2s . c o m*/ b.appendSeparator(AddressbookResourceLoader.getString("dialog", "editgroupdialog", "description_3")); //$NON-NLS-2$ b.append(nameLabel); b.append(nameTextField); b.append(descriptionLabel); b.append(descriptionTextField); return panel; }
From source file:org.columba.chat.ui.dialog.AccountDialog.java
License:Mozilla Public License
/** * // w w w. ja v a2 s . c om */ private void layoutComponents() { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); getContentPane().add(panel); JPanel center = new JPanel(); center.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12)); panel.add(center, BorderLayout.CENTER); FormLayout layout = new FormLayout("right:default, 3dlu, default:grow", ""); DefaultFormBuilder b = new DefaultFormBuilder(layout, center); b.setRowGroupingEnabled(true); // b.addSeparator("Account Options"); b.append("&Server:", serverTextField); b.append("&User:", idTextField); // b.append("Pass&word:", passwordTextField); b.append("&Resource:", resourceTextField); b.append("&Port:", portSpinner); b.append(enableSSLCheckBox, 3); JPanel bottomPanel = new JPanel(new BorderLayout()); bottomPanel.setBorder(new SingleSideEtchedBorder(SwingConstants.TOP)); JPanel buttonPanel = new JPanel(new GridLayout(1, 2, 5, 0)); buttonPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12)); okButton = new ButtonWithMnemonic(AddressbookResourceLoader.getString("global", "ok")); okButton.setActionCommand("OK"); okButton.addActionListener(this); registerButton = new JButton("Register..."); registerButton.setActionCommand("REGISTER"); registerButton.addActionListener(this); buttonPanel.add(registerButton); buttonPanel.add(okButton); bottomPanel.add(buttonPanel, BorderLayout.EAST); panel.add(bottomPanel, BorderLayout.SOUTH); getRootPane().setDefaultButton(okButton); }
From source file:org.columba.mail.gui.config.account.IncomingServerPanel.java
License:Mozilla Public License
protected void layoutComponents() { // Create a FormLayout instance. FormLayout layout = new FormLayout( "10dlu, max(70dlu;default), 3dlu, fill:max(150dlu;default):grow, 3dlu, default, 3dlu, default", // 2 columns ""); // rows are added dynamically (no need to // define them here) // create a form builder DefaultFormBuilder builder = new DefaultFormBuilder(layout, this); // create EmptyBorder between components and dialog-frame builder.setDefaultDialogBorder();/*from www. ja v a2s.com*/ // skip the first column builder.setLeadingColumnOffset(1); // Add components to the panel: // builder.append(defaultAccountCheckBox, 7); // builder.nextLine(); builder.appendSeparator(MailResourceLoader.getString("dialog", "account", "configuration")); builder.nextLine(); builder.append(loginLabel, 1); builder.append(loginTextField, 5); builder.nextLine(); builder.append(hostLabel, 1); builder.append(hostTextField); // builder.nextLine(); builder.append(portLabel); builder.append(portSpinner); builder.nextLine(); builder.appendSeparator(MailResourceLoader.getString("dialog", "account", "security")); builder.nextLine(); JPanel panel = new JPanel(); FormLayout l = new FormLayout("default, 3dlu, fill:pref:grow, 3dlu, fill:pref:grow", // 2 columns "fill:default:grow"); // rows are added dynamically (no need // to // define them here) // create a form builder DefaultFormBuilder b = new DefaultFormBuilder(l, panel); b.append(authenticationLabel, authenticationComboBox, checkAuthMethods); builder.append(panel, 3); builder.nextLine(); builder.append(secureCheckBox, 3); builder.nextLine(); JPanel panel2 = new JPanel(); FormLayout l2 = new FormLayout("default, 3dlu, left:pref", // 2 columns "fill:default:grow"); // rows are added dynamically (no need // to // define them here) // create a form builder DefaultFormBuilder b2 = new DefaultFormBuilder(l2, panel2); b2.setRowGroupingEnabled(true); b2.append(secureCheckBox, sslComboBox); builder.append(panel2, 3); builder.nextLine(); builder.append(storePasswordCheckBox, 3); builder.nextLine(); /* * builder.append(sslLabel, 3); builder.nextLine(); * * builder.append(disableSSLConnectionRadioButton, 2); * builder.nextLine(); builder.append(enableSSLConnectionRadioButton, * 2); builder.nextLine(); * builder.append(enableSTARTTLSExtensionRadioButton, 2); * builder.nextLine(); */ }
From source file:org.columba.mail.gui.config.account.OutgoingServerPanel.java
License:Mozilla Public License
protected void layoutComponents() { // Create a FormLayout instance. FormLayout layout = new FormLayout( "10dlu, 10dlu, max(60dlu;default), 3dlu, fill:max(150dlu;default):grow, 3dlu, default, 3dlu, default ", // 2 columns ""); // rows are added dynamically (no need to define them // here) DefaultFormBuilder builder = new DefaultFormBuilder(layout, this); // create EmptyBorder between components and dialog-frame builder.setDefaultDialogBorder();//w w w. j a v a 2s . c o m // skip the first column builder.setLeadingColumnOffset(1); // Add components to the panel: // builder.append(defaultAccountCheckBox, 7); // builder.nextLine(); builder.appendSeparator(MailResourceLoader.getString("dialog", "account", "configuration")); builder.nextLine(); // builder.setLeadingColumnOffset(1); builder.append(loginLabel, 2); builder.append(loginTextField, 5); builder.nextLine(); builder.append(hostLabel, 2); builder.append(hostTextField); // builder.nextLine(); builder.append(portLabel); builder.append(portSpinner); builder.nextLine(); builder.setLeadingColumnOffset(1); builder.appendSeparator(MailResourceLoader.getString("dialog", "account", "security")); builder.nextLine(); builder.append(needAuthCheckBox, 8); builder.nextLine(); builder.setLeadingColumnOffset(2); JPanel panel = new JPanel(); FormLayout l = new FormLayout("default, 3dlu, left:pref:grow, 3dlu, left:pref:grow", // 2 columns "fill:default:grow"); // rows are added dynamically (no need // to // define them here) // create a form builder DefaultFormBuilder b = new DefaultFormBuilder(l, panel); b.append(authenticationLabel, authenticationComboBox, checkAuthMethods); // b.nextLine(); // b.append(loginLabel, loginTextField); builder.append(panel, 5); builder.nextLine(); // builder.setLeadingColumnOffset(1); builder.append(secureCheckBox, 6); builder.nextLine(); JPanel panel2 = new JPanel(); FormLayout l2 = new FormLayout("default, 3dlu, left:pref", // 2 columns "fill:default:grow"); // rows are added dynamically (no need // to // define them here) // create a form builder DefaultFormBuilder b2 = new DefaultFormBuilder(l2, panel2); b2.setRowGroupingEnabled(true); builder.append(panel2, 3); builder.nextLine(); builder.append(storePasswordCheckBox, 5); builder.nextLine(); // builder.setLeadingColumnOffset(1); }
From source file:org.mpn.contacts.PanelBuilderTest.java
License:Open Source License
public JComponent buildPanel() { // initComponents(); JLabel name1Field = new JLabel("name1Field"); JTextPane comment1Area = new JTextPane(); JTextPane comment2Area = new JTextPane(); JTextPane comment3Area = new JTextPane(); JTextField name2Field = new JTextField(); JTextField name3Field = new JTextField(); FormLayout layout = new FormLayout("right:pref, 3dlu, default:grow", ""); DefaultFormBuilder formBuilder = new DefaultFormBuilder(layout); formBuilder.setDefaultDialogBorder(); formBuilder.setRowGroupingEnabled(true); CellConstraints cc = new CellConstraints(); // In this approach, we add a gap and a custom row. // The advantage of this approach is, that we can express // the row spec and comment area cell constraints freely. // The disadvantage is the misalignment of the leading label. // Also the row's height may be inconsistent with other rows. formBuilder.appendSeparator("Single Custom Row"); formBuilder.append("Name", name1Field); formBuilder.appendRow(formBuilder.getLineGapSpec()); formBuilder.appendRow(new RowSpec("top:31dlu")); // Assumes line is 14, gap is 3 formBuilder.nextLine(2);// w ww . j a v a 2 s.c om formBuilder.append("Comment"); formBuilder.add(new JScrollPane(comment1Area), cc.xy(formBuilder.getColumn(), formBuilder.getRow(), "fill, fill")); formBuilder.nextLine(); // In this approach, we append a standard row with gap before it. // The advantage is, that the leading label is aligned well. // The disadvantage is that the comment area now spans // multiple cells and is slightly less flexible. // Also the row's height may be inconsistent with other rows. formBuilder.appendSeparator("Standard + Custom Row"); formBuilder.append("Name", name2Field); formBuilder.append("Comment"); formBuilder.appendRow(new RowSpec("17dlu")); // Assumes line is 14, gap is 3 formBuilder.add(new JScrollPane(comment2Area), cc.xywh(formBuilder.getColumn(), formBuilder.getRow(), 1, 2)); formBuilder.nextLine(2); // In this approach, we append two standard rows with associated gaps. // The advantage is, that the leading label is aligned well, // and the height is consistent with other rows. // The disadvantage is that the comment area now spans // multiple cells and is slightly less flexible. formBuilder.appendSeparator("Two Standard Rows"); formBuilder.append("Name", name3Field); formBuilder.append("Comment"); formBuilder.nextLine(); formBuilder.append(""); formBuilder.nextRow(-2); formBuilder.add(new JScrollPane(comment3Area), cc.xywh(formBuilder.getColumn(), formBuilder.getRow(), 1, 3)); formBuilder.nextLine(3); JTable jtable1 = new JTable( new Object[][] { { "a", "b", "c" }, { "1", "2", "3" }, { "q", "w", "e" }, { "a", "b", "c" }, { "1", "2", "3" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, }, new Object[] { "Text1", "Column2", "Apples" }); JTable jtable2 = new JTable( new Object[][] { { "a", "b", "c" }, { "1", "2", "3" }, { "q", "w", "e" }, { "a", "b", "c" }, { "1", "2", "3" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, { "q", "w", "e" }, }, new Object[] { "Tex", "Colum_", "_Apples" }); formBuilder.appendSeparator("Table1"); formBuilder.nextLine(); formBuilder.append("Comment"); // formBuilder.nextRow(-2); formBuilder.appendRow(new RowSpec("17dlu")); // Assumes line is 14, gap is 3 formBuilder.add(new JScrollPane(jtable1), cc.xywh(formBuilder.getColumn(), formBuilder.getRow(), 1, 2)); formBuilder.nextLine(); formBuilder.nextLine(); formBuilder.appendSeparator("Table2"); formBuilder.nextLine(); // formBuilder.append("Comment"); formBuilder.appendRow(new RowSpec("100px")); // formBuilder.appendRow(new RowSpec("17dlu")); // Assumes line is 14, gap is 3 // formBuilder.appendRow(new RowSpec("17dlu")); // Assumes line is 14, gap is 3 // formBuilder.nextRow(-2); // formBuilder.nextLine(2); // formBuilder.nextLine(); // formBuilder.nextLine(); // formBuilder.nextLine(); formBuilder.add(new JScrollPane(jtable2), cc.xywh(formBuilder.getColumn(), formBuilder.getRow(), 3, 1)); return formBuilder.getPanel(); }
From source file:org.qedeq.gui.se.pane.ModuleErrorAndWarningListPane.java
License:Open Source License
/** * Assembles the GUI components of the panel. *//* www .ja va 2s. c om*/ private final void setupView() { FormLayout layout = new FormLayout("min:grow", "0:grow"); final DefaultFormBuilder builder = new DefaultFormBuilder(layout, this); builder.setBorder(BorderFactory.createEmptyBorder()); builder.setRowGroupingEnabled(true); final CellConstraints cc = new CellConstraints(); builder.appendRow(new RowSpec("0:grow")); list.setDefaultRenderer(Icon.class, new IconCellRenderer()); final ListSelectionModel rowSM = list.getSelectionModel(); rowSM.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // if selection changes remember the error number (= selected row (starting with 0)) rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } selectedLine = list.getSelectionModel().getLeadSelectionIndex(); Trace.param(CLASS, this, "setupView$valueChanged", "selectedLine", selectedLine); } }); // doing a click shall open the edit window list.addMouseListener(new MouseAdapter() { public void mousePressed(final MouseEvent evt) { if (SwingUtilities.isRightMouseButton(evt)) { contextMenu.show(evt.getComponent(), evt.getX(), evt.getY()); } else { super.mousePressed(evt); } } public void mouseClicked(final MouseEvent e) { if (e.getClickCount() == 2) { Trace.trace(CLASS, this, "setupView$vmouseClicked", "doubleClick"); } selectLine(); } }); // pressing the enter key shall open the edit window list.getActionMap().put("selectNextRowCell", new AbstractAction() { public void actionPerformed(final ActionEvent event) { Trace.param(CLASS, this, "setupView$actionPerformed", "event", event); selectLine(); } }); scrollPane = new JScrollPane(list); builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 1, 2, "fill, fill")); // open context menu on right click scrollPane.addMouseListener(new MouseAdapter() { public void mousePressed(final MouseEvent evt) { if (SwingUtilities.isRightMouseButton(evt)) { contextMenu.show(evt.getComponent(), evt.getX(), evt.getY()); } else { super.mousePressed(evt); } } }); StyleConstants.setForeground(this.errorAttrs, Color.red); // because we override getScrollableTracksViewportWidth: scrollPane.getViewport().setBackground(Color.white); StyleConstants.setBackground(this.errorAttrs, Color.white); // TODO mime 20080124: testing // the default table cell renderer uses a JLabel to render the heading and we want to // left align the header columns // TODO mime 20080415: left align with small spaces would be better final JTableHeader header = list.getTableHeader(); ((JLabel) header.getDefaultRenderer()).setHorizontalAlignment(JLabel.LEFT); //set height of header correctly header.setPreferredSize(new Dimension(list.getTableHeader().getWidth(), (int) (1.1 * this.getFontMetrics(getFont()).getHeight()))); changeColumnHeaderWidth(); }
From source file:org.qedeq.gui.se.pane.ProcessListPane.java
License:Open Source License
/** * Assembles the GUI components of the panel. *//*from ww w .jav a2 s .c o m*/ private final void setupView() { list.setFont(new Font("Lucida Sans Unicode", Font.PLAIN, list.getFont().getSize())); list.addComponentListener(new ComponentAdapter() { public void componentResized(final ComponentEvent e) { list.scrollRectToVisible(list.getCellRect(list.getRowCount() - 1, 0, true)); } }); final FormLayout layout = new FormLayout("min:grow", "0:grow"); final DefaultFormBuilder builder = new DefaultFormBuilder(layout, this); builder.setBorder(BorderFactory.createEmptyBorder()); builder.setRowGroupingEnabled(true); final CellConstraints cc = new CellConstraints(); builder.appendRow(new RowSpec("0:grow")); list.setDefaultRenderer(Icon.class, new IconCellRenderer()); final ListSelectionModel rowSM = list.getSelectionModel(); rowSM.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); // if selection changes remember the process number (= selected row (starting with 0)) rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } selectedProcesses.clear(); if (!rowSM.isSelectionEmpty()) { int minIndex = rowSM.getMinSelectionIndex(); int maxIndex = rowSM.getMaxSelectionIndex(); for (int i = minIndex; i <= maxIndex; i++) { if (rowSM.isSelectedIndex(i)) { final ServiceProcess process = model.getServiceProcess(i); if (process != null) { selectedProcesses.add(process); } } } } } }); /* // doing a click shall open the edit window list.addMouseListener(new MouseAdapter() { public void mouseClicked(final MouseEvent e) { if (e.getClickCount() == 2) { Trace.trace(CLASS, this, "setupView$vmouseClicked", "doubleClick"); } selectLine(); } }); // pressing the enter key shall open the edit window list.getActionMap().put("selectNextRowCell", new AbstractAction() { public void actionPerformed(final ActionEvent event) { Trace.param(CLASS, this, "setupView$actionPerformed", "event" , event); selectLine(); } }); */ scrollPane = new JScrollPane(list); builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 1, 2, "fill, fill")); StyleConstants.setForeground(this.errorAttrs, Color.red); // because we override getScrollableTracksViewportWidth: scrollPane.getViewport().setBackground(Color.white); StyleConstants.setBackground(this.errorAttrs, Color.white); // TODO mime 20080124: testing // the default table cell renderer uses a JLabel to render the heading and we want to // left align the header columns // TODO mime 20080415: left align with small spaces would be better final JTableHeader header = list.getTableHeader(); ((JLabel) header.getDefaultRenderer()).setHorizontalAlignment(JLabel.LEFT); //set height of header correctly header.setPreferredSize(new Dimension(list.getTableHeader().getWidth(), (int) (1.1 * this.getFontMetrics(getFont()).getHeight()))); changeHeaderWidth(); final Thread refresh = new Thread() { public void run() { while (automaticRefresh) { updateView(); IoUtility.sleep(5000); // refresh every 5 seconds } } }; refresh.setDaemon(true); refresh.start(); }