Example usage for java.awt GridBagConstraints WEST

List of usage examples for java.awt GridBagConstraints WEST

Introduction

In this page you can find the example usage for java.awt GridBagConstraints WEST.

Prototype

int WEST

To view the source code for java.awt GridBagConstraints WEST.

Click Source Link

Document

Put the component on the left side of its display area, centered vertically.

Usage

From source file:net.sourceforge.atunes.kernel.modules.state.RepositoryPanel.java

/**
 * Add components to panel//from w ww .  j a va2s . co  m
 */
private void setupPanel() {
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 10, 0, 0);
    add(new JLabel(I18nUtils.getString("REPOSITORY_REFRESH_TIME")), c);
    c.gridx = 1;
    c.weightx = 1;
    c.insets = new Insets(0, 10, 0, 0);
    add(this.refreshTime, c);
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 1;
    c.insets = new Insets(10, 10, 0, 0);
    add(new JLabel(I18nUtils.getString("COMMAND_BEFORE_REPOSITORY_ACCESS")), c);
    c.gridx = 1;
    c.weightx = 1;
    add(this.commandBeforeAccessRepository, c);
    c.gridx = 0;
    c.gridy = 2;
    c.weightx = 0;
    add(new JLabel(I18nUtils.getString("COMMAND_AFTER_REPOSITORY_ACCESS")), c);
    c.gridx = 1;
    c.weightx = 1;
    add(this.commandAfterAccessRepository, c);
    c.gridx = 0;
    c.gridy = 3;
    c.insets = new Insets(20, 10, 0, 0);
    JScrollPane scrollPane = this.controlsBuilder.createScrollPane(this.repositoryFoldersList);
    scrollPane.setMinimumSize(new Dimension(400, 300));
    scrollPane.setPreferredSize(new Dimension(400, 300));
    add(scrollPane, c);
    JPanel addRemovePanel = new JPanel(new GridLayout(1, 2, 5, 0));
    addRemovePanel.add(this.addFolderButton);
    addRemovePanel.add(this.removeFolderButton);
    c.gridy = 4;
    c.insets = new Insets(10, 10, 0, 0);
    add(addRemovePanel, c);
    c.gridx = 0;
    c.gridy = 5;
    c.weighty = 1;
    c.anchor = GridBagConstraints.NORTHWEST;
    add(this.useRatingsStoredInTag, c);
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.CommentsTaskPaneUI.java

/** Builds and lays out the UI. */
private void buildGUI() {
    removeAll();/*from w w  w .  j a  va  2  s  . com*/

    bgColor = UIUtilities.BACKGROUND_COLOUR_ODD;

    constraints = new GridBagConstraints();
    constraints.insets = new Insets(2, 0, 2, 0);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 1;
    constraints.weighty = 1;
    add(pane, constraints);
    constraints.gridy++;

    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.WEST;
    add(addButton, constraints);
    constraints.gridy++;

    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.NORTHWEST;
}

From source file:com.digitalgeneralists.assurance.ui.components.ScanPathMappingPanel.java

