Example usage for javax.swing JPanel setBorder

List of usage examples for javax.swing JPanel setBorder

Introduction

In this page you can find the example usage for javax.swing JPanel setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:medsavant.enrichment.app.OntologyAggregatePanel.java

public OntologyAggregatePanel(String page) {
    super(page);/*from www  .j  av a  2s.c om*/
    setLayout(new GridBagLayout());

    chooser = new JComboBox(OntologyListItem.DEFAULT_ITEMS);
    chooser.setMaximumSize(new Dimension(400, chooser.getMaximumSize().height));
    progress = new JProgressBar();
    progress.setPreferredSize(new Dimension(600, progress.getMaximumSize().height));
    progress.setStringPainted(true);

    JPanel banner = new JPanel();
    banner.setLayout(new GridBagLayout());
    banner.setBackground(new Color(245, 245, 245));
    banner.setBorder(BorderFactory.createTitledBorder("Ontology"));

    tree = new TreeTable();

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 1.0;
    gbc.anchor = GridBagConstraints.WEST;
    banner.add(chooser, gbc);
    gbc.anchor = GridBagConstraints.EAST;
    banner.add(progress, gbc);

    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTH;
    add(banner, gbc);

    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    add(new JScrollPane(tree), gbc);

    chooser.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (termFetcher != null) {
                termFetcher.cancel(true);
                termFetcher = null;
            }
            recalculate();
        }
    });

    tree.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                createPopup().show(e.getComponent(), e.getX(), e.getY());
            }
        }
    });
}

From source file:org.obiba.onyx.jade.instrument.ricelake.RiceLakeWeightInstrumentRunner.java

/**
 * Puts together the GUI main panel component.
 * //  w  w w  .  ja v  a  2s  .com
 * @return
 */
protected JPanel buildMainPanel() {

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    panel.add(buildMeasureCountSubPanel());
    panel.add(buildResultsSubPanel());
    panel.add(buildActionButtonSubPanel());

    return panel;
}

From source file:com.haulmont.cuba.desktop.App.java

protected JComponent createBottomPane() {
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createLineBorder(Color.gray));
    panel.setPreferredSize(new Dimension(0, 20));

    ServerSelector serverSelector = AppBeans.get(ServerSelector.NAME);
    String url = serverSelector.getUrl(serverSelector.initContext());
    if (url == null)
        url = "?";

    final JLabel connectionStateLab = new JLabel(
            messages.formatMainMessage("statusBar.connected", getUserFriendlyConnectionUrl(url)));

    panel.add(connectionStateLab, BorderLayout.WEST);

    JPanel rightPanel = new JPanel();
    BoxLayout rightLayout = new BoxLayout(rightPanel, BoxLayout.LINE_AXIS);
    rightPanel.setLayout(rightLayout);//from  ww  w . ja v a  2  s  .  c o  m

    UserSession session = connection.getSession();

    JLabel userInfoLabel = new JLabel();
    String userInfo = messages.formatMainMessage("statusBar.user", session.getUser().getName(),
            session.getUser().getLogin());
    userInfoLabel.setText(userInfo);

    rightPanel.add(userInfoLabel);

    JLabel timeZoneLabel = null;
    if (session.getTimeZone() != null) {
        timeZoneLabel = new JLabel();
        String timeZone = messages.formatMainMessage("statusBar.timeZone",
                AppBeans.get(TimeZones.class).getDisplayNameShort(session.getTimeZone()));
        timeZoneLabel.setText(timeZone);

        rightPanel.add(Box.createRigidArea(new Dimension(5, 0)));
        rightPanel.add(timeZoneLabel);
    }

    panel.add(rightPanel, BorderLayout.EAST);

    if (isTestMode()) {
        panel.setName("bottomPane");
        userInfoLabel.setName("userInfoLabel");
        if (timeZoneLabel != null)
            timeZoneLabel.setName("timeZoneLabel");
        connectionStateLab.setName("connectionStateLab");
    }

    return panel;
}

From source file:brainflow.app.presentation.controls.FileObjectGroupSelector.java

