Example usage for javax.swing JSplitPane HORIZONTAL_SPLIT

List of usage examples for javax.swing JSplitPane HORIZONTAL_SPLIT

Introduction

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

Prototype

int HORIZONTAL_SPLIT

To view the source code for javax.swing JSplitPane HORIZONTAL_SPLIT.

Click Source Link

Document

Horizontal split indicates the Components are split along the x axis.

Usage

From source file:SplitSample.java

public SplitSample() {
    super("Simple Split Pane");
    setSize(400, 400);//from w ww  .ja  v  a  2  s .c o  m
    getContentPane().setLayout(new BorderLayout());

    JSplitPane spLeft = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JPanel(), new JPanel());
    spLeft.setDividerSize(8);
    spLeft.setContinuousLayout(true);

    JSplitPane spRight = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JPanel(), new JPanel());
    spRight.setDividerSize(8);
    spRight.setContinuousLayout(true);

    split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, spLeft, spRight);
    split.setContinuousLayout(false);
    split.setOneTouchExpandable(true);

    getContentPane().add(split, BorderLayout.CENTER);

    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(wndCloser);

    setVisible(true);
}

From source file:SimpleSplitPane.java

public SimpleSplitPane() {
    super("Simple SplitPane Frame");
    setSize(450, 200);//from   w w w  . j  a v  a2s  .c o  m
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JTextArea jt1 = new JTextArea(sometext);
    JTextArea jt2 = new JTextArea(sometext);

    // Make sure our text boxes do line wrapping and have reasonable
    // minimum sizes.
    jt1.setLineWrap(true);
    jt2.setLineWrap(true);
    jt1.setMinimumSize(new Dimension(150, 150));
    jt2.setMinimumSize(new Dimension(150, 150));
    jt1.setPreferredSize(new Dimension(250, 200));
    JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jt1, jt2);
    getContentPane().add(sp, BorderLayout.CENTER);
}

From source file:FileTreeFrame.java

public FileTreeFrame(String directory) {
    super("JTree FileSystem Viewer");
    fileDetailsTextArea.setEditable(false);
    fileSystemModel = new FileSystemModel(new File(directory));
    fileTree = new JTree(fileSystemModel);
    fileTree.setEditable(true);/*from www  .  j  a  v a 2s .com*/
    fileTree.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent event) {
            File file = (File) fileTree.getLastSelectedPathComponent();
            fileDetailsTextArea.setText(getFileDetails(file));
        }
    });
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(fileTree),
            new JScrollPane(fileDetailsTextArea));
    getContentPane().add(splitPane);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(640, 480);
    setVisible(true);
}

From source file:Main.java

public static int getSplitPaneSize(JSplitPane splitPane) {
    if (splitPane == null)
        return 0;

    boolean horiz = splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? true : false;
    return horiz ? splitPane.getWidth() : splitPane.getHeight();
}

From source file:commonline.query.gui.Frame.java

private void initializeView(ExecuteScriptAction executeScriptAction, Action stopScriptAction) {
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new DatabaseStructurePanel(),
            new QueryPanel(executeScriptAction, stopScriptAction));
    split.setDividerLocation(200);//from   w  w  w  .  ja v a  2  s .c  o m

    getContentPane().add(split, BorderLayout.CENTER);
}

From source file:org.jfree.chart.demo.selection.SelectionDemo6Pie.java

public SelectionDemo6Pie(String title) {
    super(title);
    JPanel chartPanel = createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(700, 500));

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.add(chartPanel);// w  w w  . j  a v a  2 s. c o m

    this.model = new DefaultTableModel(new String[] { "section", "value:" }, 0);
    this.table = new JTable(this.model);
    TableColumnModel tcm = this.table.getColumnModel();
    JPanel p = new JPanel(new BorderLayout());
    JScrollPane scroller = new JScrollPane(this.table);
    p.add(scroller);
    p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "),
            new EmptyBorder(4, 4, 4, 4)));
    split.add(p);
    setContentPane(split);
}