protected void initializeComponent() {
    if (!this.initialized) {
        if (this.mappingDefinition == null) {
            this.mode = AssuranceDialogMode.ADD;
            this.dialogTitle = "Add New Path Mapping";
            this.mappingDefinition = new ScanMappingDefinition();
        } else {//from   w  ww  .  j  a  va  2s .  c o m
            this.mode = AssuranceDialogMode.EDIT;
            this.dialogTitle = "Edit Path Mapping";
        }

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

        final JPanel scanPathsPanel = new JPanel();
        scanPathsPanel.setLayout(new GridBagLayout());

        Border pathsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        pathsPanelBorder = BorderFactory.createTitledBorder(pathsPanelBorder, "Paths", TitledBorder.CENTER,
                TitledBorder.TOP);

        GridBagConstraints scanPathsPanelConstraints = new GridBagConstraints();
        scanPathsPanelConstraints.anchor = GridBagConstraints.NORTH;
        scanPathsPanelConstraints.fill = GridBagConstraints.HORIZONTAL;
        scanPathsPanelConstraints.gridx = 0;
        scanPathsPanelConstraints.gridy = 0;
        scanPathsPanelConstraints.weightx = 1.0;
        scanPathsPanelConstraints.weighty = 1.0;
        scanPathsPanelConstraints.gridheight = 1;
        scanPathsPanelConstraints.gridwidth = 2;
        scanPathsPanelConstraints.insets = new Insets(5, 5, 5, 5);

        scanPathsPanel.setBorder(pathsPanelBorder);
        this.add(scanPathsPanel, scanPathsPanelConstraints);

        GridBagConstraints sourcePathFieldConstraints = new GridBagConstraints();
        sourcePathFieldConstraints.anchor = GridBagConstraints.NORTH;
        sourcePathFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        sourcePathFieldConstraints.gridx = 0;
        sourcePathFieldConstraints.gridy = 0;
        sourcePathFieldConstraints.weightx = 1.0;
        sourcePathFieldConstraints.weighty = 1.0;
        sourcePathFieldConstraints.gridheight = 1;
        sourcePathFieldConstraints.gridwidth = 1;
        sourcePathFieldConstraints.insets = new Insets(0, 5, 5, 5);

        GridBagConstraints targetPathFieldConstraints = new GridBagConstraints();
        targetPathFieldConstraints.anchor = GridBagConstraints.NORTH;
        targetPathFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        targetPathFieldConstraints.gridx = 0;
        targetPathFieldConstraints.gridy = 1;
        targetPathFieldConstraints.weightx = 1.0;
        targetPathFieldConstraints.weighty = 1.0;
        targetPathFieldConstraints.gridheight = 1;
        targetPathFieldConstraints.gridwidth = 1;
        targetPathFieldConstraints.insets = new Insets(5, 5, 5, 5);

        scanPathsPanel.add(this.sourcePathPickerField, sourcePathFieldConstraints);
        scanPathsPanel.add(this.targetPathPickerField, targetPathFieldConstraints);

        if (mappingDefinition != null) {
            File source = mappingDefinition.getSource();
            if (source != null) {
                this.sourcePathPickerField.setValue(source.getPath());
            } else {
                this.sourcePathPickerField.setValue("");
            }
            File target = mappingDefinition.getTarget();
            if (target != null) {
                this.targetPathPickerField.setValue(target.getPath());
            } else {
                this.targetPathPickerField.setValue("");
            }
        }

        Border existingExclusionsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        existingExclusionsPanelBorder = BorderFactory.createTitledBorder(existingExclusionsPanelBorder,
                "Exclusions", TitledBorder.CENTER, TitledBorder.TOP);

        GridBagConstraints existingExclusionsPanelConstraints = new GridBagConstraints();
        existingExclusionsPanelConstraints.anchor = GridBagConstraints.WEST;
        existingExclusionsPanelConstraints.fill = GridBagConstraints.BOTH;
        existingExclusionsPanelConstraints.gridx = 0;
        existingExclusionsPanelConstraints.gridy = 1;
        existingExclusionsPanelConstraints.weightx = 1.0;
        existingExclusionsPanelConstraints.weighty = 0.9;
        existingExclusionsPanelConstraints.gridheight = 1;
        existingExclusionsPanelConstraints.gridwidth = 2;
        existingExclusionsPanelConstraints.insets = new Insets(0, 5, 0, 5);

        JPanel existingExclusionsPanel = new JPanel();
        GridBagLayout panelGridbag = new GridBagLayout();
        existingExclusionsPanel.setLayout(panelGridbag);
        existingExclusionsPanel.setBorder(existingExclusionsPanelBorder);
        this.add(existingExclusionsPanel, existingExclusionsPanelConstraints);

        GridBagConstraints existingExclusionsListConstraints = new GridBagConstraints();
        existingExclusionsListConstraints.anchor = GridBagConstraints.WEST;
        existingExclusionsListConstraints.fill = GridBagConstraints.BOTH;
        existingExclusionsListConstraints.gridx = 0;
        existingExclusionsListConstraints.gridy = 0;
        existingExclusionsListConstraints.weightx = 1.0;
        existingExclusionsListConstraints.weighty = 0.9;
        existingExclusionsListConstraints.gridheight = 1;
        existingExclusionsListConstraints.gridwidth = 2;
        existingExclusionsListConstraints.insets = new Insets(5, 5, 5, 5);

        this.mappingDefinition = (ScanMappingDefinition) ModelUtils.initializeEntity(this.mappingDefinition,
                ScanMappingDefinition.EXCLUSIONS_PROPERTY);
        this.exclusionsPanel = new ListInputPanel<FileReference>(this.mappingDefinition, this);
        existingExclusionsPanel.add(this.exclusionsPanel, existingExclusionsListConstraints);

        this.initialized = true;
    }
}