private JideSplitPane createSplitPane() {
    JPanel treePanel = new JPanel();
    treePanel.setLayout(new BorderLayout());
    treePanel.setMinimumSize(new Dimension(300, 100));
    treePanel.add(new JScrollPane(explorer.getComponent()), BorderLayout.CENTER);
    splitPane = new JideSplitPane(JideSplitPane.HORIZONTAL_SPLIT);
    splitPane.setProportionalLayout(true);

    treePanel.setBorder(BorderFactory.createTitledBorder("File System"));
    splitPane.add(treePanel, JideBoxLayout.FLEXIBLE);

    JScrollPane jsp = new JScrollPane(fileList);
    jsp.setBorder(BorderFactory.createTitledBorder("Filter Selection"));
    splitPane.add(jsp, JideBoxLayout.VARY);
    splitPane.setProportions(new double[] { .55 });
    return splitPane;

}

From source file:de.interactive_instruments.ShapeChange.UI.DefaultDialog.java

private JPanel createTab2() {
    final JPanel reportPanel = new JPanel(new GridLayout(3, 1));
    reportGroup = new ButtonGroup();
    String param = options.parameter("reportLevel");
    addRadioButton(reportPanel, reportGroup, "Error", "ERROR", param);
    addRadioButton(reportPanel, reportGroup, "Warning", "WARNING", param);
    addRadioButton(reportPanel, reportGroup, "Info", "INFO", param);
    reportPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Report options", TitledBorder.LEFT,
            TitledBorder.TOP));//w ww. ja  va2 s .  c  o m

    final JPanel rulePanel = new JPanel(new GridLayout(3, 1));
    ruleGroup = new ButtonGroup();
    param = options.parameter(Options.TargetXmlSchemaClass, "defaultEncodingRule");
    addRadioButton(rulePanel, ruleGroup, "GML 3.2", "iso19136_2007", param);
    addRadioButton(rulePanel, ruleGroup, "GML 3.3", "gml33", param);
    addRadioButton(rulePanel, ruleGroup, "ISO/TS 19139", "iso19139_2007", param);
    addRadioButton(rulePanel, ruleGroup, "GML 3.2 (ShapeChange extensions)",
            "iso19136_2007_ShapeChange_1.0_extensions", param);
    addRadioButton(rulePanel, ruleGroup, "GML 3.3 (INSPIRE extensions)", "iso19136_2007_INSPIRE_Extensions",
            param);
    rulePanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Default encoding rule",
            TitledBorder.LEFT, TitledBorder.TOP));

    final JPanel otherPanel = new JPanel(new GridLayout(2, 1));
    docCB = new JCheckBox("Include documentation", true);
    boolean b = true;
    String s = options.parameter(Options.TargetXmlSchemaClass, "includeDocumentation");
    if (s != null && s.equals("false"))
        b = false;
    docCB.setSelected(b);
    otherPanel.add(docCB);
    visCB = new JCheckBox("Ignore visibility");
    b = true;
    s = options.parameter("publicOnly");
    if (s != null && s.equals("false"))
        b = false;
    visCB.setSelected(!b);
    otherPanel.add(visCB);
    otherPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Other options", TitledBorder.LEFT,
            TitledBorder.TOP));

    Box innerBox = Box.createHorizontalBox();
    innerBox.add(reportPanel);
    innerBox.add(otherPanel);

    Box mainBox = Box.createVerticalBox();
    mainBox.add(innerBox);
    mainBox.add(rulePanel);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(mainBox, BorderLayout.CENTER);

    return panel;
}

From source file:com.sshtools.common.ui.SshToolsApplication.java

/**
 * Show an 'About' dialog/*from   www .  j  a va2 s  . c om*/
 *
 *
 */
public void showAbout(final Component parent) {

    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);

    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel v = new MultilineLabel(getApplicationName() + " " + getApplicationVersion());
    v.setFont(v.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel x = new MultilineLabel(getAboutAuthors());
    x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    x.setFont(x.getFont().deriveFont(12f));
    UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel c = new MultilineLabel(getAboutLicenseDetails());
    c.setFont(c.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER);

    final JLabel h = new JLabel(getAboutURL());
    h.setForeground(Color.blue);
    h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10));
    h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    h.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent evt) {
            try {
                BrowserLauncher.openURL(getAboutURL());
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }
    });
    UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER);

    JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon());
}