From source file:gchisto.gui.panels.gcdistribution.ChartPanelAll.java

/**
 * It creates a chart for the given dataset and adds the chart to the panel.
 *
 * @param dataset The dataset that will provide the values for the chart.
 *//*from  ww  w.j  av a2s  .  co m*/
private void addChart(XYDatasetWithGroups dataset) {
    assert dataset != null;

    JFreeChart chart = ChartFactory.createXYAreaChart(getTitle(), "Buckets (sec)", "Count", dataset,
            PlotOrientation.VERTICAL, true, true, false);

    // null so that we can get it compiled; we'll get back to this...
    GroupActivatingPanel table = new GroupActivatingPanel(dataset, null);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, table,
            new org.jfree.chart.ChartPanel(chart));
    splitPane.setDividerLocation(200);
    mainPanel().add(BorderLayout.CENTER, splitPane);
}

From source file:org.jfree.chart.demo.selection.SelectionDemo8.java

/**
 * A demonstration application showing how to create a simple time series
 * chart. This example uses monthly data.
 *
 * @param title  the frame title./*from  w  ww.j  av  a2 s  .  co  m*/
 */
public SelectionDemo8(String title) {
    super(title);
    ChartPanel chartPanel = (ChartPanel) createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    chartPanel.setRangeZoomable(false);

    JFreeChart chart = chartPanel.getChart();
    XYPlot plot = (XYPlot) chart.getPlot();
    this.dataset = (TimeSeriesCollection) plot.getDataset();
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.add(chartPanel);

    this.model = new DefaultTableModel(new String[] { "Series:", "Item:", "Period:", "Value:" }, 0);
    this.table = new JTable(this.model);
    TableColumnModel tcm = this.table.getColumnModel();
    tcm.getColumn(3).setCellRenderer(new NumberCellRenderer());
    JPanel p = new JPanel(new BorderLayout());
    JScrollPane scroller = new JScrollPane(this.table);
    p.add(scroller);
    p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "),
            new EmptyBorder(4, 4, 4, 4)));
    split.add(p);
    setContentPane(split);

}

From source file:components.SplitPaneDividerDemo.java

public SplitPaneDividerDemo() {
    super(new BorderLayout());

    Font font = new Font("Serif", Font.ITALIC, 24);

    ImageIcon icon = createImageIcon("images/Cat.gif");
    SizeDisplayer sd1 = new SizeDisplayer("left", icon);
    sd1.setMinimumSize(new Dimension(30, 30));
    sd1.setFont(font);/* w  w  w. ja  v  a  2s  .  c  o  m*/

    icon = createImageIcon("images/Dog.gif");
    SizeDisplayer sd2 = new SizeDisplayer("right", icon);
    sd2.setMinimumSize(new Dimension(60, 60));
    sd2.setFont(font);

    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sd1, sd2);
    splitPane.setResizeWeight(0.5);
    splitPane.setOneTouchExpandable(true);
    splitPane.setContinuousLayout(true);

    add(splitPane, BorderLayout.CENTER);
    add(createControlPanel(), BorderLayout.PAGE_END);
}

From source file:SplitPaneTest.java

public SplitPaneFrame() {
    setTitle("SplitPaneTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // set up components for planet names, images, descriptions

    final JList planetList = new JList(planets);
    final JLabel planetImage = new JLabel();
    final JTextArea planetDescription = new JTextArea();

    planetList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent event) {
            Planet value = (Planet) planetList.getSelectedValue();

            // update image and description

            planetImage.setIcon(value.getImage());
            planetDescription.setText(value.getDescription());
        }/*from  w  w w .j av a 2s  . com*/
    });

    // set up split panes

    JSplitPane innerPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, planetList, planetImage);

    innerPane.setContinuousLayout(true);
    innerPane.setOneTouchExpandable(true);

    JSplitPane outerPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, innerPane, planetDescription);

    add(outerPane, BorderLayout.CENTER);
}