Example usage for javax.swing JScrollPane setBorder

List of usage examples for javax.swing JScrollPane setBorder

Introduction

In this page you can find the example usage for javax.swing JScrollPane 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:com.floreantpos.config.ui.DatabaseConfigurationView.java

protected void initUI() {
    setLayout(new BorderLayout());

    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new MigLayout("fill", "[][grow,fill]", "[][][][][][][][grow,fill]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    tfServerAddress = new POSTextField();
    tfServerPort = new POSTextField();
    tfDatabaseName = new POSTextField();
    tfUserName = new POSTextField();
    tfPassword = new POSPasswordField();
    databaseCombo = new JComboBox(Database.values());

    String databaseProviderName = AppConfig.getDatabaseProviderName();
    if (StringUtils.isNotEmpty(databaseProviderName)) {
        databaseCombo.setSelectedItem(Database.getByProviderName(databaseProviderName));
    }/*from ww w.java  2s . c om*/

    contentPanel.add(new JLabel(Messages.getString("DatabaseConfigurationDialog.8"))); //$NON-NLS-1$
    contentPanel.add(databaseCombo, "grow, wrap"); //$NON-NLS-1$
    lblServerAddress = new JLabel(Messages.getString("DatabaseConfigurationDialog.10") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblServerAddress);
    contentPanel.add(tfServerAddress, "grow, wrap"); //$NON-NLS-1$
    lblServerPort = new JLabel(Messages.getString("DatabaseConfigurationDialog.13") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblServerPort);
    contentPanel.add(tfServerPort, "grow, wrap"); //$NON-NLS-1$
    lblDbName = new JLabel(Messages.getString("DatabaseConfigurationDialog.16") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblDbName);
    contentPanel.add(tfDatabaseName, "grow, wrap"); //$NON-NLS-1$
    lblUserName = new JLabel(Messages.getString("DatabaseConfigurationDialog.19") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblUserName);
    contentPanel.add(tfUserName, "grow, wrap"); //$NON-NLS-1$
    lblDbPassword = new JLabel(Messages.getString("DatabaseConfigurationDialog.22") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblDbPassword);
    contentPanel.add(tfPassword, "grow, wrap"); //$NON-NLS-1$
    contentPanel.add(new JSeparator(), "span, grow, gaptop 10"); //$NON-NLS-1$

    btnTestConnection = new JButton(Messages.getString("DatabaseConfigurationDialog.26")); //$NON-NLS-1$
    btnTestConnection.setActionCommand(TEST);
    btnSave = new JButton(Messages.getString("DatabaseConfigurationDialog.27")); //$NON-NLS-1$
    btnSave.setActionCommand(SAVE);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    btnCreateDb = new JButton(Messages.getString("DatabaseConfigurationDialog.29")); //$NON-NLS-1$
    btnCreateDb.setActionCommand(CONFIGURE_DB);
    buttonPanel.add(btnCreateDb);
    buttonPanel.add(btnTestConnection);
    buttonPanel.add(btnSave);

    contentPanel.add(buttonPanel, "span, grow"); //$NON-NLS-1$

    JScrollPane scrollPane = new JScrollPane(contentPanel);
    scrollPane.setBorder(null);
    add(scrollPane);
}

From source file:edu.ku.brc.af.ui.db.ViewBasedDisplayFrame.java

@Override
public void createUI() {
    setBackground(viewBasedPanel.getBackground());

    JScrollPane scrollPane = UIHelper.createScrollPane(viewBasedPanel, true);
    scrollPane.setBorder(BorderFactory.createLineBorder(getBackground(), 8));
    contentPanel = scrollPane;//from   w  w  w. j  ava2 s .c  om

    super.createUI();

    viewBasedPanel.setOkCancelBtns(okBtn, cancelBtn);

    Integer width = (Integer) UIManager.get("ScrollBar.width");
    if (width == null) {
        width = (new JScrollBar()).getPreferredSize().width;
    }

    Dimension dim1 = getPreferredSize();
    dim1.height += width * 2;
    if (!UIHelper.isMacOS()) {
        dim1.width += width;
    }
    setSize(dim1);

    if (cancelBtn != null) {
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                cancelBtn.doClick();
            }
        });
    } else if (okBtn != null) {
        okBtn.setEnabled(true);
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                okBtn.doClick();
            }
        });
    }

    viewBasedPanel.setOkCancelBtns(okBtn, cancelBtn);

    addAL(okBtn);
    addAL(cancelBtn);
    addAL(applyBtn);
    addAL(helpBtn);
}

