List of usage examples for com.jgoodies.forms.layout FormLayout FormLayout
public FormLayout(ColumnSpec[] colSpecs, RowSpec[] rowSpecs)
From source file:com.mebigfatguy.mongobrowser.dialogs.ConnectionDialog.java
License:Apache License
/** * create the panel that houses the input form * // w w w.j av a 2 s . c o m * @return the form panel */ private JPanel createFormPanel() { JPanel p = new JPanel(); p.setLayout(new FormLayout("6dlu, pref, 5dlu, 200px, 6dlu", "6dlu, pref, 2dlu, pref, 6dlu")); CellConstraints cc = new CellConstraints(); JLabel serverLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Server)); p.add(serverLabel, cc.xy(2, 2)); serverField = new JTextField(); p.add(serverField, cc.xy(4, 2)); serverField.setText("localhost"); serverLabel.setLabelFor(serverField); JLabel portLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Port)); p.add(portLabel, cc.xy(2, 4)); portField = new JTextField(); portField.setDocument(new IntegerDocument()); p.add(portField, cc.xy(4, 4)); portField.setText("27017"); portLabel.setLabelFor(portField); return p; }
From source file:com.mebigfatguy.mongobrowser.dialogs.ManageIndicesDialog.java
License:Apache License
private JPanel createIndicesListPanel(List<IndexDescription> indices) { JPanel p = new JPanel(); p.setLayout(new FormLayout("6dlu, pref:grow, 5dlu, pref, 6dlu", "6dlu, 12dlu:grow, pref, 3dlu, pref, 12dlu:grow, 6dlu, pref, 6dlu")); CellConstraints cc = new CellConstraints(); ManageIndicesModel model = new ManageIndicesModel(indices); indicesTable = new JTable(model); indicesTable.setDefaultEditor(String.class, new DefaultCellEditor(new JTextField())); indicesTable.setDefaultEditor(IndexFieldList.class, new IndexFieldListCellEditor()); indicesTable.setDefaultRenderer(IndexFieldList.class, new IndexFieldListCellRenderer()); p.add(new JScrollPane(indicesTable), cc.xywh(2, 2, 1, 5)); addIndexButton = new JButton(MongoBundle.getString(MongoBundle.Key.AddIndex)); p.add(addIndexButton, cc.xy(4, 3));// w w w. ja v a 2s. c o m removeIndexButton = new JButton(MongoBundle.getString(MongoBundle.Key.RemoveIndex)); p.add(removeIndexButton, cc.xy(4, 5)); return p; }
From source file:com.mebigfatguy.mongobrowser.dialogs.MongoControlPanel.java
License:Apache License
private void initComponents() { setBorder(BorderFactory.createLineBorder(Color.BLACK)); setLayout(/*from w w w.ja va2 s. c om*/ new FormLayout("3dlu, pref, 1dlu, 150px, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref", "pref")); CellConstraints cc = new CellConstraints(); JLabel dbLabel = new JLabel(MongoBundle.getString(MongoBundle.Key.Database)); dbComboBox = new JComboBox(new DefaultComboBoxModel()); dbComboBox.setEnabled(false); dbLabel.setLabelFor(dbComboBox); add(dbLabel, cc.xy(2, 1)); add(dbComboBox, cc.xy(4, 1)); dbNewCollectionButton = new JButton(new NewCollectionAction(context)); ImageIcon icon = new ImageIcon( MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newcollection.png")); dbNewCollectionButton.setIcon(icon); dbNewCollectionButton.setText(""); dbNewCollectionButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); dbNewCollectionButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewCollection)); add(dbNewCollectionButton, cc.xy(6, 1)); dbNewCollectionButton.setEnabled(false); dbNewObjectButton = new JButton(new NewObjectAction(context)); icon = new ImageIcon( MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newobject.png")); dbNewObjectButton.setIcon(icon); dbNewObjectButton.setText(""); dbNewObjectButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); dbNewObjectButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewObject)); add(dbNewObjectButton, cc.xy(8, 1)); dbNewObjectButton.setEnabled(false); dbNewKeyValueButton = new JButton(new NewKeyValueAction(context)); icon = new ImageIcon( MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/newkeyvalue.png")); dbNewKeyValueButton.setIcon(icon); dbNewKeyValueButton.setText(""); dbNewKeyValueButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); dbNewKeyValueButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.NewKeyValue)); add(dbNewKeyValueButton, cc.xy(10, 1)); dbNewKeyValueButton.setEnabled(false); dbDeleteButton = new JButton(new DeleteAction(context)); icon = new ImageIcon( MongoControlPanel.class.getResource("/com/mebigfatguy/mongobrowser/resources/delete.png")); dbDeleteButton.setIcon(icon); dbDeleteButton.setText(null); dbDeleteButton.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); dbDeleteButton.setToolTipText(MongoBundle.getString(MongoBundle.Key.Delete)); add(dbDeleteButton, cc.xy(12, 1)); dbDeleteButton.setEnabled(false); }
From source file:com.mebigfatguy.polycasso.ProxyDialog.java
License:Apache License
/** * creates the proxy settings panel//from ww w . ja v a 2 s . c o m * * @return the proxy panel */ private JPanel createProxyPanel() { JPanel proxyPanel = new JPanel(); proxyPanel.setLayout(new FormLayout("6dlu, pref, 3dlu, 200px:grow, 6dlu", "5dlu, pref, 3dlu, pref, 5dlu")); CellConstraints cc = new CellConstraints(); JLabel hostLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.ProxyHost)); proxyPanel.add(hostLabel, cc.xy(2, 2)); proxyHostField = new JTextField(); proxyPanel.add(proxyHostField, cc.xy(4, 2)); hostLabel.setLabelFor(proxyHostField); JLabel portLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.ProxyPort)); proxyPanel.add(portLabel, cc.xy(2, 4)); proxyPortField = new JTextField(); proxyPortField.setDocument(new IntegerDocument()); proxyPanel.add(proxyPortField, cc.xy(4, 4)); portLabel.setLabelFor(proxyPortField); populateValues(); return proxyPanel; }
From source file:com.mebigfatguy.polycasso.SettingsDialog.java
License:Apache License
/** * creates the options (settings) panel//from w w w . j av a2 s . c o m * * @return the options panel */ private JPanel createOptionsPanel() { JPanel optPanel = new JPanel(); optPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(PolycassoBundle.getString(PolycassoBundle.Key.ImageOptions)), BorderFactory.createEmptyBorder(10, 10, 10, 10))); optPanel.setLayout(new FormLayout("pref, 3dlu, 100px, 5dlu, pref, 3dlu, 100px", "pref, 1dlu, pref, 15dlu, pref, 1dlu, pref, 1dlu, pref, 1dlu, pref")); CellConstraints cc = new CellConstraints(); JLabel maxSizeLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaxImageSize)); optPanel.add(maxSizeLabel, cc.xyw(1, 1, 7)); JLabel widthLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.Width)); optPanel.add(widthLabel, cc.xy(1, 3)); widthField = new JTextField(4); widthField.setDocument(new IntegerDocument()); widthLabel.setLabelFor(widthField); optPanel.add(widthField, cc.xy(3, 3)); widthField.addFocusListener(focuser); JLabel heightLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.Height)); optPanel.add(heightLabel, cc.xy(5, 3)); heightField = new JTextField(4); heightField.setDocument(new IntegerDocument()); heightLabel.setLabelFor(heightField); optPanel.add(heightField, cc.xy(7, 3)); heightField.addFocusListener(focuser); JLabel maxPolyLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumPolygons)); optPanel.add(maxPolyLabel, cc.xyw(1, 5, 5)); maxPolygonField = new JTextField(4); maxPolygonField.setDocument(new IntegerDocument()); maxPolyLabel.setLabelFor(maxPolygonField); optPanel.add(maxPolygonField, cc.xy(7, 5)); maxPolygonField.addFocusListener(focuser); JLabel maxPolyPointLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumPolygonPoints)); optPanel.add(maxPolyPointLabel, cc.xyw(1, 7, 7)); maxPolygonPointsField = new JTextField(4); maxPolygonPointsField.setDocument(new IntegerDocument()); maxPolyPointLabel.setLabelFor(maxPolygonPointsField); optPanel.add(maxPolygonPointsField, cc.xy(7, 7)); maxPolygonPointsField.addFocusListener(focuser); JLabel maxPtMoveLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumPointMovement)); optPanel.add(maxPtMoveLabel, cc.xyw(1, 9, 5)); maxPtMoveField = new JTextField(4); maxPtMoveField.setDocument(new IntegerDocument()); maxPtMoveLabel.setLabelFor(maxPtMoveField); optPanel.add(maxPtMoveField, cc.xy(7, 9)); maxPtMoveField.addFocusListener(focuser); JLabel maxColorChangeLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumColorChange)); optPanel.add(maxColorChangeLabel, cc.xyw(1, 11, 5)); maxColorChangeField = new JTextField(4); maxColorChangeField.setDocument(new IntegerDocument()); maxColorChangeLabel.setLabelFor(maxColorChangeField); optPanel.add(maxColorChangeField, cc.xy(7, 11)); maxColorChangeField.addFocusListener(focuser); populateValues(); return optPanel; }
From source file:com.mebigfatguy.polycasso.SettingsDialog.java
License:Apache License
private JPanel createGeneticsPanel() { JPanel geneticsPanel = new JPanel(); geneticsPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(PolycassoBundle.getString(PolycassoBundle.Key.GeneticsOptions)), BorderFactory.createEmptyBorder(10, 10, 10, 10))); geneticsPanel.setLayout(new FormLayout("6dlu, pref, 3dlu, 100px, 3dlu", "pref, 1dlu, pref, 1dlu, pref, 1dlu, pref, 1dlu, pref, 1dlu, pref, 1dlu, pref")); CellConstraints cc = new CellConstraints(); JLabel generationSizeLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.GenerationSize)); geneticsPanel.add(generationSizeLabel, cc.xyw(1, 1, 2)); generationSizeField = new JTextField(4); generationSizeField.setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.GenerationSizeToolTip)); generationSizeField.setDocument(new IntegerDocument()); generationSizeLabel.setLabelFor(generationSizeField); geneticsPanel.add(generationSizeField, cc.xy(4, 1)); generationSizeField.addFocusListener(focuser); JLabel eliteSizeLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.EliteSize)); geneticsPanel.add(eliteSizeLabel, cc.xyw(1, 3, 2)); eliteSizeField = new JTextField(4); eliteSizeField.setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.EliteSizeToolTip)); eliteSizeField.setDocument(new IntegerDocument()); eliteSizeLabel.setLabelFor(eliteSizeField); geneticsPanel.add(eliteSizeField, cc.xy(4, 3)); eliteSizeField.addFocusListener(focuser); useAnnealingButton = new JCheckBox(PolycassoBundle.getString(PolycassoBundle.Key.UseAnnealing)); useAnnealingButton.setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.UseAnnealingToolTip)); geneticsPanel.add(useAnnealingButton, cc.xyw(1, 5, 5)); JLabel startTemperatureLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.StartTemperature)); geneticsPanel.add(startTemperatureLabel, cc.xy(2, 7)); startTemperatureField = new JTextField(4); startTemperatureField/*from w ww. j a v a2s .c om*/ .setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.StartTemperatureToolTip)); startTemperatureField.setDocument(new DoubleDocument()); startTemperatureLabel.setLabelFor(startTemperatureField); geneticsPanel.add(startTemperatureField, cc.xy(4, 7)); startTemperatureField.addFocusListener(focuser); JLabel coolingRateLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.CoolingRate)); geneticsPanel.add(coolingRateLabel, cc.xy(2, 9)); coolingRateField = new JTextField(4); coolingRateField.setToolTipText(PolycassoBundle.getString(PolycassoBundle.Key.CoolingRateToolTip)); coolingRateField.setDocument(new DoubleDocument()); coolingRateLabel.setLabelFor(coolingRateField); geneticsPanel.add(coolingRateField, cc.xy(4, 9)); coolingRateField.addFocusListener(focuser); return geneticsPanel; }
From source file:com.mitrais.mwom.gui.TimesheetGUI.java
License:Open Source License
@Override protected void startup() { {//www. j a v a 2 s .c o m getMainFrame().setSize(1024, 700); } topPanel = new JPanel(); BoxLayout mainFrameLayout = new BoxLayout(getMainFrame().getContentPane(), javax.swing.BoxLayout.X_AXIS); getMainFrame().getContentPane().setLayout(mainFrameLayout); getMainFrame().getContentPane().add(topPanel); BorderLayout topPanelLayout = new BorderLayout(); topPanel.setLayout(topPanelLayout); topPanel.setPreferredSize(new java.awt.Dimension(0, 0)); topPanel.setSize(1024, 700); { jPanel1 = new JPanel(); FormLayout jPanel1Layout = new FormLayout("max(p;1dlu):grow, max(p;1dlu):grow", "fill:max(p;5dlu):grow"); jPanel1.setLayout(jPanel1Layout); topPanel.add(jPanel1, BorderLayout.NORTH); topPanel.add(getJPanel2(), BorderLayout.CENTER); jPanel1.setPreferredSize(new java.awt.Dimension(1016, 224)); { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel1.add(jPanel3, new CellConstraints("2, 1, 1, 1, fill, default")); jPanel3.setLayout(jPanel3Layout); jPanel3.setBorder(BorderFactory.createTitledBorder("Search")); jPanel3.setSize(300, 230); { jToolBar1 = new JToolBar(); jPanel3.add(jToolBar1, BorderLayout.NORTH); jToolBar1.setPreferredSize(new java.awt.Dimension(315, 32)); jToolBar1.add(getJButton3()); } { jPanel7 = new JPanel(); jPanel3.add(jPanel7, BorderLayout.CENTER); jPanel7.setLayout(null); jPanel7.setPreferredSize(new java.awt.Dimension(372, 152)); jPanel7.setSize(300, 152); jPanel7.add(getJTextField1(), new CellConstraints("2, 4, 3, 1, default, default")); jPanel7.add(getJLabel3(), new CellConstraints("1, 2, 1, 1, default, bottom")); jPanel7.add(getJComboBox1(), new CellConstraints("2, 2, 3, 1, default, default")); } { jLabel1 = new JLabel(); jPanel7.add(jLabel1, new CellConstraints("1, 3, 1, 1, default, bottom")); jPanel7.add(getCalendarComboBox1(), new CellConstraints("2, 3, 1, 1, default, default")); jPanel7.add(getCalendarComboBox2(), new CellConstraints("4, 3, 1, 1, default, default")); jPanel7.add(getJLabel2(), new CellConstraints("3, 3, 1, 1, default, default")); jPanel7.add(getJLabel5(), new CellConstraints("1, 4, 1, 1, default, bottom")); jPanel7.add(getJButton5()); jLabel1.setName("jLabel1"); jLabel1.setBounds(-1, 61, 77, 16); } } { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel1.add(jPanel4, new CellConstraints("1, 1, 1, 1, fill, default")); jPanel4.setLayout(jPanel4Layout); jPanel4.setBorder(BorderFactory.createTitledBorder(BorderFactory.createTitledBorder(""), "Detail", TitledBorder.LEADING, TitledBorder.ABOVE_TOP)); jPanel4.setName("jPanel4"); jPanel4.add(getJPanel6(), BorderLayout.CENTER); jPanel4.add(getJToolBar2(), BorderLayout.NORTH); } } show(topPanel); }
From source file:com.moneydance.modules.features.mdvenmoimporter.VenmoImporterWindow.java
License:Open Source License
public VenmoImporterWindow(Main extension) { super("VenmoImporter Console"); this.extension = extension; loadSettings();//from w ww. java 2 s.c om setResizable(false); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); setBounds(100, 100, 516, 176); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(10, 10, 10, 10)); setContentPane(contentPane); contentPane.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("8dlu"), FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JLabel lblVenmoToken = new JLabel("Venmo Token"); lblVenmoToken.setHorizontalAlignment(SwingConstants.RIGHT); contentPane.add(lblVenmoToken, "2, 2"); venmoTokenField = new JTextField(venmoToken); venmoTokenField.setToolTipText(venmoTokenTooltip); contentPane.add(venmoTokenField, "4, 2, fill, default"); venmoTokenField.setColumns(50); JLabel lblAccount = new JLabel("Account"); contentPane.add(lblAccount, "2, 4, right, default"); targetAccountCombo = new JComboBox<>( new Vector<>(extension.getUnprotectedContext().getRootAccount().getSubAccounts())); contentPane.add(targetAccountCombo, "4, 4, fill, default"); if (targetAcctId != null) { targetAccountCombo.setSelectedItem( extension.getUnprotectedContext().getCurrentAccountBook().getAccountByUUID(targetAcctId)); } JLabel lblDescriptionFormat = new JLabel("Memo template"); contentPane.add(lblDescriptionFormat, "2, 6, right, default"); descriptionFormatField = new JTextField( descriptionFormat == null ? descriptionFormatDefault : descriptionFormat); descriptionFormatField.setToolTipText(descriptionFormatTooltip); contentPane.add(descriptionFormatField, "4, 6, fill, default"); descriptionFormatField.setColumns(10); panel = new JPanel(); panel.setBorder(null); contentPane.add(panel, "2, 8, 3, 1, fill, fill"); btnDelete = new JButton("Delete Settings"); panel.add(btnDelete); btnCancel = new JButton("Cancel"); panel.add(btnCancel); btnSave = new JButton("Save"); panel.add(btnSave); btnDownloadTransactions = new JButton("Download Transactions"); panel.add(btnDownloadTransactions); btnCancel.addActionListener(this); btnSave.addActionListener(this); btnDelete.addActionListener(this); btnDownloadTransactions.addActionListener(this); enableEvents(WindowEvent.WINDOW_CLOSING); }
From source file:com.mrfeinberg.babelizer.app.BabelizerMain.java
License:Apache License
public BabelizerMain() { phrase.addKeyListener(new TextAreaActionProvider(new ActionListener() { public void actionPerformed(final ActionEvent e) { goButton.doClick();//from w w w. ja v a 2 s .c om } })); goButton.addActionListener(this); phrase.setLineWrap(true); phrase.setRows(4); cycleCheckbox.setSelected(true); final JFrame f = getFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setJMenuBar(createMenuBar(f)); final Container cp = f.getContentPane(); cp.setLayout(new BorderLayout()); final FormLayout layout = new FormLayout(// "right:p, 4dlu, p:g, p", // "p, 3dlu, p, 8dlu, p, 2dlu, t:p, 8dlu, f:d:g"); final PanelBuilder builder = new PanelBuilder(layout); final CellConstraints cc = new CellConstraints(); builder.setDefaultDialogBorder(); builder.addLabel("From", cc.xy(1, 1)); builder.add(fromMenu, cc.xywh(3, 1, 2, 1)); builder.addLabel("To", cc.xy(1, 3)); builder.add(toMenu, cc.xywh(3, 3, 2, 1)); { final JScrollPane scrollPane = new JScrollPane(phrase); scrollPane.getVerticalScrollBar().setFocusable(false); builder.add(scrollPane, cc.xywh(1, 5, 4, 1)); } builder.add(cycleCheckbox, cc.xywh(1, 7, 3, 1)); builder.add(goButton, cc.xy(4, 7)); { final JScrollPane scrollPane = new JScrollPane(textPane); scrollPane.getVerticalScrollBar().setFocusable(false); builder.add(scrollPane, cc.xywh(1, 9, 4, 1)); } cp.add(builder.getContainer()); cp.add(status, BorderLayout.SOUTH); factoryChosen(new com.mrfeinberg.translation.plugin.altavista.AltavistaTranslationServiceFactory()); f.setVisible(true); phrase.grabFocus(); phrase.selectAll(); }