List of usage examples for java.awt GridBagLayout GridBagLayout
public GridBagLayout()
From source file:com.vgi.mafscaling.LogPlay.java
private void createSelectionPanel(JPanel panel) { JPanel selectionPanel = new JPanel(); GridBagLayout gbl_selectionPanel = new GridBagLayout(); gbl_selectionPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0 }; gbl_selectionPanel.rowHeights = new int[] { 0 }; gbl_selectionPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; gbl_selectionPanel.rowWeights = new double[] { 0.0 }; selectionPanel.setLayout(gbl_selectionPanel); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = insets3;// w w w. j ava 2s .c om gbc.anchor = GridBagConstraints.WEST; gbc.gridx = 0; gbc.gridy = 0; selectionPanel.add(new JLabel("X-Axis"), gbc); gbc.gridx++; xAxisColumn = new JComboBox<String>(); selectionPanel.add(xAxisColumn, gbc); gbc.gridx++; selectionPanel.add(new JLabel("Y-Axis"), gbc); gbc.gridx++; yAxisColumn = new JComboBox<String>(); selectionPanel.add(yAxisColumn, gbc); gbc.gridx++; selectionPanel.add(new JLabel("Data*"), gbc); gbc.gridx++; zAxisColumn = new JComboBox<String>(); selectionPanel.add(zAxisColumn, gbc); gbc.gridx++; gbc.weightx = 1.0; newPlayButton = new JButton("New Play Table"); newPlayButton.addActionListener(this); selectionPanel.add(newPlayButton, gbc); xAxisColumn.addItem(""); yAxisColumn.addItem(""); zAxisColumn.addItem("Optional"); for (int i = 0; i < logDataTable.getColumnCount(); ++i) { String colName = logDataTable.getColumn(i).getHeaderValue().toString(); xAxisColumn.addItem(colName); yAxisColumn.addItem(colName); zAxisColumn.addItem(colName); } zAxisColumn.setSelectedIndex(0); gbc.insets = insets0; gbc.gridx = 0; gbc.anchor = GridBagConstraints.PAGE_START; gbc.fill = GridBagConstraints.HORIZONTAL; panel.add(selectionPanel, gbc); }
From source file:cool.pandora.modeller.ui.jpanel.iiif.PatchSequenceFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();//w w w .jav a2 s . co m final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("PatchSequenceFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Sequences"))); 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.getSequenceContainerURI(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); 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.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 va2 s .c o 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 .java 2 s . c o 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.marginallyclever.makelangelo.MainGUI.java
public void chooseLanguage() { final JDialog driver = new JDialog(mainframe, "Language", true); driver.setLayout(new GridBagLayout()); final String[] choices = translator.getLanguageList(); final JComboBox<String> language_options = new JComboBox<String>(choices); final JButton save = new JButton(">>>"); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.gridwidth = 2;/* w w w . j ava2 s . c o m*/ c.gridx = 0; c.gridy = 0; driver.add(language_options, c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 2; c.gridy = 0; driver.add(save, c); ActionListener driveButtons = new ActionListener() { public void actionPerformed(ActionEvent e) { Object subject = e.getSource(); // TODO prevent "close" icon. Must press save to continue! if (subject == save) { translator.currentLanguage = choices[language_options.getSelectedIndex()]; translator.saveConfig(); driver.dispose(); } } }; save.addActionListener(driveButtons); driver.pack(); driver.setVisible(true); }
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();/* www .j a v a 2 s .co m*/ 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: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;// w w w. j av 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: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. *///from w w w . jav a 2s. com 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:com.intel.stl.ui.main.view.StaDetailsPanel.java
/** * Description:/* www . jav a2s . 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.//from w w w . j ava 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; }