From source file:es.emergya.ui.gis.popups.ListaCapas.java

private ListaCapas(CustomMapView mapView, final IMapViewer historyMapViewer) {
    super();//from  w  w  w.ja v a  2 s  . c  om
    setTitle(i18n.getString("window.gpx.titleBar"));
    setLocationRelativeTo(getBasicWindow().getFrame());
    setResizable(false);
    setAlwaysOnTop(true);
    this.mapView = mapView;
    this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setIconImage(getBasicWindow().getFrame().getIconImage());
    JPanel dialogo = new JPanel(new BorderLayout());
    dialogo.setBackground(Color.WHITE);
    dialogo.setBorder(new EmptyBorder(10, 10, 10, 10));

    capasGpx = new JPanel();
    capasGpx.setBackground(Color.WHITE);
    capasGpx.setLayout(new BoxLayout(capasGpx, BoxLayout.Y_AXIS));

    JScrollPane lista = new JScrollPane(capasGpx);
    lista.setOpaque(false);
    lista.setBorder(new TitledBorder(i18n.getString("window.gpx.title")));
    dialogo.add(lista, BorderLayout.CENTER);

    JPanel boton = new JPanel(new FlowLayout());
    boton.setOpaque(false);
    JButton cargar = getCargarGPXButton();
    boton.add(cargar, FlowLayout.LEFT);
    dialogo.add(boton, BorderLayout.SOUTH);

    add(dialogo);
    setPreferredSize(new Dimension(400, 250));
    pack();
    setLocationRelativeTo((Component) mapView);

    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            super.windowClosed(e);
            // historyMapViewer.getGPXButton().setSelected(false);
        }
    });

}

From source file:com.ixora.common.ui.ShowExceptionDialog.java

/**
 * Initializes this dialog.//  w w w  .  j ava2  s.  co m
 */
private void initialize() {
    this.eventHandler = new EventHandler();
    setSize(smallSize);
    setTitle(MessageRepository.get(Msg.COMMON_UI_TEXT_ERROR));
    if (isDefaultLookAndFeelDecorated()) {
        getRootPane().setWindowDecorationStyle(JRootPane.ERROR_DIALOG);
    }
    textExceptionLong = UIFactoryMgr.createHtmlPane();
    textExceptionLong.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    textExceptionLong.setEditable(false);
    textExceptionLong.addHyperlinkListener(this.eventHandler);
    textExceptionShort = UIFactoryMgr.createTextField();
    textExceptionShort.setHorizontalAlignment(JTextField.CENTER);
    textExceptionShort.setBorder(null);
    textExceptionShort.setEditable(false);

    panel = new JPanel(new CardLayout());
    JScrollPane s = UIFactoryMgr.createScrollPane();
    s.setBorder(null);
    s.setViewportView(textExceptionLong);
    panel.add(s, "long");
    panel.add(textExceptionShort, "short");

    // set background color to the color of the panel
    textExceptionShort.setBackground(panel.getBackground());
    textExceptionLong.setBackground(panel.getBackground());

    buildContentPane();
}

From source file:com.rapidminer.gui.plotter.PlotterPanel.java