From source file:cool.pandora.modeller.ui.jpanel.base.NewBagInPlaceFrame.java

/**
 * layoutSelectDataContent.// w  w  w. ja v a  2s .  co  m
 *
 * @param contentPanel JPanel
 * @param row          int
 */
private void layoutSelectDataContent(final JPanel contentPanel, final int row) {

    final JLabel location = new JLabel("Select Data:");
    final JButton saveAsButton = new JButton(bagView.getPropertyMessage("bag.button.browse"));
    saveAsButton.addActionListener(new BrowseFileHandler());
    saveAsButton.setEnabled(true);
    saveAsButton.setToolTipText(bagView.getPropertyMessage("bag.button.browse.help"));

    String fileName = "";
    if (bag != null) {
        fileName = bag.getName();
    }
    bagNameField = new JTextField(fileName);
    bagNameField.setCaretPosition(fileName.length());
    bagNameField.setEditable(false);
    bagNameField.setEnabled(false);

    GridBagConstraints glbc = new GridBagConstraints();
    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 1, 50, GridBagConstraints.NONE,
            GridBagConstraints.WEST);
    contentPanel.add(location, glbc);

    glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 1, 50, GridBagConstraints.NONE,
            GridBagConstraints.EAST);
    contentPanel.add(saveAsButton, glbc);

    glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST);
    glbc.ipadx = 0;
    contentPanel.add(bagNameField, glbc);
}

From source file:org.nuclos.client.genericobject.logbook.LogbookController.java

