List of usage examples for java.awt GridBagConstraints GridBagConstraints
public GridBagConstraints()
From source file:cool.pandora.modeller.ui.jpanel.iiif.PatchManifestFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/*from w w w.j a v a2 s . co m*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("PatchManifestFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Manifest"))); 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.getManifestResource(map); try { urlField.setText(uri != null ? uri.toString() : null); } catch (final Exception e) { log.error("Failed to set url label", e); } 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); 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:cool.pandora.modeller.ui.jpanel.iiif.CreateXmlFilesFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/*from ww w . ja v a 2 s .co m*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("CreateXmlFilesFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Xml Files " + "in:"))); 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 (final Exception e) { log.error("Failed to set url label", e); } 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:com.vgi.mafscaling.Rescale.java
private void createControlPanel(JPanel dataPanel) { JPanel cntlPanel = new JPanel(); GridBagConstraints gbl_ctrlPanel = new GridBagConstraints(); gbl_ctrlPanel.insets = insets3;/*from w w w . j av a2s. c om*/ gbl_ctrlPanel.anchor = GridBagConstraints.PAGE_START; gbl_ctrlPanel.fill = GridBagConstraints.HORIZONTAL; gbl_ctrlPanel.weightx = 1.0; gbl_ctrlPanel.gridx = 0; gbl_ctrlPanel.gridy = 0; dataPanel.add(cntlPanel, gbl_ctrlPanel); GridBagLayout gbl_cntlPanel = new GridBagLayout(); gbl_cntlPanel.columnWidths = new int[] { 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, 1.0 }; gbl_cntlPanel.rowWeights = new double[] { 0 }; cntlPanel.setLayout(gbl_cntlPanel); NumberFormat doubleFmt = NumberFormat.getNumberInstance(); doubleFmt.setGroupingUsed(false); doubleFmt.setMaximumIntegerDigits(1); doubleFmt.setMinimumIntegerDigits(1); doubleFmt.setMaximumFractionDigits(3); doubleFmt.setMinimumFractionDigits(1); doubleFmt.setRoundingMode(RoundingMode.HALF_UP); NumberFormat scaleDoubleFmt = NumberFormat.getNumberInstance(); scaleDoubleFmt.setGroupingUsed(false); scaleDoubleFmt.setMaximumIntegerDigits(1); scaleDoubleFmt.setMinimumIntegerDigits(1); scaleDoubleFmt.setMaximumFractionDigits(8); scaleDoubleFmt.setMinimumFractionDigits(1); scaleDoubleFmt.setRoundingMode(RoundingMode.HALF_UP); GridBagConstraints gbc_cntlPanelLabel = new GridBagConstraints(); gbc_cntlPanelLabel.anchor = GridBagConstraints.EAST; gbc_cntlPanelLabel.insets = new Insets(2, 3, 2, 1); gbc_cntlPanelLabel.gridx = 0; gbc_cntlPanelLabel.gridy = 0; GridBagConstraints gbc_cntlPanelInput = new GridBagConstraints(); gbc_cntlPanelInput.anchor = GridBagConstraints.WEST; gbc_cntlPanelInput.insets = new Insets(2, 1, 2, 3); gbc_cntlPanelInput.gridx = 1; gbc_cntlPanelInput.gridy = 0; cntlPanel.add(new JLabel("New Max V"), gbc_cntlPanelLabel); newMaxVFmtTextBox = new JFormattedTextField(doubleFmt); newMaxVFmtTextBox.setColumns(7); newMaxVFmtTextBox.addPropertyChangeListener("value", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { Object source = e.getSource(); if (source == newMaxVFmtTextBox) updateNewMafScale(); } }); cntlPanel.add(newMaxVFmtTextBox, gbc_cntlPanelInput); gbc_cntlPanelLabel.gridx += 2; cntlPanel.add(new JLabel("Min V"), gbc_cntlPanelLabel); minVFmtTextBox = new JFormattedTextField(doubleFmt); minVFmtTextBox.setColumns(7); minVFmtTextBox.addPropertyChangeListener("value", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { Object source = e.getSource(); if (source == minVFmtTextBox) updateNewMafScale(); } }); gbc_cntlPanelInput.gridx += 2; cntlPanel.add(minVFmtTextBox, gbc_cntlPanelInput); gbc_cntlPanelLabel.gridx += 2; cntlPanel.add(new JLabel("Max Unchanged"), gbc_cntlPanelLabel); maxVUnchangedFmtTextBox = new JFormattedTextField(doubleFmt); maxVUnchangedFmtTextBox.setColumns(7); maxVUnchangedFmtTextBox.addPropertyChangeListener("value", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { Object source = e.getSource(); if (source == maxVUnchangedFmtTextBox) updateNewMafScale(); } }); gbc_cntlPanelInput.gridx += 2; cntlPanel.add(maxVUnchangedFmtTextBox, gbc_cntlPanelInput); gbc_cntlPanelLabel.gridx += 2; cntlPanel.add(new JLabel("Mode deltaV"), gbc_cntlPanelLabel); modeDeltaVFmtTextBox = new JFormattedTextField(scaleDoubleFmt); modeDeltaVFmtTextBox.setColumns(7); modeDeltaVFmtTextBox.setEditable(false); modeDeltaVFmtTextBox.setBackground(new Color(210, 210, 210)); gbc_cntlPanelInput.gridx += 2; cntlPanel.add(modeDeltaVFmtTextBox, gbc_cntlPanelInput); }
From source file:coolmap.canvas.datarenderer.renderer.impl.NumberToColor.java
public NumberToColor() { setName("Number to Color"); setDescription("Use color to represent numeric values"); //initialize UI configUI.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0;/*from w ww . j a v a 2s .c o m*/ c.gridy = 0; c.ipadx = 5; c.ipady = 5; c.insets = new Insets(5, 5, 5, 5); c.gridwidth = 2; // c.weightx = 0.8; editor = new GradientEditorPanel(); configUI.add(editor, c); c.gridx = 0; c.gridy++; c.gridwidth = 1; // JButton button = new JButton("Apply"); // configUI.add(button, c); // button.setToolTipText("Apply preset gradient"); // // button.addActionListener(new ActionListener() { // // @Override // public void actionPerformed(ActionEvent e) { // // try { // GradientItem item = (GradientItem) presetColorComboBox.getSelectedItem(); // // editor.clearColors(); // // Color c[] = item.getColors(); // float p[] = item.getPositions(); // // editor.setStart(c[0]); // editor.setEnd(c[c.length - 1]); // // if (c.length > 2) { // for (int i = 1; i < c.length - 1; i++) { // editor.addColor(c[i], p[i]); // } // } // // } catch (Exception ex) { // editor.clearColors(); // editor.setStart(DEFAULT_MIN_COLOR); // editor.setEnd(DEFAULT_MAX_COLOR); // } // // updateRenderer(); // } // }); configUI.add(new JLabel("Preset palette:"), c); c.gridx = 1; c.gridwidth = 1; presetColorComboBox = new JComboBox(); presetColorComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { try { GradientItem item = (GradientItem) presetColorComboBox.getSelectedItem(); presetColorComboBox.setToolTipText(item.getToolTip()); editor.clearColors(); Color c[] = item.getColors(); float p[] = item.getPositions(); editor.setStart(c[0]); editor.setEnd(c[c.length - 1]); if (c.length > 2) { for (int i = 1; i < c.length - 1; i++) { editor.addColor(c[i], p[i]); } } try { Double[] ranges = item.getRanges(); if (ranges != null) { minValueField.setText(ranges[0].toString()); maxValueField.setText(ranges[1].toString()); editor.setMinValue(ranges[0].floatValue()); editor.setMaxValue(ranges[1].floatValue()); } } catch (Exception ex) { minValueField.setText("-1"); maxValueField.setText("1"); editor.setMinValue(-1); editor.setMaxValue(1); } } catch (Exception ex) { editor.clearColors(); editor.setStart(DEFAULT_MIN_COLOR); editor.setEnd(DEFAULT_MAX_COLOR); } } }); // configUI.add(presetColorComboBox, c); presetColorComboBox.setRenderer(new GradientComboItemRenderer()); presetColorComboBox .addItem(new GradientItem(new Color[] { DEFAULT_MIN_COLOR, Color.BLACK, DEFAULT_MAX_COLOR }, new float[] { 0f, 0.5f, 1f }, "TBP", "Teal - Black - Pink")); presetColorComboBox.addItem(new GradientItem(new Color[] { Color.GREEN, Color.RED }, new float[] { 0f, 1f }, "GR", "Green - Red")); presetColorComboBox.addItem(new GradientItem(new Color[] { Color.GREEN, Color.BLACK, Color.RED }, new float[] { 0f, 0.5f, 1f }, "RBG", "Red - Black - Green")); presetColorComboBox.addItem(new GradientItem(new Color[] { Color.ORANGE, Color.BLUE }, new float[] { 0f, 1f }, "OB", "Orange - Blue")); presetColorComboBox.addItem(new GradientItem(new Color[] { Color.ORANGE, Color.BLACK, Color.BLUE }, new float[] { 0f, 0.5f, 1f }, "OBB", "Orange - Black - Blue")); presetColorComboBox.addItem(new GradientItem(new Color[] { Color.BLACK, Color.GREEN }, new float[] { 0f, 1f }, "BG", "Black - Green")); presetColorComboBox .addItem(new GradientItem(new Color[] { Color.RED, UI.colorAKABENI, Color.BLACK, Color.BLACK }, new float[] { 0f, 0.05f, 0.051f, 1f }, "P.05", 0d, 1d, "P-value @ 0.05, Red to Black")); presetColorComboBox.setToolTipText(((GradientItem) presetColorComboBox.getSelectedItem()).getToolTip()); c.gridx = 0; c.gridy++; c.gridwidth = 1; // button = new JButton("Apply"); // // button.setToolTipText("Apply preset data ranges"); // button.addActionListener(new ActionListener() { // // @Override // public void actionPerformed(ActionEvent e) { // try { // MinMaxItem item = (MinMaxItem) (presetRangeComboBox.getSelectedItem()); // minValueField.setText(item.getMinMax().lowerEndpoint().toString()); // maxValueField.setText(item.getMinMax().upperEndpoint().toString()); // } catch (Exception ex) { // minValueField.setText("-1"); // maxValueField.setText("1"); // } // // updateRenderer(); // } // }); // configUI.add(button, c); configUI.add(new JLabel("Preset range:"), c); c.gridx = 1; c.gridwidth = 1; presetRangeComboBox = new JComboBox(); configUI.add(presetRangeComboBox, c); presetRangeComboBox.addItem(new DataMinMaxItem()); presetRangeComboBox.addItem(new DefinedMinMaxItem(-1, 1)); presetRangeComboBox.addItem(new DefinedMinMaxItem(0, 1)); presetRangeComboBox.addItem(new DefinedMinMaxItem(-1, 0)); presetRangeComboBox.addItem(new DefinedMinMaxItem(0, 100)); presetRangeComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { try { MinMaxItem item = (MinMaxItem) (presetRangeComboBox.getSelectedItem()); minValueField.setText(item.getMinMax().lowerEndpoint().toString()); maxValueField.setText(item.getMinMax().upperEndpoint().toString()); } catch (Exception ex) { minValueField.setText("-1"); maxValueField.setText("1"); } } }); //////////////////////////////////////////////////////////////////////////////// // c.weightx = 0.2; c.gridx = 0; c.gridy++; c.gridwidth = 1; configUI.add(new JLabel("Min value: "), c); c.gridx = 1; // c.weightx = 0.3; configUI.add(minValueField, c); c.gridx = 0; c.gridy++; c.gridwidth = 1; configUI.add(new JLabel("Max value: "), c); c.gridx = 1; configUI.add(maxValueField, c); c.gridx = 0; c.gridy++; c.gridwidth = 1; JLabel label = Tools.createJLabel("Draw Sub-heatmap:", null, "Draw sub-heatmaps for collapsed ontology nodes", null); configUI.add(label, c); c.gridx = 1; drawSubMap = new JCheckBox(); configUI.add(drawSubMap, c); c.gridx = 0; c.gridy++; c.gridwidth = 3; JButton button = new JButton("Update", UI.getImageIcon("refresh")); configUI.add(button, c); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //hit button, redraw! updateRenderer(); } }); // editor.applyButton.addActionListener(new ActionListener() { // // @Override // public void actionPerformed(ActionEvent e) { // updateRenderer(); // } // }); toolTipLabel = new JLabel(); toolTipLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); toolTipLabel.setBackground(UI.colorGrey3); toolTipLabel.setOpaque(true); toolTipLabel.setForeground(UI.colorBlack2); toolTipLabel.setFont(UI.fontPlain.deriveFont(12f)); }
From source file:cool.pandora.modeller.ui.jpanel.iiif.PatchResourceFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/* w ww. j a va 2 s . c om*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("PatchResourceFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Resources"))); 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 (final Exception e) { log.error("Failed to set url label", e); } 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); 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:io.github.tavernaextras.biocatalogue.ui.search_results.ServiceListCellRenderer.java
/** * @return Final state of the {@link GridBagConstraints} instance * that was used to lay out components in the panel. */// w w w . j a va2 s . co m private GridBagConstraints arrangeLayout(boolean showActionButtons) { // POPULATE PANEL WITH PREPARED COMPONENTS this.setLayout(new GridBagLayout()); c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 0; c.insets = new Insets(10, 6, 6, 3); this.add(jlTypeIcon, c); c.gridx++; c.insets = new Insets(10, 3, 6, 3); this.add(jlItemStatus, c); c.gridx++; c.weightx = 1.0; c.insets = new Insets(10, 3, 6, 3); this.add(jlItemTitle, c); if (showActionButtons) { c.gridx++; c.gridheight = 3; c.weightx = 0; c.weighty = 1.0; jlExpand = new JLabel(ResourceManager.getImageIcon(ResourceManager.FOLD_ICON)); this.add(jlExpand, c); } c.gridx = 2; c.gridy++; c.gridheight = 1; c.weightx = 1.0; c.weighty = 0; c.insets = new Insets(3, 3, 3, 3); this.add(jlDescription, c); return (c); }
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 ww w .j a v a2 s . c o m*/ 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; }
From source file:com.intel.stl.ui.main.view.StaDetailsPanel.java
/** * Description:/*from ww w . j a v a 2s . c om*/ * * @param sourceName */ protected void initComponent() { setLayout(new BorderLayout(0, 10)); setOpaque(false); setBorder(BorderFactory.createTitledBorder((Border) null)); JPanel titlePanel = new JPanel(new BorderLayout(5, 1)); titlePanel.setOpaque(false); numberLabel = ComponentFactory.getH1Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN); numberLabel.setHorizontalAlignment(JLabel.RIGHT); titlePanel.add(numberLabel, BorderLayout.CENTER); nameLabel = ComponentFactory.getH3Label("", Font.PLAIN); nameLabel.setHorizontalAlignment(JLabel.LEFT); nameLabel.setVerticalAlignment(JLabel.BOTTOM); titlePanel.add(nameLabel, BorderLayout.EAST); add(titlePanel, BorderLayout.NORTH); JPanel mainPanel = new JPanel(); mainPanel.setOpaque(false); mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); GridBagLayout gridBag = new GridBagLayout(); mainPanel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.insets = new Insets(2, 2, 2, 2); gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = 1; gc.gridwidth = 1; gc.weighty = 0; failedChartPanel = new ChartPanel(null); failedChartPanel.setPreferredSize(new Dimension(60, 20)); mainPanel.add(failedChartPanel, gc); gc.fill = GridBagConstraints.BOTH; gc.weightx = 0; failedNumberLabel = ComponentFactory.getH2Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.BOLD); failedNumberLabel.setForeground(UIConstants.INTEL_DARK_RED); failedNumberLabel.setHorizontalAlignment(JLabel.CENTER); mainPanel.add(failedNumberLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; failedNameLabel = ComponentFactory.getH5Label(STLConstants.K0020_FAILED.getValue(), Font.PLAIN); failedNameLabel.setVerticalAlignment(JLabel.BOTTOM); mainPanel.add(failedNameLabel, gc); gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = 1; gc.gridwidth = 1; skippedChartPanel = new ChartPanel(null); skippedChartPanel.setPreferredSize(new Dimension(60, 20)); mainPanel.add(skippedChartPanel, gc); gc.fill = GridBagConstraints.BOTH; gc.weightx = 0; skippedNumberLabel = ComponentFactory.getH2Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.BOLD); skippedNumberLabel.setForeground(UIConstants.INTEL_DARK_ORANGE); skippedNumberLabel.setHorizontalAlignment(JLabel.CENTER); mainPanel.add(skippedNumberLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; skippedNameLabel = ComponentFactory.getH5Label(STLConstants.K0021_SKIPPED.getValue(), Font.PLAIN); skippedNameLabel.setVerticalAlignment(JLabel.BOTTOM); mainPanel.add(skippedNameLabel, gc); gc.weighty = 0; gc.fill = GridBagConstraints.NONE; gc.insets = new Insets(8, 2, 2, 2); gc.weightx = 1; gc.gridwidth = 1; gc.gridheight = types.length; typeChartPanel = new ChartPanel(null); typeChartPanel.setPreferredSize(new Dimension(80, 60)); mainPanel.add(typeChartPanel, gc); typeNumberLabels = new JLabel[types.length]; typeNameLabels = new JLabel[types.length]; gc.fill = GridBagConstraints.BOTH; gc.gridheight = 1; gc.insets = new Insets(12, 2, 2, 2); for (int i = 0; i < types.length; i++) { if (i == 1) { gc.insets = new Insets(2, 2, 2, 2); } gc.weightx = 0; gc.gridwidth = 1; typeNumberLabels[i] = createNumberLabel(); mainPanel.add(typeNumberLabels[i], gc); gc.gridwidth = GridBagConstraints.REMAINDER; typeNameLabels[i] = createNameLabel(types[i].getName()); mainPanel.add(typeNameLabels[i], gc); } gc.fill = GridBagConstraints.BOTH; mainPanel.add(Box.createGlue(), gc); add(mainPanel, BorderLayout.CENTER); }
From source file:cool.pandora.modeller.ui.jpanel.iiif.CreateCanvasesFrame.java
/** * createComponents./* w w w.ja v a 2 s . co m*/ * * @return pageControl */ private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands(); final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("CreateCanvasesFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Canvases in:"))); 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.getCanvasContainerURI(map); try { urlField.setText(uri != null ? uri.toString() : null); } catch (Exception e) { log.error("Failed to set url label", e); } 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: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 ww w . j a v a 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; }