From source file:com.sshtools.common.ui.SshToolsApplication.java

public void openChangelog(Component parent) {

    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);

    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);

    String changelog = "";
    try {/*  www. j  a v a2  s  .co  m*/
        BufferedReader br = new BufferedReader(
                new InputStreamReader(getClass().getResourceAsStream("/changelog")));
        String line = br.readLine();
        while (line != null) {
            changelog += line + "\n";
            line = br.readLine();
        }
        br.close();
    } catch (Exception e) {
        changelog = "<Error opening changelog>\n";
    }

    javax.swing.JTextArea message = new javax.swing.JTextArea(changelog);
    message.setEditable(false);
    message.setBorder(javax.swing.BorderFactory.createEmptyBorder(4, 4, 4, 4));
    javax.swing.JLabel jl = new javax.swing.JLabel();
    message.setFont(jl.getFont());
    message.setBackground(jl.getBackground());

    //   MultilineLabel x = new MultilineLabel(changelog);
    //   x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    //   x.setFont(x.getFont().deriveFont(12f));   
    javax.swing.JScrollPane scrollPane = new javax.swing.JScrollPane();
    scrollPane.getViewport().add(message);
    scrollPane.setSize(400, 200);
    scrollPane.setPreferredSize(new java.awt.Dimension(400, 200));
    UIUtil.jGridBagAdd(p, scrollPane, gBC, GridBagConstraints.REMAINDER);

    JOptionPane.showMessageDialog(parent, p, "Change log", JOptionPane.PLAIN_MESSAGE,
            getApplicationLargeIcon());
}

From source file:de.interactive_instruments.ShapeChange.UI.DefaultDialog.java

private Component createTab1() {

    final JPanel mdlPanel = new JPanel();
    mdlField = new JTextField(40);
    String s = options.parameter("inputFile");
    if (s == null)
        s = "";//from w  ww.j av  a 2s .c  om
    mdlField.setText(s);
    mdlPanel.add(mdlField);
    mdlPanel.add(mdlButton = new JButton("Select File"));
    mdlButton.setActionCommand("MDL");
    mdlButton.addActionListener(this);
    mdlPanel.setBorder(
            new TitledBorder(new LineBorder(Color.black), "Model file", TitledBorder.LEFT, TitledBorder.TOP));

    final JPanel outPanel = new JPanel();
    outField = new JTextField(40);
    s = options.parameter("outputDirectory");
    if (s == null)
        s = ".";
    outField.setText(s);
    outPanel.add(outField);
    outPanel.add(outButton = new JButton("Select File"));
    outButton.setActionCommand("OUT");
    outButton.addActionListener(this);
    outPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Output directory", TitledBorder.LEFT,
            TitledBorder.TOP));

    final JPanel asPanel = new JPanel();
    asField = new JTextField(49);
    s = options.parameter("appSchemaName");
    if (s == null)
        s = "";
    asField.setText(s);
    asPanel.add(asField);
    asPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Application schema name (optional)",
            TitledBorder.LEFT, TitledBorder.TOP));

    final JPanel startPanel = new JPanel();
    startButton = new JButton("Process Model");
    startButton.setActionCommand("START");
    startButton.addActionListener(this);
    startPanel.add(startButton);
    logButton = new JButton("View Log");
    logButton.setActionCommand("LOG");
    logButton.addActionListener(this);
    logButton.setEnabled(false);
    startPanel.add(logButton);
    exitButton = new JButton("Exit");
    exitButton.setActionCommand("EXIT");
    exitButton.addActionListener(this);
    exitButton.setEnabled(true);
    startPanel.add(exitButton);

    Box fileBox = Box.createVerticalBox();
    fileBox.add(mdlPanel);
    fileBox.add(asPanel);
    fileBox.add(outPanel);
    fileBox.add(startPanel);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(fileBox, BorderLayout.CENTER);

    return panel;
}

From source file:net.sf.xmm.moviemanager.gui.DialogIMDB.java