private void setupToolbar(final LogbookPanel pnlLogbook) {
    this.btnRefresh.setName("btnRefresh");
    this.btnRefresh.setAction(actRefresh);
    this.btnRefresh.setText(null);
    pnlLogbook.getToolbar().add(this.btnRefresh);

    pnlFilter.setBorder(BorderFactory
            .createTitledBorder(getSpringLocaleDelegate().getMessage("LogbookController.4", "Filter nach")));
    pnlFilter.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets.right = 5;//from w  ww .j  ava2s.co  m
    gbc.fill = GridBagConstraints.NONE;

    gbc.gridx = 0;
    gbc.gridy = 0;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.5", "Ge\u00e4ndert am")),
            gbc);

    gbc.gridx = 1;
    gbc.insets.right = 10;
    this.pnlFilter.add(this.tfCOLUMN_CHANGEDAT, gbc);
    this.tfCOLUMN_CHANGEDAT.setColumns(15);
    this.tfCOLUMN_CHANGEDAT.setToolTipText(
            getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte") + " '"
                    + getSpringLocaleDelegate().getMessage("LogbookController.5", "Ge\u00e4ndert am") + "'");

    ++gbc.gridy;
    gbc.gridx = 0;
    gbc.insets.right = 5;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.7", "Ge\u00e4ndert von")),
            gbc);

    gbc.gridx = 1;
    gbc.insets.right = 10;
    this.pnlFilter.add(this.tfCOLUMN_CHANGEDBY, gbc);
    this.tfCOLUMN_CHANGEDBY.setColumns(15);
    this.tfCOLUMN_CHANGEDBY.setToolTipText(
            getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte") + " '"
                    + getSpringLocaleDelegate().getMessage("LogbookController.7", "Ge\u00e4ndert von") + "'");

    ++gbc.gridy;
    gbc.gridx = 0;
    gbc.insets.right = 5;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.8", "Feld")), gbc);

    gbc.gridx = 1;
    gbc.insets.right = 10;
    this.pnlFilter.add(this.tfCOLUMN_LABEL, gbc);
    this.tfCOLUMN_LABEL.setColumns(15);
    this.tfCOLUMN_LABEL
            .setToolTipText(getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte")
                    + " '" + getSpringLocaleDelegate().getMessage("LogbookController.8", "Feld") + "'");

    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.insets.right = 5;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.9", "Alter Wert")), gbc);

    gbc.gridx = 3;
    this.pnlFilter.add(this.tfCOLUMN_OLDVALUE, gbc);
    this.tfCOLUMN_OLDVALUE.setColumns(15);
    this.tfCOLUMN_OLDVALUE
            .setToolTipText(getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte")
                    + " '" + getSpringLocaleDelegate().getMessage("LogbookController.9", "Alter Wert") + "'");

    ++gbc.gridy;
    gbc.gridx = 2;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.10", "Neuer Wert")), gbc);

    gbc.gridx = 3;
    this.pnlFilter.add(this.tfCOLUMN_NEWVALUE, gbc);
    this.tfCOLUMN_NEWVALUE.setColumns(15);
    this.tfCOLUMN_NEWVALUE
            .setToolTipText(getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte")
                    + " '" + getSpringLocaleDelegate().getMessage("LogbookController.10", "Neuer Wert") + "'");

    ++gbc.gridy;
    gbc.gridx = 2;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.11", "ID")), gbc);

    gbc.gridx = 3;
    this.pnlFilter.add(this.tfCOLUMN_ID, gbc);
    this.tfCOLUMN_ID.setColumns(15);
    this.tfCOLUMN_ID
            .setToolTipText(getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte")
                    + " '" + getSpringLocaleDelegate().getMessage("LogbookController.11", "ID") + "'");

    gbc.gridx = 4;
    gbc.gridy = 0;
    gbc.weightx = 0.1;
    this.btnFilter.setAction(actFilter);
    this.btnFilter.setText(null);
    this.pnlFilter.add(this.btnFilter, gbc);

    gbc.gridx = 4;
    gbc.gridy = 1;
    this.btnClearFilter.setAction(actClearFilter);
    this.btnClearFilter.setText(null);
    this.pnlFilter.add(this.btnClearFilter, gbc);

    pnlLogbook.getToolbar().add(this.pnlFilter);
    pnlLogbook.getToolbar().add(Box.createHorizontalGlue());

    /**
     * action: Refresh
     */
    KeyBindingProvider.bindActionToComponent(KeyBindingProvider.REFRESH, actRefresh, pnlLogbook);
}

From source file:gov.loc.repository.bagger.ui.NewBagInPlaceFrame.java

private void layoutBagVersionContent(JPanel contentPanel, int row) {
    GridBagConstraints glbc = new GridBagConstraints();

    JLabel bagVersionLabel = new JLabel(bagView.getPropertyMessage("bag.label.version"));
    bagVersionLabel.setToolTipText(bagView.getPropertyMessage("bag.versionlist.help"));
    ArrayList<String> versionModel = new ArrayList<String>();
    Version[] vals = Version.values();//from  w  w  w .  java2 s .com
    for (int i = 0; i < vals.length; i++) {
        versionModel.add(vals[i].versionString);
    }

    bagVersionList = new JComboBox(versionModel.toArray());
    bagVersionList.setName(bagView.getPropertyMessage("bag.label.versionlist"));
    bagVersionList.setSelectedItem(Version.V0_96.versionString);
    bagVersionList.setToolTipText(bagView.getPropertyMessage("bag.versionlist.help"));

    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 1, 50, GridBagConstraints.NONE,
            GridBagConstraints.WEST);
    contentPanel.add(bagVersionLabel, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST);
    contentPanel.add(bagVersionList, glbc);
}

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  2s. co  m
    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  w w .j  ava  2  s.c o 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  w w  w. ja 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("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 .ja v a 2s  .  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;

}