List of usage examples for java.awt GridBagConstraints CENTER
int CENTER
To view the source code for java.awt GridBagConstraints CENTER.
Click Source Link
From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.gui.StartupDialog.java
/** * Initialises all GUI elements.// w ww .jav a2 s. co m */ private void initGui() { this.setResizable(false); this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); cancelButton = new JButton("Don't log in"); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); storeCredentialsButton = new JButton("Store Credentials"); storeCredentialsButton.setActionCommand("StoreCredentials"); storeCredentialsButton.addActionListener(this); okButton = new JButton("Log in"); okButton.setActionCommand("LogIn"); okButton.addActionListener(this); // Set default ENTER and ESCAPE buttons. this.getRootPane().setDefaultButton(okButton); this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() { private static final long serialVersionUID = -1742280851624947873L; public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } }); JPanel buttonsPanel = new JPanel(new GridBagLayout()); buttonsPanel.add(cancelButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); buttonsPanel.add(storeCredentialsButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); buttonsPanel.add(okButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); loginPassphrasePanel = new LoginPassphrasePanel(hyperlinkListener); loginLocalFolderPanel = new LoginLocalFolderPanel(ownerFrame, hyperlinkListener); loginCredentialsPanel = new LoginCredentialsPanel(false, hyperlinkListener); // Tabbed Pane. tabbedPane = new JTabbedPane(); tabbedPane.addChangeListener(this); tabbedPane.add(loginPassphrasePanel, "S3 Online"); tabbedPane.add(loginLocalFolderPanel, "Local Folder"); tabbedPane.add(loginCredentialsPanel, "Direct Login"); int row = 0; this.getContentPane().setLayout(new GridBagLayout()); this.getContentPane().add(tabbedPane, new GridBagConstraints(0, row++, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); this.getContentPane().add(buttonsPanel, new GridBagConstraints(0, row++, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); this.pack(); this.setSize(500, 400); this.setLocationRelativeTo(this.getOwner()); }
From source file:com.excilys.ebi.gatling.recorder.ui.component.RunningFrame.java
public RunningFrame() { /* Initialization of the frame */ setTitle("Gatling Recorder - Running..."); setMinimumSize(new Dimension(800, 640)); setLocationRelativeTo(null);//www.j a va2 s .c o m setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); setIconImages(Commons.getIconList()); /* Declaration & initialization of components */ JButton btnClear = new JButton("Clear"); final JButton btnStop = new JButton("Stop !"); btnStop.setSize(120, 30); JScrollPane panelFilters = new JScrollPane(executedEvents); panelFilters.setPreferredSize(new Dimension(300, 100)); stringRequest.setPreferredSize(new Dimension(330, 100)); JSplitPane requestResponsePane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(stringRequest), new JScrollPane(stringResponse)); final JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, requestResponsePane, stringRequestBody); JScrollPane panelHostsCertificate = new JScrollPane(requiredHostsCertificate); panelHostsCertificate.setPreferredSize(new Dimension(300, 100)); /* Layout */ GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(10, 5, 0, 0); gbc.gridx = 0; gbc.anchor = GridBagConstraints.LINE_START; gbc.gridy = 0; add(new JLabel("Tag :"), gbc); gbc.gridx = 1; add(txtTag, gbc); gbc.gridx = 2; gbc.weightx = 0.5; add(btnTag, gbc); gbc.gridx = 3; gbc.anchor = GridBagConstraints.CENTER; gbc.weightx = 0.25; add(btnClear, gbc); gbc.gridx = 4; gbc.anchor = GridBagConstraints.LINE_END; add(btnStop, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.weightx = 0; gbc.anchor = GridBagConstraints.LINE_START; gbc.gridwidth = GridBagConstraints.REMAINDER; add(new JLabel("Executed Events:"), gbc); gbc.gridy = 2; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1; gbc.weighty = 0.20; gbc.fill = GridBagConstraints.BOTH; add(panelFilters, gbc); gbc.gridy = 4; gbc.weightx = 1; gbc.weighty = 0.75; gbc.fill = GridBagConstraints.BOTH; add(sp, gbc); gbc.gridy = 5; gbc.weighty = 0; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.anchor = GridBagConstraints.CENTER; add(new JLabel("Secured hosts requiring accepting a certificate:"), gbc); gbc.gridy = 6; gbc.weighty = 0.05; gbc.gridwidth = GridBagConstraints.REMAINDER; add(panelHostsCertificate, gbc); /* Listeners */ btnTag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!txtTag.getText().equals(EMPTY)) { TagEvent tag = new TagEvent(txtTag.getText()); events.addElement(tag.toString()); executedEvents.ensureIndexIsVisible(events.getSize() - 1); listEvents.add(tag); txtTag.setText(EMPTY); } } }); executedEvents.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (executedEvents.getSelectedIndex() >= 0) { Object obj = listEvents.get(executedEvents.getSelectedIndex()); if (obj instanceof ResponseReceivedEvent) { ResponseReceivedEvent event = (ResponseReceivedEvent) obj; stringRequest.txt.setText(event.getRequest().toString()); stringResponse.txt.setText(event.getResponse().toString()); stringRequestBody.txt.setText(new String(event.getRequest().getContent().array())); } else { stringRequest.txt.setText(EMPTY); stringResponse.txt.setText(EMPTY); stringRequestBody.txt.setText(EMPTY); } } } }); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clearOldRunning(); } }); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveScenario(); proxy.shutdown(); proxy = null; if (!Configuration.getInstance().isConfigurationSkipped()) getEventBus().post(new ShowConfigurationFrameEvent()); else System.exit(0); } }); }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanProxySetting.java
private JPanel getJPanelValue() { if (jPanelValue == null) { GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 1;// www . j a v a2 s . c o m gridBagConstraints3.weighty = 1.0; gridBagConstraints3.weightx = 0.0; gridBagConstraints3.gridy = 4; jLabelEmpty = new JLabel(); jLabelEmpty.setText(""); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.gridy = 3; jPanelValue = new JPanel(); jPanelValue.setLayout(new GridBagLayout()); jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelValue.setPreferredSize(new Dimension(400, 200)); jPanelValue.add(jLabelEmpty, gridBagConstraints3); JLabel jLabelProxyHost = new JLabel("Proxy Host : ", JLabel.RIGHT); GridBagConstraints gridBagConstraintsjLabelProxyHost = new GridBagConstraints(); gridBagConstraintsjLabelProxyHost.gridx = 0; gridBagConstraintsjLabelProxyHost.insets = new Insets(10, 20, 5, 0); gridBagConstraintsjLabelProxyHost.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelProxyHost.weightx = 0.0; gridBagConstraintsjLabelProxyHost.weighty = 0.0; gridBagConstraintsjLabelProxyHost.gridy = 1; jPanelValue.add(jLabelProxyHost, gridBagConstraintsjLabelProxyHost); GridBagConstraints gridBagConstraintsgetJTextFieldProxyHost = new GridBagConstraints(); gridBagConstraintsgetJTextFieldProxyHost.gridx = 1; gridBagConstraintsgetJTextFieldProxyHost.weightx = 1.0; gridBagConstraintsgetJTextFieldProxyHost.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldProxyHost.insets = new Insets(10, 5, 5, 100); gridBagConstraintsgetJTextFieldProxyHost.gridwidth = 2; gridBagConstraintsgetJTextFieldProxyHost.gridy = 1; jPanelValue.add(getJTextFieldProxyHost(), gridBagConstraintsgetJTextFieldProxyHost); JLabel jLabelProxyPort = new JLabel("Proxy Port : ", JLabel.RIGHT); GridBagConstraints gridBagConstraintsjLabelProxyPort = new GridBagConstraints(); gridBagConstraintsjLabelProxyPort.gridx = 0; gridBagConstraintsjLabelProxyPort.insets = new Insets(0, 20, 0, 0); gridBagConstraintsjLabelProxyPort.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelProxyPort.weighty = 0.0; gridBagConstraintsjLabelProxyPort.gridy = 2; jPanelValue.add(jLabelProxyPort, gridBagConstraintsjLabelProxyPort); GridBagConstraints gridBagConstraintsgetJTextFieldProxyPort = new GridBagConstraints(); gridBagConstraintsgetJTextFieldProxyPort.gridx = 1; gridBagConstraintsgetJTextFieldProxyPort.weightx = 1.0; gridBagConstraintsgetJTextFieldProxyPort.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldProxyPort.insets = new Insets(5, 5, 5, 220); gridBagConstraintsgetJTextFieldProxyPort.weighty = 0.0; gridBagConstraintsgetJTextFieldProxyPort.anchor = GridBagConstraints.CENTER; gridBagConstraintsgetJTextFieldProxyPort.gridy = 2; jPanelValue.add(getJTextFieldProxyPort(), gridBagConstraintsgetJTextFieldProxyPort); JLabel jLabelProxyBypass = new JLabel("Proxy Bypass : ", JLabel.RIGHT); GridBagConstraints gridBagConstraintsjLabelProxyBypass = new GridBagConstraints(); gridBagConstraintsjLabelProxyBypass.gridx = 0; gridBagConstraintsjLabelProxyBypass.insets = new Insets(0, 20, 0, 0); gridBagConstraintsjLabelProxyBypass.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelProxyBypass.weighty = 0.0; gridBagConstraintsjLabelProxyBypass.gridy = 3; jPanelValue.add(jLabelProxyBypass, gridBagConstraintsjLabelProxyBypass); GridBagConstraints gridBagConstraintsgetJTextFieldProxyBypass = new GridBagConstraints(); gridBagConstraintsgetJTextFieldProxyBypass.gridx = 1; gridBagConstraintsgetJTextFieldProxyBypass.weightx = 1.0; gridBagConstraintsgetJTextFieldProxyBypass.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldProxyBypass.insets = new Insets(5, 5, 5, 100); gridBagConstraintsgetJTextFieldProxyBypass.weighty = 0.0; gridBagConstraintsgetJTextFieldProxyBypass.anchor = GridBagConstraints.CENTER; gridBagConstraintsgetJTextFieldProxyBypass.gridy = 3; jPanelValue.add(getJTextFieldProxyBypass(), gridBagConstraintsgetJTextFieldProxyBypass); //jPanelValue.add(getJPanel(), gridBagConstraints2); } return jPanelValue; }
From source file:cool.pandora.modeller.ui.jpanel.iiif.PatchCanvasFrame.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 om*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("PatchCanvasFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Canvases"))); 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 (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:cool.pandora.modeller.ui.jpanel.iiif.CreateListsFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/*w ww .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("CreateListsFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create List 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.getListContainerURI(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: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();//from ww w . ja v a2s . c o 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();/*w w w. j av a 2s .c om*/ 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 www . j a v a 2s .c om*/ 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:FontChooser.java
private void createUserInterface() { final JPanel content = new JPanel(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); setContentPane(content);//w w w . j a va2 s. c o m content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(2, 2, 2, 2); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = gbc.gridy = 0; content.add(new JLabel("Font"), gbc); ++gbc.gridx; content.add(new JLabel("Size"), gbc); if (_selectStyles) { ++gbc.gridx; content.add(new JLabel("Style"), gbc); } ++gbc.gridy; gbc.gridx = 0; _fontNamesCmb = new JComboBox( GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()); content.add(_fontNamesCmb, gbc); ++gbc.gridx; _fontSizesCmb.setEditable(true); content.add(_fontSizesCmb, gbc); if (_selectStyles) { ++gbc.gridx; content.add(_boldChk, gbc); ++gbc.gridy; content.add(_italicChk, gbc); } gbc.gridx = 0; ++gbc.gridy; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.CENTER; content.add(createPreviewPanel(), gbc); ++gbc.gridy; gbc.fill = GridBagConstraints.HORIZONTAL; content.add(createButtonsPanel(), gbc); pack(); setResizable(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();//from ww w . j a v a2 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; }