public PlotterPanel(final PlotterConfigurationModel settings) {
    super(new BorderLayout());
    this.controlPanel = new PlotterControlPanel(settings);
    this.settings = settings;
    settings.registerPlotterListener(new PlotterChangedListener() {

        @Override//w  w  w  . ja v  a 2s  .  co  m
        public void plotterChanged(String plotterName) {
            if (plotterName != null) {
                ActionStatisticsCollector.getInstance().log(ActionStatisticsCollector.TYPE_CHART, plotterName,
                        "select");
            }
            if (oldPlotterComponent != null) {
                mainPanel.remove(oldPlotterComponent);
            }
            JComponent plotterComponent = settings.getPlotter().getPlotter();
            if (plotterComponent != null) {
                mainPanel.add(plotterComponent, BorderLayout.CENTER);
                oldPlotterComponent = plotterComponent;
            }
            repaint();
            revalidate();
        }

        @Override
        public List<PlotterSettingsChangedListener> getListeningObjects() {
            return new ArrayList<>(0);
        }
    });
    JScrollPane plotterScrollPane = new ExtendedJScrollPane(mainPanel);
    settings.registerPlotterListener(controlPanel);
    mainPanel.add(controlPanel, BorderLayout.WEST);
    plotterScrollPane.setBorder(null);

    add(plotterScrollPane, BorderLayout.CENTER);

    JComponent plotterComponent = settings.getPlotter().getPlotter();
    if (plotterComponent != null) {
        mainPanel.add(plotterComponent, BorderLayout.CENTER);
        oldPlotterComponent = plotterComponent;
    }
    repaint();
    revalidate();
}

From source file:com.apatar.webdav.ui.JWebDavTreeModePanel.java

private JPanel getFoldersPanel() {
    JPanel panel = new JPanel();
    panel.setOpaque(false);// w  w  w  .jav a  2  s. c  o m

    JScrollPane srollPane = new JScrollPane(createFolderTable());
    srollPane.setPreferredSize(new Dimension(470, 320));
    srollPane.setBorder(null);

    panel.add(srollPane);

    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:edu.ku.brc.af.ui.db.ViewBasedDisplayDialog.java

@Override
public void createUI() {
    setBackground(viewBasedPanel.getBackground());

    JScrollPane scrollPane = UIHelper.createScrollPane(viewBasedPanel, true);
    scrollPane.setBorder(BorderFactory.createLineBorder(getBackground(), 8));
    contentPanel = scrollPane;//w  w  w  . j av  a2s  .  c  o  m

    super.createUI();

    viewBasedPanel.setOkCancelBtns(okBtn, cancelBtn);

    Integer width = (Integer) UIManager.get("ScrollBar.width");
    if (width == null) {
        width = (new JScrollBar()).getPreferredSize().width;
    }

    Dimension dim1 = getPreferredSize();
    dim1.height += width * 2;
    if (!UIHelper.isMacOS()) {
        dim1.width += width;
    }
    setSize(dim1);
}

From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java

private final JPanel getMainPanel() {
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
    final ServerList linkedServerList = new ServerList(linkedServerListModel);
    linkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane linkedServerScrollPane = new JScrollPane(linkedServerList);
    linkedServerScrollPane
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Linked Servers"));
    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    linkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final GridBagConstraints c = new GridBagConstraints();

    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;/*w w w. j av  a2 s .com*/
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(linkedServerScrollPane, c);

    final ServerList unlinkedServerList = new ServerList(unlinkedServerListModel);
    unlinkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane unlinkedServerScrollPane = new JScrollPane(unlinkedServerList);
    unlinkedServerScrollPane
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Unlinked Servers"));

    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    unlinkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final JPanel middlePanel = new JPanel();
    middlePanel.setLayout(new BoxLayout(middlePanel, BoxLayout.Y_AXIS));
    middlePanel.add(Box.createVerticalGlue());

    final JButton linkSelectionButton = new JButton("<");
    final JButton unlinkSelectionButton = new JButton(">");

    linkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from unlinked to linked list
            final int selection = unlinkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final Server server = unlinkedServerListModel.getVisibleServerAtIndex(selection);

            unlinkedServerListModel.removeServer(server);

            linkedServerListModel.addServer(server);
        }
    });

    unlinkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from linked to unlinked list
            final int selection = linkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final int answer = JOptionPane.showOptionDialog(LinkUnlinkWindow.this,
                    "You are about to unlink a server. "
                            + "Unlinking a server will permanently remove \nall data associated with "
                            + "this server, but the server will keep running. "
                            + "\n\nAre you sure you wish to continue?",
                    "Unlink Server", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);

            if (answer != JOptionPane.YES_OPTION) {
                return;
            }

            final Server server = linkedServerListModel.getVisibleServerAtIndex(selection);

            linkedServerListModel.removeServer(server);

            unlinkedServerListModel.addServer(server);
        }
    });

    middlePanel.add(unlinkSelectionButton);
    middlePanel.add(Box.createVerticalStrut(10));
    middlePanel.add(linkSelectionButton);
    middlePanel.add(Box.createVerticalGlue());

    c.gridx = 1;
    c.gridy = 0;
    c.weightx = 0.0;
    c.weighty = 0.0;

    mainPanel.add(middlePanel, c);

    c.gridx = 2;
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(unlinkedServerScrollPane, c);
    return mainPanel;
}

