List of usage examples for java.awt GridBagLayout GridBagLayout
public GridBagLayout()
From source file:cool.pandora.modeller.ui.jpanel.text.PatchAreasFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/*from w w w . ja va 2 s.c o m*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("PatchAreasFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Areas 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 = TextObjectURI.getAreaContainerURI(map); try { assert uri != null; urlField.setText(uri.toString()); } catch (Exception e) { log.error("Failed to set url label", e); } final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label")); hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description")); hocrResourceField = new JTextField(""); final String hocrResource = TextObjectURI.gethOCRResourceURI(map); try { hocrResourceField.setText(hocrResource); } catch (Exception e) { log.error("Failed to set hocrResource 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(hocrResourceLabel, glbc); panel.add(hocrResourceLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(hocrResourceField, glbc); panel.add(hocrResourceField); 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.text.PatchLinesFrame.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 a 2 s. c o m*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("PatchLinesFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Lines 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 = TextObjectURI.getLineContainerURI(map); try { assert uri != null; urlField.setText(uri.toString()); } catch (Exception e) { log.error("Failed to set url label", e); } final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label")); hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description")); hocrResourceField = new JTextField(""); final String hocrResource = TextObjectURI.gethOCRResourceURI(map); try { hocrResourceField.setText(hocrResource); } catch (Exception e) { log.error("Failed to set hocrResource 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(hocrResourceLabel, glbc); panel.add(hocrResourceLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(hocrResourceField, glbc); panel.add(hocrResourceField); 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.CreateDefaultContainersFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();//from w w w .ja va 2s . c o m final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("CreateContainersFrame.title")); titlePane.setMessage( new DefaultMessage(bagView.getPropertyMessage("Create the default " + "IIIF Containers"))); 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.getObjektURI(map); try { urlField.setText(uri != null ? uri.toString() : null); } catch (Exception e) { log.error("Failed to set url label", e); } final JLabel tagLabel = new JLabel(getMessage("bag.label.hasText")); tagLabel.setToolTipText(getMessage("bag.label.hasText.help")); hasTextCheckbox = new JCheckBox(); hasTextCheckbox.setBorder(border); hasTextCheckbox.setToolTipText(getMessage("bag.checkbox.hasText.help")); hasTextCheckbox.setSelected(bag != null && bag.hasText()); 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(tagLabel, glbc); panel.add(tagLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(hasTextCheckbox, glbc); panel.add(hasTextCheckbox); 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.text.CreateLinesFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();//from w ww . jav a 2 s . co m final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("CreateLinesFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Lines 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 = TextObjectURI.getLineContainerURI(map); try { assert uri != null; urlField.setText(uri.toString()); } catch (Exception e) { log.error("Failed to set url label", e); } final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label")); hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description")); hocrResourceField = new JTextField(""); final String hocrResource = TextObjectURI.gethOCRResourceURI(map); try { hocrResourceField.setText(hocrResource); } catch (Exception e) { log.error("Failed to set hocrResource 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(hocrResourceLabel, glbc); panel.add(hocrResourceLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(hocrResourceField, glbc); panel.add(hocrResourceField); 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.text.CreatePagesFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/*w ww . j ava 2s .co m*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("CreatePagesFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Pages 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 = TextObjectURI.getPageContainerURI(map); try { assert uri != null; urlField.setText(uri.toString()); } catch (Exception e) { log.error("Failed to set url label", e); } final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label")); hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description")); hocrResourceField = new JTextField(""); final String hocrResource = TextObjectURI.gethOCRResourceURI(map); try { hocrResourceField.setText(hocrResource); } catch (Exception e) { log.error("Failed to set hocrResource 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(hocrResourceLabel, glbc); panel.add(hocrResourceLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(hocrResourceField, glbc); panel.add(hocrResourceField); 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.text.CreateWordsFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/*w w w .j av a 2 s . c om*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("CreateWordsFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Words 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 = CreateWordsHandler.getWordContainerURI(map); try { urlField.setText(uri.toString()); } catch (Exception e) { log.error("Failed to set url label", e); } final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label")); hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description")); hocrResourceField = new JTextField(""); final String hocrResource = TextObjectURI.gethOCRResourceURI(map); try { hocrResourceField.setText(hocrResource); } catch (Exception e) { log.error("Failed to set hocrResource 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(hocrResourceLabel, glbc); panel.add(hocrResourceLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(hocrResourceField, glbc); panel.add(hocrResourceField); 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:jatools.component.chart.customizer.Tabs.java
protected final void initializeCustomizer(int type) { GridBagLayout gbl = new GridBagLayout(); setLayout(gbl);/*from ww w . j a v a2 s .co m*/ GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = CommonFinal.INSETS; gbc.fill = GridBagConstraints.BOTH; tp = new JTabbedPane(); gbc.weightx = 1; gbc.weighty = 1; dataPanel = new DataSelector(); initDataPanel(); dataPanel.addChangeListener(this); dataPanel.setPrompt(dataPrompts[type]); dataPanel.setType(type); tp.add(dataPanel, ""); initTabbed(); add(tp, gbc); }
From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java
protected JPanel createDeviceTypePanel() { JPanel panel = new JPanel(); panel.setOpaque(false);// w w w . j ava2s . c o m panel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); GridBagLayout gridBag = new GridBagLayout(); panel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.insets = new Insets(8, 2, 2, 2); gc.weighty = 0; gc.weightx = 1; gc.gridwidth = GridBagConstraints.REMAINDER; gc.gridheight = 1; deviceTypeChartPanel = new ChartPanel(null); deviceTypeChartPanel.setPreferredSize(new Dimension(80, 60)); panel.add(deviceTypeChartPanel, gc); typeNumberLabels = new JLabel[nodeTypes.length]; typeNameLabels = new JLabel[nodeTypes.length]; gc.fill = GridBagConstraints.BOTH; gc.insets = new Insets(2, 2, 2, 2); for (int i = 0; i < nodeTypes.length; i++) { gc.weightx = 1; gc.gridwidth = 1; typeNumberLabels[i] = createNumberLabel(); panel.add(typeNumberLabels[i], gc); gc.weightx = 0; gc.gridwidth = GridBagConstraints.REMAINDER; typeNameLabels[i] = createNameLabel(nodeTypes[i].getName()); panel.add(typeNameLabels[i], gc); } return panel; }
From source file:org.gridchem.client.gui.panels.myccg.resource.HPCChartPanel.java
private void init() { removeAll();/*from w w w .j a va2 s.c om*/ chartPanel = createChartPanel(); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1.0; c.weighty = 1.0; c.gridx = 0; c.gridy = 0; c.fill = GridBagConstraints.BOTH; add(chartPanel, c); c.weightx = 0; c.weighty = 0; c.gridx = 0; c.gridy = 1; add(navPanel, c); revalidate(); }