private JPanel createButtonsPanel() {

    JPanel panelButtons = new JPanel();
    panelButtons
            .setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5), null));
    panelButtons.setLayout(new BorderLayout());

    /* regular Buttons panel...*/
    JPanel panelRegularButtons = new JPanel();
    panelRegularButtons.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0));
    panelRegularButtons.setLayout(new FlowLayout());

    buttonSelect = new JButton(Localizer.get("DialogIMDB.button.select.text")); //$NON-NLS-1$
    buttonSelect.setToolTipText(Localizer.get("DialogIMDB.button.select.tooltip")); //$NON-NLS-1$
    buttonSelect.setActionCommand("GetIMDBInfo - Select"); //$NON-NLS-1$
    buttonSelect.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$

            if (!getMoviesList().isSelectionEmpty())
                executeCommandSelect();/*  w  ww .ja va2s . c  o m*/
        }
    });

    panelRegularButtons.add(buttonSelect);

    // Search button
    buttonSearch = new JButton(Localizer.get("DialogIMDbMultiAdd.button.search.text")); //$NON-NLS-1$
    buttonSearch.setToolTipText(Localizer.get("DialogIMDbMultiAdd.button.search.tooltip")); //$NON-NLS-1$
    buttonSearch.setActionCommand("GetIMDBInfo - Search again"); //$NON-NLS-1$
    buttonSearch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$
            executeSearch();
        }
    });

    panelRegularButtons.add(buttonSearch);

    // cancel button
    buttonCancel = new JButton(Localizer.get("DialogIMDB.button.cancel.text.cancel")); //$NON-NLS-1$
    buttonCancel.setToolTipText(Localizer.get("DialogIMDB.button.cancel.tooltip.cancel")); //$NON-NLS-1$

    buttonCancel.setActionCommand("GetIMDBInfo - Cancel"); //$NON-NLS-1$

    buttonCancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$
            canceled = true;
            dispose();
        }
    });

    panelRegularButtons.add(buttonCancel);
    panelButtons.add(panelRegularButtons, BorderLayout.SOUTH);

    return panelButtons;
}

From source file:com.mirth.connect.connectors.file.AdvancedSftpSettingsDialog.java

private void initLayout() {
    JPanel propertiesPanel = new JPanel(
            new MigLayout("insets 12, novisualpadding, hidemode 3, fillx", "[right][left]"));
    propertiesPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    propertiesPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 1, 1, 1, new Color(204, 204, 204)), "SFTP Settings",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    propertiesPanel.add(authenticationLabel);
    propertiesPanel.add(usePasswordRadio, "split 3");
    propertiesPanel.add(usePrivateKeyRadio);
    propertiesPanel.add(useBothRadio, "push, wrap");

    propertiesPanel.add(keyLocationLabel);
    propertiesPanel.add(keyLocationField, "w 200!, wrap");

    propertiesPanel.add(passphraseLabel);
    propertiesPanel.add(passphraseField, "w 125!, wrap");

    propertiesPanel.add(useKnownHostsLabel);
    propertiesPanel.add(useKnownHostsYesRadio, "split 3");
    propertiesPanel.add(useKnownHostsAskRadio);
    propertiesPanel.add(useKnownHostsNoRadio, "push, wrap");

    propertiesPanel.add(knownHostsLocationLabel);
    propertiesPanel.add(knownHostsField, "w 200!, wrap");

    propertiesPanel.add(configurationsLabel, "aligny top");
    propertiesPanel.add(configurationsScrollPane, "span, grow, split 2");

    JPanel configurationsButtonPanel = new JPanel(new MigLayout("insets 0, novisualpadding, hidemode 3, fill"));
    configurationsButtonPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    configurationsButtonPanel.add(newButton, "w 50!, wrap");
    configurationsButtonPanel.add(deleteButton, "w 50!");

    propertiesPanel.add(configurationsButtonPanel, "top");

    add(propertiesPanel, "grow, push, top, wrap");

    JPanel buttonPanel = new JPanel(new MigLayout("insets 0 8 8 8, novisualpadding, hidemode 3, fill"));
    buttonPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    buttonPanel.add(new JSeparator(), "growx, sx, wrap");
    buttonPanel.add(okButton, "newline, w 50!, sx, right, split");
    buttonPanel.add(cancelButton, "w 50!");

    add(buttonPanel, "south, span");
}