From source file:org.esa.beam.visat.toolviews.stat.ChartPagePanel.java

protected void createUI(final ChartPanel chartPanel, final JPanel optionsPanel, BindingContext bindingContext) {
    roiMaskSelector = new RoiMaskSelector(bindingContext);

    final JPanel extendedOptionsPanel = GridBagUtils.createPanel();
    GridBagConstraints extendedOptionsPanelConstraints = GridBagUtils.createConstraints(
            "insets.left=4,insets.right=2,anchor=NORTHWEST,fill=HORIZONTAL,insets.top=2,weightx=1");
    GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints, "gridy=0");
    GridBagUtils.addToPanel(extendedOptionsPanel, roiMaskSelector.createPanel(),
            extendedOptionsPanelConstraints, "gridy=1,insets.left=-4");
    GridBagUtils.addToPanel(extendedOptionsPanel, optionsPanel, extendedOptionsPanelConstraints,
            "insets.left=0,insets.right=0,gridy=2,fill=VERTICAL,fill=HORIZONTAL,weighty=1");
    GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints,
            "insets.left=4,insets.right=2,gridy=5,anchor=SOUTHWEST");

    final JScrollPane optionsScrollPane = new SimpleScrollPane(extendedOptionsPanel,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    optionsScrollPane.setBorder(null);

    final JPanel rightPanel = new JPanel(new BorderLayout());
    rightPanel.add(createTopPanel(), BorderLayout.NORTH);
    rightPanel.add(optionsScrollPane, BorderLayout.CENTER);
    rightPanel.add(createChartBottomPanel(chartPanel), BorderLayout.SOUTH);

    final ImageIcon collapseIcon = UIUtils.loadImageIcon("icons/PanelRight12.png");
    final ImageIcon collapseRolloverIcon = ToolButtonFactory.createRolloverIcon(collapseIcon);
    final ImageIcon expandIcon = UIUtils.loadImageIcon("icons/PanelLeft12.png");
    final ImageIcon expandRolloverIcon = ToolButtonFactory.createRolloverIcon(expandIcon);

    hideAndShowButton = ToolButtonFactory.createButton(collapseIcon, false);
    hideAndShowButton.setToolTipText("Collapse Options Panel");
    hideAndShowButton.setName("switchToChartButton");
    hideAndShowButton.addActionListener(new ActionListener() {

        public boolean rightPanelShown;

        @Override//from   w ww.  ja v a  2s .  com
        public void actionPerformed(ActionEvent e) {
            rightPanel.setVisible(rightPanelShown);
            if (rightPanelShown) {
                hideAndShowButton.setIcon(collapseIcon);
                hideAndShowButton.setRolloverIcon(collapseRolloverIcon);
                hideAndShowButton.setToolTipText("Collapse Options Panel");
            } else {
                hideAndShowButton.setIcon(expandIcon);
                hideAndShowButton.setRolloverIcon(expandRolloverIcon);
                hideAndShowButton.setToolTipText("Expand Options Panel");
            }
            rightPanelShown = !rightPanelShown;
        }
    });

    backgroundPanel = new JPanel(new BorderLayout());
    backgroundPanel.add(chartPanel, BorderLayout.CENTER);
    backgroundPanel.add(rightPanel, BorderLayout.EAST);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.add(backgroundPanel, new Integer(0));
    layeredPane.add(hideAndShowButton, new Integer(1));
    add(layeredPane);
}