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:MainClass.java

protected void configureEnclosingScrollPane() {
    Container container = getParent();
    if (container instanceof JViewport) {
        Container viewParent = container.getParent();
        if (viewParent instanceof JScrollPane) {
            JScrollPane scrollPane = (JScrollPane) viewParent;
            JViewport viewport = scrollPane.getViewport();
            if (viewport == null || viewport.getView() != this) {
                return;
            }//from  w  ww  .j  a v  a2s . c om
            scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder"));
        }
    }
}

From source file:SimpleHelp.java

public SimpleHelp(String windowName, String helpIndexFileName) {
    super(windowName + " Help Window");
    cp = getContentPane();/*from ww w.j  a  v  a2  s  .co  m*/
    getAccessibleContext().setAccessibleName(windowName + " Help Window");
    getAccessibleContext().setAccessibleDescription(
            "A window for viewing the help for " + windowName + ", which is somewhat hyperlinked.");

    try {
        URL url = new File(helpIndexFileName).toURL();
        // Only create the window once.
        if (help == null) {
            // System.out.println("Creat-ing help window for " + url);
            help = new JEditorPane(url);
            // System.out.println("Done!");
            help.setEditable(false);
            help.addHyperlinkListener(this);
            JScrollPane scroller = new JScrollPane();
            scroller.setBorder(BorderFactory.createTitledBorder(windowName + " Help"));
            scroller.getViewport().add(help);
            cp.add(BorderLayout.CENTER, scroller);
            addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    SimpleHelp.this.setVisible(false);
                    SimpleHelp.this.dispose();
                }
            });
            setSize(500, 400);
        } else {
            System.out.println("Re-using help window!");
        }
    } catch (MalformedURLException e) {
        System.out.println("Malformed URL: " + e);
    } catch (IOException e) {
        System.out.println("IOException: " + e);
    }
}

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

public TaggingPanel(final Collection<String> initialTags) {
    super(new BorderLayout());

    for (final String tag : initialTags) {
        taglist.addTag(new TagItem(tag));
    }//from   w  w  w.j a  va 2s  . c om
    final BetterTextField inputField = new BetterTextField();
    addTagActionListener = new AddTagActionListener(inputField);
    inputField.addActionListener(addTagActionListener);
    final String hint = "Type a tag and press enter";
    inputField.setPlaceHolder(hint);
    inputField.setToolTipText(hint);
    inputField.setInputVerifier(new TagInputVerifier(inputField));
    inputField.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0),
            BorderFactory.createBevelBorder(BevelBorder.LOWERED)));

    taglist.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

    final JScrollPane tagScrollPane = new JScrollPane(taglist);
    tagScrollPane.setBorder(null);

    final JPanel centerPanel = new JPanel(new BorderLayout());
    centerPanel.add(inputField, BorderLayout.NORTH);
    centerPanel.add(tagScrollPane, BorderLayout.CENTER);
    centerPanel.setMaximumSize(new Dimension(250, 500));
    centerPanel.setPreferredSize(new Dimension(200, 200));

    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    add(Box.createHorizontalGlue());
    add(centerPanel);
    add(Box.createHorizontalGlue());

}

From source file:de.codesourcery.eve.skills.ui.components.ListEditingComponent.java

@Override
protected final JPanel createPanel() {

    final JPanel result = new JPanel();

    result.setLayout(new BorderLayout());

    final JScrollPane scrollPane = new JScrollPane(list);

    if (!StringUtils.isBlank(getTitle())) {
        scrollPane.setBorder(BorderFactory.createTitledBorder(getTitle()));
    }//from  w  w  w  .jav a 2s . co  m

    scrollPane.setPreferredSize(new Dimension(150, 400));
    result.add(scrollPane, BorderLayout.NORTH);

    final JPanel buttonPanel = new JPanel();

    populateButtonPanel(buttonPanel);

    result.add(buttonPanel, BorderLayout.SOUTH);

    createPanelHook(result);

    return result;
}

From source file:com.choicemaker.cm.modelmaker.gui.panels.HoldVsAccuracyPlotPanel.java

JPanel getPanel(JTable table, String title) {
    JScrollPane pane = new JScrollPane();
    pane.getViewport().add(table);/*from  w w  w .ja v  a  2  s.  c  om*/
    pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5),
            BorderFactory.createLoweredBevelBorder()));
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder(title));
    panel.add(pane, BorderLayout.CENTER);
    return panel;
}

From source file:com.intuit.tank.tools.debugger.RequestResponsePanel.java

