List of usage examples for java.awt GridBagLayout GridBagLayout
public GridBagLayout()
From source file:de.codesourcery.eve.skills.ui.components.impl.BlueprintBrowserComponent.java
@Override protected JPanel createPanel() { popupMenuBuilder.addItem("Create production plan...", new AbstractAction() { @Override/*from w ww .j a v a2 s. c om*/ public boolean isEnabled() { return blueprintChooser.getCurrentlySelectedBlueprint() != null; } @Override public void actionPerformed(ActionEvent e) { final Blueprint blueprint = blueprintChooser.getCurrentlySelectedBlueprint(); if (blueprint != null) { doubleClicked(blueprint); } } }); // add text fields final JPanel textFields = new JPanel(); textFields.setLayout(new GridBagLayout()); selectedME.setColumns(5); selectedPE.setColumns(5); quantity.setColumns(6); selectedME.setHorizontalAlignment(JTextField.RIGHT); selectedPE.setHorizontalAlignment(JTextField.RIGHT); quantity.setHorizontalAlignment(JTextField.RIGHT); selectedME.addActionListener(this); selectedPE.addActionListener(this); quantity.addActionListener(this); textFields.add(new JLabel("ME"), constraints(0, 0).resizeBoth().end()); textFields.add(selectedME, constraints(1, 0).weightX(0.1).anchorWest().end()); textFields.add(new JLabel("PE"), constraints(0, 1).resizeBoth().end()); textFields.add(selectedPE, constraints(1, 1).weightX(0.1).anchorWest().end()); textFields.add(new JLabel("Quantity"), constraints(0, 2).resizeBoth().end()); textFields.add(quantity, constraints(1, 2).weightX(0.1).anchorWest().end()); // add combobox with cost calculators // add POS / NPC station buttons + label JPanel buttonPanel = new JPanel(); final ButtonGroup group = new ButtonGroup(); group.add(posButton); group.add(npcStationButton); posButton.addActionListener(this); npcStationButton.addActionListener(this); buttonPanel.add(posButton); buttonPanel.add(npcStationButton); textFields.add(new JLabel("Location"), constraints(0, 3).noResizing().end()); textFields.add(buttonPanel, constraints(1, 3).useRemainingWidth().end()); // add text area textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); setMonospacedFont(textArea); final JPanel rightPanel = new JPanel(); rightPanel.setLayout(new GridBagLayout()); rightPanel.add(textFields, constraints(0, 0).noResizing().end()); rightPanel.add(new JScrollPane(textArea), constraints(0, 1).useRemainingSpace().end()); final ImprovedSplitPane splitPane = new ImprovedSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.blueprintChooser.createPanel(), rightPanel); splitPane.setDividerLocation(0.4); final JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); panel.add(splitPane, constraints(0, 0).resizeBoth().end()); return panel; }
From source file:biomine.bmvis2.pipeline.sources.QueryGraphSource.java
public static QueryGraphSource createFromDialog(Collection<VisualNode> start, String database) { final CrawlSuggestionList sel = new CrawlSuggestionList(); final JDialog dial = new JDialog(); if (database != null) sel.setDatabase(database);/*from w w w . j ava 2 s.c o m*/ for (VisualNode vn : start) { if (vn.getBMNode() != null) sel.addNode(vn); } dial.setModalityType(ModalityType.APPLICATION_MODAL); final CrawlQuery q = new CrawlQuery(); // Helper class to pass back data from anonymous inner classes to this method class Z { boolean okPressed = false; } final Z z = new Z(); JButton okButton = new JButton(new AbstractAction("OK") { public void actionPerformed(ActionEvent arg0) { dial.setVisible(false); q.addAll(sel.getQueryTerms()); z.okPressed = true; } }); JPanel pane = new JPanel(); pane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.fill = c.BOTH; c.gridwidth = 2; c.gridx = 0; c.gridy = 0; pane.add(sel, c); c.weighty = 0; c.gridy++; c.fill = c.HORIZONTAL; c.gridwidth = 1; pane.add(okButton, c); dial.setContentPane(pane); dial.setSize(600, 500); dial.setVisible(true);//this will hopefully block if (z.okPressed) { if (q.size() == 0) { JOptionPane.showMessageDialog(dial, "At least 1 edge must be selected: no queries added"); return null; } return new QueryGraphSource(q, sel.getDatabase()); } return null; }
From source file:com.vgi.mafscaling.OpenLoop.java
protected void createGraghTab() { JPanel cntlPanel = new JPanel(); JPanel plotPanel = createGraphPlotPanel(cntlPanel); add(plotPanel, "<html><div style='text-align: center;'>C<br>h<br>a<br>r<br>t</div></html>"); GridBagLayout gbl_cntlPanel = new GridBagLayout(); gbl_cntlPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_cntlPanel.rowHeights = new int[] { 0, 0 }; gbl_cntlPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };/*w w w.ja va 2 s . com*/ gbl_cntlPanel.rowWeights = new double[] { 0 }; cntlPanel.setLayout(gbl_cntlPanel); GridBagConstraints gbc_check = new GridBagConstraints(); gbc_check.insets = insets2; gbc_check.gridx = 0; gbc_check.gridy = 0; checkBoxMafRpmData = new JCheckBox("MafV/RPM"); checkBoxMafRpmData.setActionCommand("mafrpm"); checkBoxMafRpmData.addActionListener(this); cntlPanel.add(checkBoxMafRpmData, gbc_check); gbc_check.gridx++; checkBoxRunData = new JCheckBox("AFR Error"); checkBoxRunData.setActionCommand("rdata"); checkBoxRunData.addActionListener(this); cntlPanel.add(checkBoxRunData, gbc_check); gbc_check.gridx++; createGraphCommonControls(cntlPanel, gbc_check.gridx); createChart(plotPanel, Y2AxisName); createMafSmoothingPanel(plotPanel); }
From source file:de.codesourcery.jasm16.ide.ui.views.CPUView.java
protected JPanel createPanel() { textArea.setFont(getMonospacedFont()); textArea.setEditable(false);//from w w w. j a va 2s . co m setColors(textArea); final JPanel panel = new JPanel(); setColors(panel); panel.setLayout(new GridBagLayout()); final GridBagConstraints cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH); panel.add(textArea, cnstrs); return panel; }
From source file:endrov.frameTime.FrameTimeWindow.java
/** * Regenerate UI/*from ww w . ja v a2 s. c o m*/ */ public void fillDatapart() { datapart.removeAll(); datapart.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridy = 0; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 0; datapart.add(new JLabel("Frame"), c); c.gridx = 1; datapart.add(new JLabel("Time"), c); for (int i = 0; i < inputVector.size(); i++) { c.gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 0; datapart.add(inputVector.get(i).frame, c); c.gridx = 1; datapart.add(inputVector.get(i).time, c); c.gridx = 2; c.fill = 0; c.weightx = 0; datapart.add(inputVector.get(i).bDelete, c); } setVisibleEvWindow(true); }
From source file:net.sf.jabref.gui.preftabs.AppearancePrefsTab.java
/** * Customization of appearance parameters. * * @param prefs a <code>JabRefPreferences</code> value *//* www . j a v a 2 s .c om*/ public AppearancePrefsTab(JabRefPreferences prefs) { this.prefs = prefs; setLayout(new BorderLayout()); // Font sizes: fontSize = new JTextField(5); // Row padding size: rowPadding = new JTextField(5); colorCodes = new JCheckBox(Localization.lang("Color codes for required and optional fields")); overrideFonts = new JCheckBox(Localization.lang("Override default font settings")); showGrid = new JCheckBox(Localization.lang("Show gridlines")); FormLayout layout = new FormLayout( "1dlu, 8dlu, left:pref, 4dlu, fill:pref, 4dlu, fill:60dlu, 4dlu, fill:pref", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); customLAF = new JCheckBox(Localization.lang("Use other look and feel")); // Only list L&F which are available List<String> lookAndFeels = LookAndFeel.getAvailableLookAndFeels(); classNamesLAF = new JComboBox<>(lookAndFeels.toArray(new String[lookAndFeels.size()])); classNamesLAF.setEditable(true); final JComboBox<String> clName = classNamesLAF; customLAF.addChangeListener(e -> clName.setEnabled(((JCheckBox) e.getSource()).isSelected())); // only the default L&F shows the the OSX specific first dropdownmenu if (!OS.OS_X) { JPanel pan = new JPanel(); builder.appendSeparator(Localization.lang("Look and feel")); JLabel lab = new JLabel( Localization.lang("Default look and feel") + ": " + UIManager.getSystemLookAndFeelClassName()); builder.nextLine(); builder.append(pan); builder.append(lab); builder.nextLine(); builder.append(pan); builder.append(customLAF); builder.nextLine(); builder.append(pan); JPanel pan2 = new JPanel(); lab = new JLabel(Localization.lang("Class name") + ':'); pan2.add(lab); pan2.add(classNamesLAF); builder.append(pan2); builder.nextLine(); builder.append(pan); lab = new JLabel(Localization .lang("Note that you must specify the fully qualified class name for the look and feel,")); builder.append(lab); builder.nextLine(); builder.append(pan); lab = new JLabel(Localization .lang("and the class must be available in your classpath next time you start JabRef.")); builder.append(lab); builder.nextLine(); } builder.leadingColumnOffset(2); JLabel lab; builder.appendSeparator(Localization.lang("General")); JPanel p1 = new JPanel(); lab = new JLabel(Localization.lang("Menu and label font size") + ":"); p1.add(lab); p1.add(fontSize); builder.append(p1); builder.nextLine(); builder.append(overrideFonts); builder.nextLine(); builder.appendSeparator(Localization.lang("Table appearance")); JPanel p2 = new JPanel(); p2.add(new JLabel(Localization.lang("Table row height padding") + ":")); p2.add(rowPadding); builder.append(p2); builder.nextLine(); builder.append(colorCodes); builder.nextLine(); builder.append(showGrid); builder.nextLine(); JButton fontButton = new JButton(Localization.lang("Set table font")); builder.append(fontButton); builder.nextLine(); builder.appendSeparator(Localization.lang("Table and entry editor colors")); builder.append(colorPanel); JPanel upper = new JPanel(); JPanel sort = new JPanel(); JPanel namesp = new JPanel(); JPanel iconCol = new JPanel(); GridBagLayout gbl = new GridBagLayout(); upper.setLayout(gbl); sort.setLayout(gbl); namesp.setLayout(gbl); iconCol.setLayout(gbl); overrideFonts.addActionListener(e -> fontSize.setEnabled(overrideFonts.isSelected())); fontButton.addActionListener(e -> new FontSelectorDialog(null, GUIGlobals.currentFont).getSelectedFont() .ifPresent(x -> usedFont = x)); JPanel pan = builder.getPanel(); pan.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(pan, BorderLayout.CENTER); }
From source file:edu.harvard.mcz.imagecapture.VerbatimClassifyDialog.java
protected void init() { setTitle("Interpret verbatim data into fields."); setBounds(100, 100, 1203, 899);// w w w .j a v a 2s . c om getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS)); { JPanel panelVerbatimValues = new JPanel(); contentPanel.add(panelVerbatimValues); GridBagLayout gbl_panelVerbatimValues = new GridBagLayout(); gbl_panelVerbatimValues.columnWidths = new int[] { 70, 0, 0, 0, 35, 0, 58, 0, 0, 0 }; gbl_panelVerbatimValues.rowHeights = new int[] { 15, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 0 }; gbl_panelVerbatimValues.columnWeights = new double[] { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0 }; gbl_panelVerbatimValues.rowWeights = new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE }; panelVerbatimValues.setLayout(gbl_panelVerbatimValues); { lblCount = new JLabel("New label"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.gridwidth = 2; gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.anchor = GridBagConstraints.SOUTHWEST; gbc_lblNewLabel.gridx = 0; gbc_lblNewLabel.gridy = 0; panelVerbatimValues.add(lblCount, gbc_lblNewLabel); } JButton buttonFillFromLast = new JButton("Fill From Last"); GridBagConstraints gbc_buttonFillFromLast = new GridBagConstraints(); gbc_buttonFillFromLast.anchor = GridBagConstraints.SOUTH; gbc_buttonFillFromLast.insets = new Insets(0, 0, 5, 5); gbc_buttonFillFromLast.gridx = 3; gbc_buttonFillFromLast.gridy = 0; panelVerbatimValues.add(buttonFillFromLast, gbc_buttonFillFromLast); { JLabel lblNewLabel_1 = new JLabel("Field values to apply to all records."); GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints(); gbc_lblNewLabel_1.anchor = GridBagConstraints.SOUTHEAST; gbc_lblNewLabel_1.gridwidth = 4; gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_1.gridx = 4; gbc_lblNewLabel_1.gridy = 0; panelVerbatimValues.add(lblNewLabel_1, gbc_lblNewLabel_1); } { JLabel lblNewLabel_2 = new JLabel("Verbatim Locality"); GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints(); gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_2.gridx = 0; gbc_lblNewLabel_2.gridy = 1; panelVerbatimValues.add(lblNewLabel_2, gbc_lblNewLabel_2); } { textFieldVerbLocality = new JTextArea(); textFieldVerbLocality.setEditable(false); textFieldVerbLocality.setRows(5); GridBagConstraints gbc_textField = new GridBagConstraints(); gbc_textField.gridheight = 3; gbc_textField.insets = new Insets(0, 0, 5, 5); gbc_textField.fill = GridBagConstraints.BOTH; gbc_textField.gridx = 1; gbc_textField.gridy = 1; panelVerbatimValues.add(textFieldVerbLocality, gbc_textField); textFieldVerbLocality.setColumns(30); } JLabel lblNewLabel = new JLabel("HigherGeography"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.anchor = GridBagConstraints.EAST; gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.gridx = 3; gbc_lblNewLabel.gridy = 1; panelVerbatimValues.add(lblNewLabel, gbc_lblNewLabel); GridBagConstraints gbc_textFieldHigherGeography = new GridBagConstraints(); gbc_textFieldHigherGeography.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldHigherGeography.gridwidth = 5; gbc_textFieldHigherGeography.insets = new Insets(0, 0, 5, 5); gbc_textFieldHigherGeography.gridx = 4; gbc_textFieldHigherGeography.gridy = 1; panelVerbatimValues.add(getComboBoxHighGeog(), gbc_textFieldHigherGeography); JButton btnCopyLocality = new JButton(">"); btnCopyLocality.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (textFieldSpecificLocality.getText().isEmpty()) { textFieldSpecificLocality.setText(textFieldVerbLocality.getText().replace("\n", "").trim()); } } }); GridBagConstraints gbc_btnCopyLocality = new GridBagConstraints(); gbc_btnCopyLocality.insets = new Insets(0, 0, 5, 5); gbc_btnCopyLocality.gridx = 2; gbc_btnCopyLocality.gridy = 2; panelVerbatimValues.add(btnCopyLocality, gbc_btnCopyLocality); JLabel lblSpecificLocality = new JLabel("Specific Locality"); GridBagConstraints gbc_lblSpecificLocality = new GridBagConstraints(); gbc_lblSpecificLocality.anchor = GridBagConstraints.EAST; gbc_lblSpecificLocality.insets = new Insets(0, 0, 5, 5); gbc_lblSpecificLocality.gridx = 3; gbc_lblSpecificLocality.gridy = 2; panelVerbatimValues.add(lblSpecificLocality, gbc_lblSpecificLocality); JLabel lblElevation = new JLabel("Elevation"); GridBagConstraints gbc_lblElevation = new GridBagConstraints(); gbc_lblElevation.anchor = GridBagConstraints.EAST; gbc_lblElevation.insets = new Insets(0, 0, 5, 5); gbc_lblElevation.gridx = 3; gbc_lblElevation.gridy = 3; panelVerbatimValues.add(lblElevation, gbc_lblElevation); textFieldMinElevation = new JTextField(); textFieldMinElevation.setMinimumSize(new Dimension(60, 19)); GridBagConstraints gbc_textFieldMinElevation = new GridBagConstraints(); gbc_textFieldMinElevation.insets = new Insets(0, 0, 5, 5); gbc_textFieldMinElevation.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldMinElevation.gridx = 4; gbc_textFieldMinElevation.gridy = 3; panelVerbatimValues.add(textFieldMinElevation, gbc_textFieldMinElevation); textFieldMinElevation.setColumns(4); JLabel lblTo = new JLabel("to"); GridBagConstraints gbc_lblTo = new GridBagConstraints(); gbc_lblTo.anchor = GridBagConstraints.EAST; gbc_lblTo.insets = new Insets(0, 0, 5, 5); gbc_lblTo.gridx = 5; gbc_lblTo.gridy = 3; panelVerbatimValues.add(lblTo, gbc_lblTo); textFieldMaxElevation = new JTextField(); textFieldMaxElevation.setMinimumSize(new Dimension(60, 19)); GridBagConstraints gbc_textFieldMaxElevation = new GridBagConstraints(); gbc_textFieldMaxElevation.anchor = GridBagConstraints.WEST; gbc_textFieldMaxElevation.insets = new Insets(0, 0, 5, 5); gbc_textFieldMaxElevation.gridx = 6; gbc_textFieldMaxElevation.gridy = 3; panelVerbatimValues.add(textFieldMaxElevation, gbc_textFieldMaxElevation); textFieldMaxElevation.setColumns(5); comboBoxElevUnits = new JComboBox(); GridBagConstraints gbc_comboBoxElevUnits = new GridBagConstraints(); gbc_comboBoxElevUnits.insets = new Insets(0, 0, 5, 5); gbc_comboBoxElevUnits.fill = GridBagConstraints.HORIZONTAL; gbc_comboBoxElevUnits.gridx = 7; gbc_comboBoxElevUnits.gridy = 3; panelVerbatimValues.add(comboBoxElevUnits, gbc_comboBoxElevUnits); { JLabel lblVerbatimdate = new JLabel("VerbatimDate"); GridBagConstraints gbc_lblVerbatimdate = new GridBagConstraints(); gbc_lblVerbatimdate.anchor = GridBagConstraints.EAST; gbc_lblVerbatimdate.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimdate.gridx = 0; gbc_lblVerbatimdate.gridy = 4; panelVerbatimValues.add(lblVerbatimdate, gbc_lblVerbatimdate); } textFieldVerbDate = new JTextField(); GridBagConstraints gbc_textFieldVerbDate = new GridBagConstraints(); gbc_textFieldVerbDate.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbDate.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldVerbDate.gridx = 1; gbc_textFieldVerbDate.gridy = 4; panelVerbatimValues.add(textFieldVerbDate, gbc_textFieldVerbDate); textFieldVerbDate.setColumns(30); JButton btnCopyDate = new JButton(">"); btnCopyDate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (textFieldISODate.getText().isEmpty()) { Map<String, String> extractResult = DateUtils .extractDateFromVerbatim(textFieldVerbDate.getText().trim()); if (extractResult.containsKey("result")) { textFieldISODate.setText(extractResult.get("result")); } if (extractResult.containsKey("resultState")) { // TODO: Report suspect etc } } } }); GridBagConstraints gbc_btnCopyDate = new GridBagConstraints(); gbc_btnCopyDate.insets = new Insets(0, 0, 5, 5); gbc_btnCopyDate.gridx = 2; gbc_btnCopyDate.gridy = 4; panelVerbatimValues.add(btnCopyDate, gbc_btnCopyDate); JLabel lblNewLabel_3 = new JLabel("ISO Date"); GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints(); gbc_lblNewLabel_3.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_3.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_3.gridx = 3; gbc_lblNewLabel_3.gridy = 4; panelVerbatimValues.add(lblNewLabel_3, gbc_lblNewLabel_3); textFieldISODate = new JTextField(); textFieldISODate.setInputVerifier( MetadataRetriever.getInputVerifier(Specimen.class, "ISODate", textFieldISODate)); textFieldISODate.setToolTipText(MetadataRetriever.getFieldHelp(Specimen.class, "ISODate")); GridBagConstraints gbc_textFieldISODate = new GridBagConstraints(); gbc_textFieldISODate.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldISODate.gridwidth = 5; gbc_textFieldISODate.insets = new Insets(0, 0, 5, 5); gbc_textFieldISODate.gridx = 4; gbc_textFieldISODate.gridy = 4; panelVerbatimValues.add(textFieldISODate, gbc_textFieldISODate); textFieldISODate.setColumns(10); textFieldSpecificLocality = new JTextField(); GridBagConstraints gbc_textFieldSpecificLocality = new GridBagConstraints(); gbc_textFieldSpecificLocality.gridwidth = 5; gbc_textFieldSpecificLocality.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldSpecificLocality.insets = new Insets(0, 0, 5, 5); gbc_textFieldSpecificLocality.gridx = 4; gbc_textFieldSpecificLocality.gridy = 2; panelVerbatimValues.add(textFieldSpecificLocality, gbc_textFieldSpecificLocality); textFieldSpecificLocality.setColumns(25); { JLabel lblVerbatimCollector = new JLabel("Verbatim Collector"); GridBagConstraints gbc_lblVerbatimCollector = new GridBagConstraints(); gbc_lblVerbatimCollector.anchor = GridBagConstraints.EAST; gbc_lblVerbatimCollector.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimCollector.gridx = 0; gbc_lblVerbatimCollector.gridy = 6; panelVerbatimValues.add(lblVerbatimCollector, gbc_lblVerbatimCollector); } textFieldVerbCollector = new JTextArea(); textFieldVerbCollector.setEditable(false); textFieldVerbCollector.setRows(3); GridBagConstraints gbc_textFieldVerbCollector = new GridBagConstraints(); gbc_textFieldVerbCollector.gridheight = 2; gbc_textFieldVerbCollector.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbCollector.fill = GridBagConstraints.BOTH; gbc_textFieldVerbCollector.gridx = 1; gbc_textFieldVerbCollector.gridy = 6; panelVerbatimValues.add(textFieldVerbCollector, gbc_textFieldVerbCollector); textFieldVerbCollector.setColumns(30); JLabel lblCollectors = new JLabel("Collector(s)"); GridBagConstraints gbc_lblCollectors = new GridBagConstraints(); gbc_lblCollectors.anchor = GridBagConstraints.EAST; gbc_lblCollectors.insets = new Insets(0, 0, 5, 5); gbc_lblCollectors.gridx = 3; gbc_lblCollectors.gridy = 6; panelVerbatimValues.add(lblCollectors, gbc_lblCollectors); JButton btnAddCollector = new JButton("+"); btnAddCollector.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { ((CollectorTableModel) jTableCollectors.getModel()).addCollector(new Collector(null, "")); } }); GridBagConstraints gbc_btnAddCollector = new GridBagConstraints(); gbc_btnAddCollector.anchor = GridBagConstraints.EAST; gbc_btnAddCollector.insets = new Insets(0, 0, 5, 5); gbc_btnAddCollector.gridx = 3; gbc_btnAddCollector.gridy = 7; panelVerbatimValues.add(btnAddCollector, gbc_btnAddCollector); GridBagConstraints gbc_collectorTable = new GridBagConstraints(); gbc_collectorTable.insets = new Insets(0, 0, 5, 5); gbc_collectorTable.fill = GridBagConstraints.BOTH; gbc_collectorTable.gridx = 4; gbc_collectorTable.gridy = 6; gbc_collectorTable.gridheight = 2; gbc_collectorTable.gridwidth = 5; panelVerbatimValues.add(getJScrollPaneCollectors(), gbc_collectorTable); JLabel lblVerbatimCollection = new JLabel("Verbatim Collection"); GridBagConstraints gbc_lblVerbatimCollection = new GridBagConstraints(); gbc_lblVerbatimCollection.anchor = GridBagConstraints.EAST; gbc_lblVerbatimCollection.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimCollection.gridx = 0; gbc_lblVerbatimCollection.gridy = 8; panelVerbatimValues.add(lblVerbatimCollection, gbc_lblVerbatimCollection); textFieldVerbCollection = new JTextArea(); textFieldVerbCollection.setEditable(false); textFieldVerbCollection.setRows(3); GridBagConstraints gbc_textFieldVerbCollection = new GridBagConstraints(); gbc_textFieldVerbCollection.gridheight = 2; gbc_textFieldVerbCollection.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbCollection.fill = GridBagConstraints.BOTH; gbc_textFieldVerbCollection.gridx = 1; gbc_textFieldVerbCollection.gridy = 8; panelVerbatimValues.add(textFieldVerbCollection, gbc_textFieldVerbCollection); textFieldVerbCollection.setColumns(30); JLabel lblCollection = new JLabel("Collection"); GridBagConstraints gbc_lblCollection = new GridBagConstraints(); gbc_lblCollection.anchor = GridBagConstraints.EAST; gbc_lblCollection.insets = new Insets(0, 0, 5, 5); gbc_lblCollection.gridx = 3; gbc_lblCollection.gridy = 8; panelVerbatimValues.add(lblCollection, gbc_lblCollection); GridBagConstraints gbc_textFieldCollection = new GridBagConstraints(); gbc_textFieldCollection.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldCollection.gridwidth = 5; gbc_textFieldCollection.insets = new Insets(0, 0, 5, 5); gbc_textFieldCollection.gridx = 4; gbc_textFieldCollection.gridy = 8; panelVerbatimValues.add(getJComboBoxCollection(), gbc_textFieldCollection); JLabel lblVerbatimNumbers = new JLabel("Verbatim Numbers"); GridBagConstraints gbc_lblVerbatimNumbers = new GridBagConstraints(); gbc_lblVerbatimNumbers.anchor = GridBagConstraints.EAST; gbc_lblVerbatimNumbers.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimNumbers.gridx = 0; gbc_lblVerbatimNumbers.gridy = 10; panelVerbatimValues.add(lblVerbatimNumbers, gbc_lblVerbatimNumbers); textFieldVerbNumbers = new JTextArea(); textFieldVerbNumbers.setRows(3); textFieldVerbNumbers.setEditable(false); GridBagConstraints gbc_textFieldVerbNumbers = new GridBagConstraints(); gbc_textFieldVerbNumbers.gridheight = 2; gbc_textFieldVerbNumbers.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbNumbers.fill = GridBagConstraints.BOTH; gbc_textFieldVerbNumbers.gridx = 1; gbc_textFieldVerbNumbers.gridy = 10; panelVerbatimValues.add(textFieldVerbNumbers, gbc_textFieldVerbNumbers); textFieldVerbNumbers.setColumns(30); JLabel lblNumbers = new JLabel("Numbers"); GridBagConstraints gbc_lblNumbers = new GridBagConstraints(); gbc_lblNumbers.anchor = GridBagConstraints.EAST; gbc_lblNumbers.insets = new Insets(0, 0, 5, 5); gbc_lblNumbers.gridx = 3; gbc_lblNumbers.gridy = 10; panelVerbatimValues.add(lblNumbers, gbc_lblNumbers); JButton btnAddNumber = new JButton("+"); btnAddNumber.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { ((NumberTableModel) jTableNumbers.getModel()) .addNumber(new edu.harvard.mcz.imagecapture.data.Number(null, "", "")); } }); GridBagConstraints gbc_btnAddNumber = new GridBagConstraints(); gbc_btnAddNumber.anchor = GridBagConstraints.EAST; gbc_btnAddNumber.insets = new Insets(0, 0, 5, 5); gbc_btnAddNumber.gridx = 3; gbc_btnAddNumber.gridy = 11; panelVerbatimValues.add(btnAddNumber, gbc_btnAddNumber); GridBagConstraints gbc_numberTable = new GridBagConstraints(); gbc_numberTable.insets = new Insets(0, 0, 5, 5); gbc_numberTable.fill = GridBagConstraints.BOTH; gbc_numberTable.gridx = 4; gbc_numberTable.gridy = 10; gbc_numberTable.gridheight = 2; gbc_numberTable.gridwidth = 5; panelVerbatimValues.add(this.getJScrollPaneNumbers(), gbc_numberTable); JLabel lblVerbatimOtherText = new JLabel("Verbatim Other Text"); GridBagConstraints gbc_lblVerbatimOtherText = new GridBagConstraints(); gbc_lblVerbatimOtherText.anchor = GridBagConstraints.EAST; gbc_lblVerbatimOtherText.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimOtherText.gridx = 0; gbc_lblVerbatimOtherText.gridy = 12; panelVerbatimValues.add(lblVerbatimOtherText, gbc_lblVerbatimOtherText); textFieldVerbUnclassifiedText = new JTextArea(); textFieldVerbUnclassifiedText.setEditable(false); textFieldVerbUnclassifiedText.setRows(5); GridBagConstraints gbc_textFieldVerbUnclassifiedText = new GridBagConstraints(); gbc_textFieldVerbUnclassifiedText.gridheight = 3; gbc_textFieldVerbUnclassifiedText.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbUnclassifiedText.fill = GridBagConstraints.BOTH; gbc_textFieldVerbUnclassifiedText.gridx = 1; gbc_textFieldVerbUnclassifiedText.gridy = 12; panelVerbatimValues.add(textFieldVerbUnclassifiedText, gbc_textFieldVerbUnclassifiedText); textFieldVerbUnclassifiedText.setColumns(30); JLabel lblHabitat = new JLabel("Habitat"); GridBagConstraints gbc_lblHabitat = new GridBagConstraints(); gbc_lblHabitat.anchor = GridBagConstraints.EAST; gbc_lblHabitat.insets = new Insets(0, 0, 5, 5); gbc_lblHabitat.gridx = 3; gbc_lblHabitat.gridy = 12; panelVerbatimValues.add(lblHabitat, gbc_lblHabitat); textFieldHabitat = new JTextField(); GridBagConstraints gbc_textFieldHabitat = new GridBagConstraints(); gbc_textFieldHabitat.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldHabitat.gridwidth = 4; gbc_textFieldHabitat.insets = new Insets(0, 0, 5, 5); gbc_textFieldHabitat.gridx = 4; gbc_textFieldHabitat.gridy = 12; panelVerbatimValues.add(textFieldHabitat, gbc_textFieldHabitat); textFieldHabitat.setColumns(10); JLabel lblMicrohabitat = new JLabel("Microhabitat"); GridBagConstraints gbc_lblMicrohabitat = new GridBagConstraints(); gbc_lblMicrohabitat.anchor = GridBagConstraints.EAST; gbc_lblMicrohabitat.insets = new Insets(0, 0, 5, 5); gbc_lblMicrohabitat.gridx = 3; gbc_lblMicrohabitat.gridy = 13; panelVerbatimValues.add(lblMicrohabitat, gbc_lblMicrohabitat); textFieldMicrohabitat = new JTextField(); GridBagConstraints gbc_textFieldMicrohabitat = new GridBagConstraints(); gbc_textFieldMicrohabitat.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldMicrohabitat.gridwidth = 4; gbc_textFieldMicrohabitat.insets = new Insets(0, 0, 5, 5); gbc_textFieldMicrohabitat.gridx = 4; gbc_textFieldMicrohabitat.gridy = 13; panelVerbatimValues.add(textFieldMicrohabitat, gbc_textFieldMicrohabitat); textFieldMicrohabitat.setColumns(10); JLabel lblNewLabel_4 = new JLabel("Workflow Status"); GridBagConstraints gbc_lblNewLabel_4 = new GridBagConstraints(); gbc_lblNewLabel_4.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_4.gridx = 3; gbc_lblNewLabel_4.gridy = 15; panelVerbatimValues.add(lblNewLabel_4, gbc_lblNewLabel_4); comboBoxWorkflowStatus = new JComboBox(WorkFlowStatus.getVerbatimClassifiedWorkFlowStatusValues()); comboBoxWorkflowStatus.setSelectedItem(WorkFlowStatus.STAGE_CLASSIFIED); GridBagConstraints gbc_comboBoxWorkflowStatus = new GridBagConstraints(); gbc_comboBoxWorkflowStatus.gridwidth = 4; gbc_comboBoxWorkflowStatus.fill = GridBagConstraints.HORIZONTAL; gbc_comboBoxWorkflowStatus.insets = new Insets(0, 0, 5, 5); gbc_comboBoxWorkflowStatus.gridx = 4; gbc_comboBoxWorkflowStatus.gridy = 15; panelVerbatimValues.add(comboBoxWorkflowStatus, gbc_comboBoxWorkflowStatus); JButton btnApplyToAll = new JButton("Apply To All Records"); GridBagConstraints gbc_btnApplyToAll = new GridBagConstraints(); gbc_btnApplyToAll.gridwidth = 4; gbc_btnApplyToAll.insets = new Insets(0, 0, 5, 5); gbc_btnApplyToAll.gridx = 4; gbc_btnApplyToAll.gridy = 16; panelVerbatimValues.add(btnApplyToAll, gbc_btnApplyToAll); btnApplyToAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveChanges(); } }); } { JPanel panelRelatedData = new JPanel(); contentPanel.add(panelRelatedData); GridBagLayout gbl_panelRelatedData = new GridBagLayout(); gbl_panelRelatedData.maximumLayoutSize(panelRelatedData); gbl_panelRelatedData.columnWidths = new int[] { 20, 33, 1, 0 }; gbl_panelRelatedData.rowHeights = new int[] { 25, 0 }; gbl_panelRelatedData.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE }; gbl_panelRelatedData.rowWeights = new double[] { 1.0, Double.MIN_VALUE }; panelRelatedData.setLayout(gbl_panelRelatedData); { JLabel lblTaxa = new JLabel("Taxa"); GridBagConstraints gbc_lblTaxa = new GridBagConstraints(); gbc_lblTaxa.anchor = GridBagConstraints.NORTHEAST; gbc_lblTaxa.insets = new Insets(0, 0, 0, 5); gbc_lblTaxa.gridx = 0; gbc_lblTaxa.gridy = 0; panelRelatedData.add(lblTaxa, gbc_lblTaxa); } JScrollPane scrollPane = new JScrollPane(); // scrollPane.setPreferredSize(new Dimension(1000,100)); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.anchor = GridBagConstraints.NORTH; gbc_scrollPane.insets = new Insets(0, 0, 0, 5); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 1; gbc_scrollPane.gridy = 0; panelRelatedData.add(scrollPane, gbc_scrollPane); tableTaxa = new JTable(); SpecimenLifeCycle sls = new SpecimenLifeCycle(); tableTaxa.setModel(new CountValueTableModel(sls.findTaxaFromVerbatim(this.verbatimData), "Current Idenfifications for these verbatim values.")); scrollPane.setViewportView(tableTaxa); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton cancelButton = new JButton("Close"); cancelButton.setActionCommand("Close"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); buttonPane.add(cancelButton); } } }
From source file:cool.pandora.modeller.ui.jpanel.iiif.UploadBagFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();// w w w . ja v a 2s . c om final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("UploadBagFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Upload Resources " + "to:"))); titlePaneContainer.add(titlePane.getControl()); titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH); pageControl.add(titlePaneContainer, BorderLayout.NORTH); final JPanel contentPane = new JPanel(); final DefaultBag bag = bagView.getBag(); if (bag != null) { map = bag.getInfo().getFieldMap(); } final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label")); urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description")); final JTextField urlField = new JTextField(""); final URI uri = IIIFObjectURI.getResourceContainerURI(map); try { urlField.setText(uri != null ? uri.toString() : null); } catch (Exception e) { log.error("Failed to set url label", e); } urlField.setEnabled(false); //only if bag is not null if (bag != null) { urlLabel.setEnabled(true); } final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints glbc = new GridBagConstraints(); final JPanel panel = new JPanel(layout); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); int row = 0; row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(urlLabel, glbc); panel.add(urlLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(urlField, glbc); panel.add(urlField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); GuiStandardUtils.attachDialogBorder(contentPane); pageControl.add(panel); final JComponent buttonBar = createButtonBar(); pageControl.add(buttonBar, BorderLayout.SOUTH); this.pack(); return pageControl; }
From source file:org.keyboardplaying.xtt.ui.UIController.java
/** Builds and shows the settings window. */ public void showSettingsWindow() { /* Create UI. */ JPanel pane = new JPanel(new GridBagLayout()); /* Arrange the components */ GridBagConstraints c;/*from www . j av a2 s . c o m*/ // project directory (text) c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.fill = GridBagConstraints.BOTH; pane.add(new ProjectTextFieldChooser(location), c); // project directory (button) c = new GridBagConstraints(); c.gridx = 2; c.gridy = 0; c.fill = GridBagConstraints.BOTH; pane.add(new ProjectButtonChooser(images, i18n, location), c); // Locale (icon) c = new GridBagConstraints(); c.gridx = 0; c.gridy = 1; c.fill = GridBagConstraints.BOTH; pane.add(new JLabel(new ImageIcon(images.getImage("image-prefs-locale", ImageSize.W_16))), c); // Locale (combo) c = new GridBagConstraints(); c.gridx = 1; c.gridy = 1; c.gridwidth = 2; c.fill = GridBagConstraints.BOTH; pane.add(new LocaleComboBox(i18n), c); // Clear preferences c = new GridBagConstraints(); c.gridx = 0; c.gridy = 2; c.gridwidth = 3; c.fill = GridBagConstraints.BOTH; pane.add(makeActionButton("action.prefs.clear", "action-clear-prefs", ImageSize.W_16, clearPrefsAction), c); makeWindow("app.settings", "icon-settings", pane).setVisible(true); }
From source file:me.childintime.childintime.ui.window.tool.BmiToolDialog.java
private JPanel buildUiBodyStatePanel() { // Create a grid bag constraints configuration GridBagConstraints c = new GridBagConstraints(); // Body state panel final JPanel bodyStatePanel = new JPanel(new GridBagLayout()); bodyStatePanel.setBorder(new CompoundBorder(BorderFactory.createTitledBorder("BMI tool"), BorderFactory.createEmptyBorder(8, 8, 8, 8))); // Add the student panel to the body state panel c.fill = GridBagConstraints.BOTH; c.gridx = 0;//from w w w. j ava 2 s . c om c.gridy = 0; c.weightx = 1; c.weighty = 1; c.gridheight = 2; c.insets = new Insets(0, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; bodyStatePanel.add(buildUiStudentPanel(), c); // Add the input panel to the body state panel c.fill = GridBagConstraints.BOTH; c.gridx = 1; c.gridy = 0; c.weightx = 1; c.weighty = 1; c.gridheight = 1; c.insets = new Insets(0, 16, 0, 0); c.anchor = GridBagConstraints.NORTH; bodyStatePanel.add(buildUiChartPanel(), c); // Add the input panel to the body state panel c.fill = GridBagConstraints.BOTH; c.gridx = 1; c.gridy = 1; c.weightx = 0; c.weighty = 0; c.gridheight = 1; c.insets = new Insets(32, 16, 0, 0); c.anchor = GridBagConstraints.CENTER; bodyStatePanel.add(buildUiStudentBodyStatesPanel(), c); // Return the body state panel return bodyStatePanel; }