Example usage for javax.swing JList getLayoutOrientation

List of usage examples for javax.swing JList getLayoutOrientation

Introduction

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

Prototype

public int getLayoutOrientation() 

Source Link

Document

Returns the layout orientation property for the list: VERTICAL if the layout is a single column of cells, VERTICAL_WRAP if the layout is "newspaper style" with the content flowing vertically then horizontally, or HORIZONTAL_WRAP if the layout is "newspaper style" with the content flowing horizontally then vertically.

Usage

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);

    // The default layout orientation is JList.VERTICAL
    int orient = list.getLayoutOrientation();

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