Example usage for javax.swing JScrollPane JScrollPane

List of usage examples for javax.swing JScrollPane JScrollPane

Introduction

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

Prototype

public JScrollPane(Component view) 

Source Link

Document

Creates a JScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JList list = new JList();
    JScrollPane scrollableList = new JScrollPane(list);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTextArea textArea = new JTextArea();
    JScrollPane pane = new JScrollPane(textArea);
    pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTextArea textArea = new JTextArea();
    JScrollPane pane = new JScrollPane(textArea);
    pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTextArea textArea = new JTextArea();
    JScrollPane pane = new JScrollPane(textArea);

    // Get the default scrollbar policy
    int hpolicy = pane.getHorizontalScrollBarPolicy();
    // JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;

    int vpolicy = pane.getVerticalScrollBarPolicy();
    // JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED;
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String[] items = { "A", "B", "C", "D" };
    JList list = new JList(items);
    JScrollPane scrollingList = new JScrollPane(list);

    // Change orientation to top-to-bottom, left-to-right layout
    list.setLayoutOrientation(JList.VERTICAL);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String[] items = { "A", "B", "C", "D" };
    JList list = new JList(items);
    JScrollPane scrollingList = new JScrollPane(list);

    // Change orientation to top-to-bottom, left-to-right layout
    list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String[] items = { "A", "B", "C", "D" };
    JList list = new JList(items);
    JScrollPane scrollingList = new JScrollPane(list);

    // Change orientation to top-to-bottom, left-to-right layout
    list.setLayoutOrientation(JList.VERTICAL_WRAP);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String[] items = { "A", "B", "C", "D" };
    JList list = new JList(items);
    JScrollPane scrollingList = new JScrollPane(list);

    // Make the number of rows dynamic
    list.setVisibleRowCount(0);/* www  .  j a v  a2s . com*/

}

From source file:Main.java

public static void main(String[] args) {
    JTree tree = new JTree();
    tree.setVisibleRowCount(10);// ww w  . ja  v a2  s  .  c o m
    JOptionPane.showMessageDialog(null, new JScrollPane(tree));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    // Create a scrollable text area
    JTextArea textArea = new JTextArea();
    JScrollPane scrollableTextArea = new JScrollPane(textArea);
}