public void init() {
    JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
    pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    requestTA = new RTextArea();
    requestTA.setEditable(false);//from w ww.  j av  a  2  s.  com
    requestTA.setAutoscrolls(true);
    requestTA.setHighlightCurrentLine(false);
    JScrollPane sp1 = new JScrollPane(requestTA, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sp1.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    JPanel reqPane = new JPanel(new BorderLayout());
    // JPanel titlePanel = new JPanel(new BorderLayout());
    // titlePanel.add(BorderLayout.WEST, new JLabel("Request:"));
    // JButton saveBT = new JButton(parent.getDebuggerActions().getSaveReqResponseAction());
    // saveBT.setText("");
    // titlePanel.add(BorderLayout.EAST, saveBT);
    reqPane.add(BorderLayout.NORTH, new JLabel("Request:"));
    reqPane.add(BorderLayout.CENTER, sp1);
    pane.setTopComponent(reqPane);

    responseTA = new RTextArea();
    responseTA.setEditable(false);
    responseTA.setAutoscrolls(true);
    responseTA.setHighlightCurrentLine(false);
    JScrollPane sp2 = new JScrollPane(responseTA, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sp2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    JPanel responsePane = new JPanel(new BorderLayout());
    responsePane.add(BorderLayout.NORTH, new JLabel("Response:"));
    responsePane.add(BorderLayout.CENTER, sp2);
    pane.setBottomComponent(responsePane);
    pane.setDividerLocation(0.5D);
    pane.setResizeWeight(0.5D);

    add(pane, BorderLayout.CENTER);
    JPopupMenu popupMenu = new JPopupMenu();
    popupMenu.add(parent.getDebuggerActions().getSaveReqResponseAction());
    requestTA.setPopupMenu(popupMenu);
    responseTA.setPopupMenu(popupMenu);
}

From source file:com.willwinder.universalgcodesender.uielements.macros.MacroActionPanel.java

public MacroActionPanel(BackendAPI backend) {
    if (backend == null) {
        throw new RuntimeException("BackendAPI must be provided.");
    }//w  ww  . ja  v  a 2  s  . co  m
    setMinimumSize(new Dimension(50, 0));
    this.backend = backend;
    backend.addUGSEventListener(this);

    // Insert a scrollpane in case the buttons wont fit.
    JScrollPane scrollPane = new JScrollPane(macroPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    setLayout(new BorderLayout());
    add(scrollPane, BorderLayout.CENTER);
}

From source file:be.ac.ua.comp.scarletnebula.gui.addserverwizard.ChooseImagePage.java

private final JPanel getAllImagesPanel(final CloudProvider provider) {
    final JPanel panel = new JPanel(new BorderLayout());
    final TableRowSorter<MachineImageTableModel> sorter = new TableRowSorter<MachineImageTableModel>(
            allImagesModel);//  w  w  w . j  a  v  a  2  s . c om
    allImagesTable.setRowSorter(sorter);
    allImagesTable.setFillsViewportHeight(true);
    allImagesTable.addMouseListener(new SmartImageModelContextMenuMouseListener(provider, allImagesModel,
            allImagesTable, favoriteImagesPanel.getModel()));

    final JPanel aboveTable = new JPanel(new BorderLayout());
    final JPanel searchPanel = getSearchPanel(sorter);

    aboveTable.add(searchPanel, BorderLayout.NORTH);
    aboveTable.add(throbberPanel, BorderLayout.SOUTH);

    panel.add(aboveTable, BorderLayout.NORTH);

    final JScrollPane tableScrollPane = new JScrollPane(allImagesTable);
    tableScrollPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 20, 10, 20),
            BorderFactory.createBevelBorder(BevelBorder.LOWERED)));

    panel.add(tableScrollPane, BorderLayout.CENTER);

    return panel;
}

From source file:com.clank.launcher.swing.MessageLog.java

private void initComponents() {
    if (colorEnabled) {
        JTextPane text = new JTextPane() {
            @Override//from  w  w  w .jav  a 2  s  . c o  m
            public boolean getScrollableTracksViewportWidth() {
                return true;
            }
        };
        this.textComponent = text;
    } else {
        JTextArea text = new JTextArea();
        this.textComponent = text;
        text.setLineWrap(true);
        text.setWrapStyleWord(true);
    }

    textComponent.setFont(new JLabel().getFont());
    textComponent.setEditable(false);
    textComponent.setComponentPopupMenu(TextFieldPopupMenu.INSTANCE);
    DefaultCaret caret = (DefaultCaret) textComponent.getCaret();
    caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    document = textComponent.getDocument();
    document.addDocumentListener(new LimitLinesDocumentListener(numLines, true));

    JScrollPane scrollText = new JScrollPane(textComponent);
    scrollText.setBorder(null);
    scrollText.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollText.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    add(scrollText, BorderLayout.CENTER);
}

From source file:com.k42b3.sacmis.Sacmis.java

public Sacmis(String path, String file, int exitCode, boolean writerStdIn) throws Exception {
    this.path = path;
    this.file = file;
    this.exitCode = exitCode;
    this.writerStdIn = writerStdIn;

    this.setTitle("sacmis (version: " + ver + ")");

    this.setLocation(100, 100);

    this.setSize(600, 500);

    this.setMinimumSize(this.getSize());

    // arguments/*from   ww  w . j a v  a 2s . c  o m*/
    JPanel panelArgs = new JPanel();

    panelArgs.setLayout(new BorderLayout());

    panelArgs.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    this.args = new Args();

    this.args.setText(file);

    panelArgs.add(this.args, BorderLayout.CENTER);

    this.add(panelArgs, BorderLayout.NORTH);

    // main panel
    JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

    this.in = new In();

    JScrollPane scrIn = new JScrollPane(this.in);

    scrIn.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    scrIn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    scrIn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    sp.add(scrIn);

    this.out = new Out();

    JScrollPane scrOut = new JScrollPane(this.out);

    scrOut.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    scrOut.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    scrOut.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    sp.add(scrOut);

    this.add(sp, BorderLayout.CENTER);

    // toolbar
    this.toolbar = new Toolbar();

    this.toolbar.getRun().addActionListener(new runHandler());
    this.toolbar.getReset().addActionListener(new resetHandler());
    this.toolbar.getAbout().addActionListener(new aboutHandler());
    this.toolbar.getExit().addActionListener(new exitHandler());

    this.getContentPane().add(this.toolbar, BorderLayout.SOUTH);

    this.setVisible(true);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    this.loadFile();
}