List of usage examples for com.jgoodies.forms.layout FormLayout getRowCount
public int getRowCount()
From source file:phex.gui.dialogs.filter.wizard.FilterWizardDialog.java
License:Open Source License
private void prepareComponent() { CloseEventHandler closeEventHandler = new CloseEventHandler(); addWindowListener(closeEventHandler); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); JPanel contentPanel = new JPanel(); //JPanel contentPanel = new FormDebugPanel(); contentPane.add(contentPanel, BorderLayout.CENTER); CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("4dlu, fill:d:grow, 4dlu", // columns "4dlu, fill:p:grow, 12dlu, fill:p:grow, 8dlu," + // rows "p, 2dlu, p, 4dlu"); //btn rows PanelBuilder contentPB = new PanelBuilder(layout, contentPanel); int columnCount = layout.getColumnCount(); int rowCount = layout.getRowCount(); ruleEditPanel = new JPanel(); ruleEditPanel.setLayout(new BorderLayout()); contentPB.add(ruleEditPanel, cc.xywh(2, 2, 1, 1)); ruleDescPanel = new RuleDescriptionPanel(this); contentPB.add(ruleDescPanel, cc.xywh(2, 4, 1, 1)); // button bar contentPB.add(new JSeparator(), cc.xywh(1, rowCount - 3, columnCount, 1)); backBtn = new JButton(Localizer.getString("WizardDialog_Back")); backBtn.addActionListener(new BackBtnListener()); nextBtn = new JButton(Localizer.getString("WizardDialog_Next")); nextBtn.setDefaultCapable(true);/*from ww w .j a v a 2s . c o m*/ nextBtn.setRequestFocusEnabled(true); nextBtn.addActionListener(new NextBtnListener()); finishBtn = new JButton(Localizer.getString("WizardDialog_Finish")); finishBtn.addActionListener(new FinishBtnListener()); JButton cancelBtn = new JButton(Localizer.getString("WizardDialog_Cancel")); cancelBtn.addActionListener(closeEventHandler); JPanel btnPanel = ButtonBarFactory.buildWizardBar(backBtn, nextBtn, finishBtn, cancelBtn); contentPB.add(btnPanel, cc.xywh(2, rowCount - 1, columnCount - 2, 1)); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); getRootPane().setDefaultButton(nextBtn); // set first panel to show... updatePage(); pack(); int height = getHeight(); setSize(height * 5 / 4, height); setLocationRelativeTo(getParent()); }
From source file:phex.gui.dialogs.FilterLibraryDialog.java
License:Open Source License
/** * /*from w w w. j av a 2 s. com*/ */ private void prepareComponent() { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent evt) { closeDialog(); } }); CellConstraints cc = new CellConstraints(); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); JPanel contentPanel = new JPanel(); //JPanel contentPanel = new FormDebugPanel(); contentPane.add(contentPanel, BorderLayout.CENTER); FormLayout layout = new FormLayout("4dlu, fill:d:grow, 4dlu, d, 4dlu", // columns "p, 10dlu, p, 3dlu, p, 3dlu, p, fill:p:grow, 10dlu, p, 6dlu, p, 3dlu, p, 3dlu, p, 10dlu, " + // rows "p, 3dlu, p, 6dlu"); // btn rows PanelBuilder builder = new PanelBuilder(layout, contentPanel); int columnCount = layout.getColumnCount(); int rowCount = layout.getRowCount(); DialogBanner banner = new DialogBanner(Localizer.getString("FilterLibraryDialog_BannerHeader"), Localizer.getString("FilterLibraryDialog_BannerSubHeader")); builder.add(banner, cc.xywh(1, 1, columnCount, 1)); filterListModel = new CollectionsListModel(); filterListModel.addAll(LibraryPrefs.LibraryExclusionRegExList.get()); filterList = new JList(filterListModel); builder.add(new JScrollPane(filterList), cc.xywh(2, 3, 1, 6)); JButton addBtn = new JButton(Localizer.getString("FilterLibraryDialog_Add")); addBtn.addActionListener(new AddBtnListener()); builder.add(addBtn, cc.xy(4, 3)); JButton editBtn = new JButton(Localizer.getString("FilterLibraryDialog_Edit")); editBtn.addActionListener(new EditBtnListener()); builder.add(editBtn, cc.xy(4, 5)); JButton removeBtn = new JButton(Localizer.getString("FilterLibraryDialog_Remove")); removeBtn.addActionListener(new RemoveBtnListener()); builder.add(removeBtn, cc.xy(4, 7)); builder.addSeparator(Localizer.getString("FilterLibraryDialog_Examples"), cc.xywh(2, 10, 3, 1)); builder.addLabel(Localizer.getString("FilterLibraryDialog_Example1"), cc.xywh(2, 12, 3, 1)); builder.addLabel(Localizer.getString("FilterLibraryDialog_Example2"), cc.xywh(2, 14, 3, 1)); builder.addLabel(Localizer.getString("FilterLibraryDialog_Example3"), cc.xywh(2, 16, 3, 1)); builder.add(new JSeparator(), cc.xywh(1, rowCount - 3, columnCount, 1)); JButton cancelBtn = new JButton(Localizer.getString("Cancel")); cancelBtn.addActionListener(new CancelBtnListener()); JButton okBtn = new JButton(Localizer.getString("OK")); okBtn.addActionListener(new OkBtnListener()); JPanel btnPanel = ButtonBarFactory.buildOKCancelBar(okBtn, cancelBtn); builder.add(btnPanel, cc.xywh(2, rowCount - 1, columnCount - 2, 1)); pack(); setLocationRelativeTo(getParent()); }
From source file:phex.gui.dialogs.UpdateNotificationDialog.java
License:Open Source License
private void prepareComponent() { CloseEventHandler closeEventHandler = new CloseEventHandler(); addWindowListener(closeEventHandler); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); JPanel contentPanel = new JPanel(); //JPanel contentPanel = new FormDebugPanel(); contentPane.add(contentPanel, BorderLayout.CENTER); CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("2dlu, fill:d:grow, 2dlu", // columns "p, p, 16dlu, fill:p:grow, 16dlu," + // rows "p, 2dlu, p, 4dlu"); //btn rows PanelBuilder contentPB = new PanelBuilder(layout, contentPanel); int columnCount = layout.getColumnCount(); int rowCount = layout.getRowCount(); DialogBanner banner = new DialogBanner(Localizer.getString("UpdateNotification_BannerHeader"), Localizer.getString("UpdateNotification_BannerSubHeader")); contentPB.add(banner, cc.xywh(1, 1, columnCount, 1)); contentPB.add(new JSeparator(), cc.xywh(1, 2, columnCount, 1)); JPanel notifyPanel = buildNotificationPanel(); contentPB.add(notifyPanel, cc.xy(2, 4, "center, center")); contentPB.add(new JSeparator(), cc.xywh(1, rowCount - 3, columnCount, 1)); JButton closeBtn = new JButton(Localizer.getString("Close")); closeBtn.addActionListener(closeEventHandler); JButton downloadBtn = new JButton(Localizer.getString("Download")); downloadBtn.setDefaultCapable(true); downloadBtn.setRequestFocusEnabled(true); downloadBtn.addActionListener(new DownloadBtnListener()); JPanel btnPanel = ButtonBarFactory.buildOKCancelBar(downloadBtn, closeBtn); contentPB.add(btnPanel, cc.xywh(2, rowCount - 1, columnCount - 2, 1)); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); getRootPane().setDefaultButton(downloadBtn); pack();/*from w w w. ja v a2s. co m*/ setLocationRelativeTo(getParent()); }
From source file:tvbrowser.ui.configassistant.AuthenticationChannelCardPanel.java
License:Open Source License
public void createPanel() { mSettingsPanelList = new ArrayList<SettingsPanel>(0); FormLayout layout = new FormLayout("5dlu,default:grow,5dlu"); PanelBuilder pb = new PanelBuilder(layout, new ScrollableJPanel()); TvDataServiceProxy[] tvDataServices = TvDataServiceProxyManager.getInstance().getDataServices(); for (TvDataServiceProxy dataService : tvDataServices) { SettingsPanel panel = dataService.getAuthenticationPanel(); if (panel != null) { mSettingsPanelList.add(panel); layout.appendRow(RowSpec.decode("10dlu")); layout.appendRow(RowSpec.decode("default")); JComponent x = pb.addSeparator(dataService.getInfo().getName(), CC.xyw(1, layout.getRowCount(), 3)); try { Method getFont = x.getComponent(0).getClass().getMethod("getFont", new Class[0]); Method setFont = x.getComponent(0).getClass().getMethod("setFont", new Class[] { Font.class }); Font f = (Font) getFont.invoke(x.getComponent(0), new Object[0]); f = f.deriveFont(Font.BOLD); setFont.invoke(x.getComponent(0), new Object[] { f }); } catch (Exception e) { }/*from w w w . java2 s. c o m*/ layout.appendRow(RowSpec.decode("5dlu")); layout.appendRow(RowSpec.decode("fill:default:grow")); pb.add(panel, CC.xy(2, layout.getRowCount())); } } mContent = new JPanel(new FormLayout("15dlu,default:grow,15dlu", "default,15dlu,default,5dlu,fill:0dlu:grow,5dlu,default,15dlu")); mContent.add(new StatusPanel(StatusPanel.CHANNELS), CC.xyw(1, 1, 3)); mContent.add(UiUtilities.createHtmlHelpTextArea(mLocalizer.msg("info1", "<div style=\"font-weight:bold;\">Some TV data sources need authentication. You need to enter the authentication data if you want to get TV data for the channels of the shown TV data sources.</div>")), CC.xy(2, 3)); mScrollPane = new JScrollPane(pb.getPanel()); mScrollPane.setBorder(null); mScrollPane.setViewportBorder(null); mScrollPane.getViewport().setOpaque(false); mContent.add(mScrollPane, CC.xy(2, 5)); mContent.add(UiUtilities.createHtmlHelpTextArea(mLocalizer.msg("info2", "<div style=\"color:green;font-weight:bold;font-size:medium;\">If you don't need the channels of the listed TV data sources you can skip to the next step.</div>")), CC.xy(2, 7)); }
From source file:uk.ac.ebi.caf.component.factory.PreferencePanelFactory.java
License:Open Source License
public static void getPreferenceEditor(final BooleanPreference preference, JComponent component, final Action onFocusLost, FormLayout layout) { final JLabel label = LabelFactory.newFormLabel(preference.getName(), preference.getDescription()); final JCheckBox active = new JCheckBox(); active.setSelected(preference.get()); component.add(label, cc.xy(1, layout.getRowCount())); component.add(active, cc.xy(3, layout.getRowCount())); layout.appendRow(new RowSpec(Sizes.DLUY4)); layout.appendRow(new RowSpec(Sizes.PREFERRED)); active.addChangeListener(new ChangeListener() { @Override// w w w . j ava 2 s. c o m public void stateChanged(ChangeEvent e) { preference.put(active.isSelected()); onFocusLost.actionPerformed( new ActionEvent(active, ActionEvent.ACTION_PERFORMED, "Object state updated")); } }); }
From source file:uk.ac.ebi.caf.component.factory.PreferencePanelFactory.java
License:Open Source License
public static void getPreferenceEditor(final IntegerPreference preference, final JComponent component, final Action onFocusLost, FormLayout layout) { final JLabel label = LabelFactory.newFormLabel(preference.getName(), preference.getDescription()); final SpinnerNumberModel model = new SpinnerNumberModel(preference.get().intValue(), Integer.MIN_VALUE, Integer.MAX_VALUE, 1); final JSpinner spinner = new JSpinner(model); spinner.setEditor(new JSpinner.NumberEditor(spinner, "#")); // spinner.setPreferredSize(new Dimension(64, spinner.getPreferredSize().height)); component.add(label, cc.xy(1, layout.getRowCount())); component.add(spinner, cc.xy(3, layout.getRowCount())); layout.appendRow(new RowSpec(Sizes.DLUY4)); layout.appendRow(new RowSpec(Sizes.PREFERRED)); spinner.addChangeListener(new ChangeListener() { @Override/*from ww w.j a va2 s . co m*/ public void stateChanged(ChangeEvent e) { if (!preference.get().equals(spinner.getValue())) { preference.put((Integer) model.getValue()); } } }); addFocusLostAction(spinner, onFocusLost, preference); }
From source file:uk.ac.ebi.caf.component.factory.PreferencePanelFactory.java
License:Open Source License
public static void getPreferenceEditor(final StringPreference preference, final JComponent component, final Action onFocusLost, FormLayout layout) { final JLabel label = LabelFactory.newFormLabel(preference.getName(), preference.getDescription()); final JTextField field = FieldFactory.newField(preference.get()); component.add(label, cc.xy(1, layout.getRowCount())); component.add(field, cc.xy(3, layout.getRowCount())); layout.appendRow(new RowSpec(Sizes.DLUY4)); layout.appendRow(new RowSpec(Sizes.PREFERRED)); // fires to change the preference an the focus lost action final Timer timer = new Timer(1750, new ActionListener() { @Override/* ww w . j a va 2 s. co m*/ public void actionPerformed(ActionEvent e) { String value = field.getText(); if (!value.equals(preference.get())) { if (field.getText().isEmpty()) { field.setText(preference.getDefault()); } else { preference.put(value); onFocusLost.actionPerformed(e); } } } }); timer.setRepeats(false); field.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { timer.restart(); } @Override public void removeUpdate(DocumentEvent e) { timer.restart(); } @Override public void changedUpdate(DocumentEvent e) { timer.restart(); } }); }
From source file:uk.ac.ebi.caf.component.factory.PreferencePanelFactory.java
License:Open Source License
public static void getPreferenceEditor(final FilePreference preference, final JComponent component, final Action onFocusLost, FormLayout layout) { final JLabel label = LabelFactory.newFormLabel(preference.getName(), preference.getDescription()); final JTextField field = FieldFactory.newField(preference.get().getAbsolutePath()); final JButton browse = ButtonFactory.newCleanButton(new AbstractAction("Browse") { @Override/*from w w w . ja v a 2s .c o m*/ public void actionPerformed(ActionEvent e) { chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chooser.setSelectedFile(preference.get()); int choice = chooser.showOpenDialog(component); if (choice == JFileChooser.APPROVE_OPTION) { field.setText(chooser.getSelectedFile().getAbsolutePath()); preference.put(chooser.getSelectedFile()); onFocusLost.actionPerformed( new ActionEvent(preference, ActionEvent.ACTION_PERFORMED, "File Choosen")); } } }); component.add(label, cc.xy(1, layout.getRowCount())); component.add(field, cc.xy(3, layout.getRowCount())); component.add(browse, cc.xy(5, layout.getRowCount())); layout.appendRow(new RowSpec(Sizes.DLUY4)); layout.appendRow(new RowSpec(Sizes.PREFERRED)); // fires to change the preference an the focus lost action final Timer timer = new Timer(1750, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { File value = new File(field.getText()); if (!value.equals(preference.get())) { if (field.getText().isEmpty()) { field.setText(preference.getDefault().getAbsolutePath()); } else { preference.put(value); onFocusLost.actionPerformed(e); } } } }); timer.setRepeats(false); field.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { timer.restart(); } @Override public void removeUpdate(DocumentEvent e) { timer.restart(); } @Override public void changedUpdate(DocumentEvent e) { timer.restart(); } }); }
From source file:uk.ac.ebi.mnb.dialog.file.NewGeneProduct.java
License:Open Source License
@Override public JPanel getForm() { JPanel panel = super.getForm(); FormLayout layout = (FormLayout) panel.getLayout(); layout.appendRow(new RowSpec(Sizes.DLUY4)); layout.appendRow(new RowSpec(Sizes.PREFERRED)); CellConstraints cc = new CellConstraints(); Box buttons = Box.createHorizontalBox(); buttons.add(protein);//w w w . j a v a 2s . c o m buttons.add(trna); buttons.add(rrna); protein.setSelected(true); panel.add(buttons, cc.xyw(1, layout.getRowCount(), layout.getColumnCount())); return panel; }
From source file:uk.ac.ebi.mnb.dialog.file.NewReaction.java
License:Open Source License
@Override public JPanel getForm() { JPanel panel = super.getForm(); equation = new SuggestionField(this, 5, new ReactionSuggestionHandler(), new ReplacementHandler()); FormLayout layout = (FormLayout) panel.getLayout(); layout.appendRow(new RowSpec(Sizes.DLUY4)); layout.appendRow(new RowSpec(Sizes.PREFERRED)); JLabel label = LabelFactory.newFormLabel("Reaction Equation", "Enter a text equation for your reaction (e.g. 1 A + B -> C [e])"); label.setHorizontalAlignment(JLabel.LEADING); panel.add(label, cc.xyw(1, layout.getRowCount(), layout.getColumnCount())); layout.appendRow(new RowSpec(Sizes.DLUY4)); layout.appendRow(new RowSpec(Sizes.PREFERRED)); panel.add(equation, cc.xyw(1, layout.getRowCount(), layout.getColumnCount())); return panel; }