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:edu.ucla.stat.SOCR.applications.demo.StockSimulationApplication.java

void updateGraph() {
    //System.out.println("UpdateGraph get called")
    calculate();//w  ww.j a v a 2  s  . com

    XYSeriesCollection ds = createDataset();

    JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
            xAxis, // x axis label
            yAxis, // y axis label
            ds, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );
    chart.setBackgroundPaint(Color.white);
    XYPlot subplot1 = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) subplot1.getRenderer();

    renderer1.setSeriesPaint(0, Color.red);
    renderer1.setSeriesPaint(1, Color.blue);
    renderer1.setSeriesPaint(2, Color.green);
    renderer1.setSeriesPaint(3, Color.gray);

    /* Shape shape = renderer1.getBaseShape();
     renderer1.setSeriesShape(2, shape);
     renderer1.setSeriesShape(3, shape);*/
    renderer1.setBaseLinesVisible(true);
    renderer1.setBaseShapesVisible(true);
    renderer1.setBaseShapesFilled(true);

    chartPanel = new ChartPanel(chart, false);
    chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y));

    upContainer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel),
            new JScrollPane(chartPanel));

    this.getMainPanel().removeAll();
    this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER);
    this.getMainPanel().validate();
    //  getRecordTable().setText("Any Explaination goes here.");

    //
}

From source file:it.unibas.spicygui.vista.JLayeredPaneCorrespondences.java

private void createComponents() {
    this.pannelloPrincipale = new javax.swing.JPanel();
    this.pannelloPrincipale.setLayout(new java.awt.BorderLayout());
    this.glassPane = new GraphSceneGlassPane();
    this.intermediatePanel = new JPanel();
    this.intermediatePanel.setName(Costanti.INTERMEDIE);
    this.intermediatePanel.setLayout(new AbsoluteLayout());
    this.intermediatePanel.setBackground(Costanti.getIntermediateColor());

    this.scrollSource = new JScrollPane();
    this.scrollSource.setMinimumSize(new Dimension(200, getHeight()));
    this.splitChild = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollSource, intermediatePanel);
    //this.splitChild.setOneTouchExpandable(true);

    this.scrollTarget = new JScrollPane();
    this.scrollTarget.setMinimumSize(new Dimension(200, getHeight()));
    this.split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.getSplitChild(), scrollTarget);

    this.pannelloPrincipale.setOpaque(false);
    this.glassPane.setOpaque(false);
    this.setOpaque(false);

    OverlayLayout overlaylayout = new OverlayLayout(this);
    this.setLayout(overlaylayout);

    this.add(this.glassPane);
    this.add(this.pannelloPrincipale);
    this.pannelloPrincipale.add(getSplit());

    setSplitPane();/*from w ww.j  ava2 s.  c  om*/
    initMouseListener();
}

From source file:org.eevolution.form.VCRPDetail.java

private void jbInit() {

    dateFrom = new VDate("DateFrom", true, false, true, DisplayType.Date, "DateFrom");
    dateTo = new VDate("DateTo", true, false, true, DisplayType.Date, "DateTo");

    CPanel northPanel = new CPanel();
    northPanel.setLayout(new java.awt.GridBagLayout());

    northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "S_Resource_ID")), new GridBagConstraints(0, 1, 1, 1,
            0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(resource, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

    northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "DateFrom")), new GridBagConstraints(2, 1, 1, 1, 0.0,
            0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(dateFrom, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

    northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "DateTo")), new GridBagConstraints(4, 1, 1, 1, 0.0,
            0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(dateTo, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

    ConfirmPanel confirmPanel = new ConfirmPanel(true);
    confirmPanel.addActionListener(new ActionHandler());

    contentPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    contentPanel.setPreferredSize(new Dimension(800, 600));

    m_form.getWindow().getContentPane().add(northPanel, BorderLayout.NORTH);
    m_form.getWindow().getContentPane().add(contentPanel, BorderLayout.CENTER);
    m_form.getWindow().getContentPane().add(confirmPanel, BorderLayout.SOUTH);
}

From source file:edu.ucla.stat.SOCR.applications.demo.BlackScholesApplication.java

void updateGraph() {
    //System.out.println("UpdateGraph get called")
    calculate();//from  w  w  w.  ja  v  a  2s. c om

    XYSeriesCollection ds = createDataset();

    JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
            xAxis, // x axis label
            yAxis, // y axis label
            ds, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );
    chart.setBackgroundPaint(Color.white);
    XYPlot subplot1 = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) subplot1.getRenderer();

    renderer1.setSeriesPaint(0, Color.red);
    renderer1.setSeriesPaint(1, Color.blue);

    Shape shape = renderer1.getBaseShape();
    renderer1.setSeriesShape(2, shape);
    renderer1.setSeriesShape(3, shape);
    renderer1.setBaseLinesVisible(true);
    renderer1.setBaseShapesVisible(true);
    renderer1.setBaseShapesFilled(true);
    renderer1.setSeriesShapesVisible(0, false);

    NumberAxis rangeAxis = (NumberAxis) subplot1.getRangeAxis();
    rangeAxis.setAutoRangeIncludesZero(false);

    chartPanel = new ChartPanel(chart, false);
    chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y));

    upContainer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel),
            new JScrollPane(chartPanel));

    this.getMainPanel().removeAll();
    this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER);
    this.getMainPanel().validate();
    //  getRecordTable().setText("Any Explaination goes here.");

    //
}

From source file:net.sf.taverna.t2.workbench.cagrid.CaGridComponent.java

private void addResultPanel() {
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;/*from   w  ww.j  a  v a2s  . c  o  m*/
    c.gridy = ++row;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0.01;
    c.weighty = 0.01;
    c.anchor = GridBagConstraints.SOUTHEAST;
    c.gridwidth = GridBagConstraints.REMAINDER;
    resultPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    resultPanel.setDividerLocation(200);
    resultPanel.setBorder(null);
    runListModel = new DefaultListModel();
    runList = new JList(runListModel);
    runList.setBorder(new EmptyBorder(5, 5, 5, 5));
    runList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    runListPanel = new JPanel(new BorderLayout());
    runListPanel.setBorder(LineBorder.createGrayLineBorder());

    JLabel worklflowRunsLabel = new JLabel("Workflow Runs");
    worklflowRunsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
    removeCaGridRunsButton = new JButton("Remove"); // button to remove previous workflow runs
    removeCaGridRunsButton.setAlignmentX(JComponent.RIGHT_ALIGNMENT);
    removeCaGridRunsButton.setEnabled(false);
    removeCaGridRunsButton.setToolTipText("Remove caGrid run(s)");
    removeCaGridRunsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int[] selected = runList.getSelectedIndices();
            for (int i = selected.length - 1; i >= 0; i--) {
                CaGridRun cr = (CaGridRun) runListModel.get(selected[i]);

                //delete the EPR file
                File file = new File(new File(System.getProperty("user.home")), cr.workflowid + ".epr");
                file.delete();
                System.out.println(cr.workflowid + ".epr deleted");
                runListModel.remove(selected[i]);
            }
            // Set the first item as selected - if there is one
            if (runListModel.size() > 0) {
                runList.setSelectedIndex(0);
            } else {
                resultText.setText("");
                resultText.revalidate();

            }
        }
    });
    runListPanel.add(worklflowRunsLabel, BorderLayout.NORTH);
    runListPanel.add(removeCaGridRunsButton, BorderLayout.BEFORE_FIRST_LINE);

    JScrollPane scrollPane = new JScrollPane(runList);
    scrollPane.setBorder(null);
    runListPanel.add(scrollPane, BorderLayout.CENTER);
    // loadWorkflowRunsFromStoredEPRFiles(): add CaGridRun to runList for each EPR
    // add two buttons: remove and refresh status
    runList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                Object selection = runList.getSelectedValue();
                if (selection instanceof CaGridRun) {
                    removeCaGridRunsButton.setEnabled(true);
                    CaGridRun dataflowRun = (CaGridRun) selection;
                    // update status and refresh outputPanel
                    String resultDisplayString = updateResultDisplayString(dataflowRun);
                    resultText.setText(resultDisplayString);
                    resultText.setLineWrap(true);
                    resultText.setEditable(false);
                    outputPanel.revalidate();
                    revalidate();
                } else {
                    removeCaGridRunsButton.setEnabled(false);
                    revalidate();

                }
            }
        }
    });

    resultPanel.setTopComponent(runListPanel);

    //each output should be a (xml) string
    outputPanel = new JScrollPane();

    resultText = new JTextArea();
    outputPanel = new JScrollPane(resultText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    //outputPanel = new JPanel(new BorderLayout());
    outputPanel.setBorder(LineBorder.createGrayLineBorder());
    outputPanel.setBackground(Color.WHITE);
    //outputPanel.add(new JLabel("Workflow Execution Outputs shows here.", JLabel.CENTER), null);
    resultPanel.setBottomComponent(outputPanel);
    add(resultPanel, c);

    //add runComponent to the GUI
    ArrayList<CaGridRun> loadedRunList = loadWorkflowRunsFromStoredEPRFiles(null,
            (String) services.getSelectedItem());
    if (loadedRunList != null) {
        for (int m = 0; m < loadedRunList.size(); m++) {
            CaGridRun cr = (CaGridRun) loadedRunList.get(m);
            runListModel.add(0, cr);
        }
        System.out.println(loadedRunList.size() + " EPR loaded.");
        runList.setSelectedIndex(0);
    }

}

From source file:be.fedict.eid.tsl.tool.TslInternalFrame.java

private void addServiceProviderTab(JTabbedPane tabbedPane) {
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    tabbedPane.add("Service Providers", splitPane);

    DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Service Providers");
    this.tree = new JTree(rootNode);
    this.tree.addTreeSelectionListener(this);
    for (TrustServiceProvider trustServiceProvider : this.trustServiceList.getTrustServiceProviders()) {
        DefaultMutableTreeNode trustServiceProviderNode = new DefaultMutableTreeNode(
                trustServiceProvider.getName());
        rootNode.add(trustServiceProviderNode);
        for (TrustService trustService : trustServiceProvider.getTrustServices()) {
            MutableTreeNode trustServiceNode = new DefaultMutableTreeNode(trustService);
            trustServiceProviderNode.add(trustServiceNode);
        }//from  ww w . j  a va  2  s.  c  om
    }
    this.tree.expandRow(0);

    JScrollPane treeScrollPane = new JScrollPane(this.tree);
    JPanel detailsPanel = new JPanel();
    splitPane.setLeftComponent(treeScrollPane);
    splitPane.setRightComponent(detailsPanel);

    initDetailsPanel(detailsPanel);
}

From source file:TopLevelTransferHandlerDemo.java

public TopLevelTransferHandlerDemo() {
    super("TopLevelTransferHandlerDemo");
    setJMenuBar(createDummyMenuBar());//from  w ww  .  j a  va 2 s.  c  o m
    getContentPane().add(createDummyToolBar(), BorderLayout.NORTH);

    JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, list, dp);
    sp.setDividerLocation(120);
    getContentPane().add(sp);
    //new Doc("sample.txt");
    //new Doc("sample.txt");
    //new Doc("sample.txt");

    list.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    list.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }

            Doc val = (Doc) list.getSelectedValue();
            if (val != null) {
                val.select();
            }
        }
    });

    final TransferHandler th = list.getTransferHandler();

    nullItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            if (nullItem.isSelected()) {
                list.setTransferHandler(null);
            } else {
                list.setTransferHandler(th);
            }
        }
    });
    thItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            if (thItem.isSelected()) {
                setTransferHandler(handler);
            } else {
                setTransferHandler(null);
            }
        }
    });
    dp.setTransferHandler(handler);
}

From source file:com.diversityarrays.kdxplore.trials.SampleGroupViewer.java

private SampleGroupViewer(String title, KdxploreDatabase kdxdb, Trial trial, SampleGroup sampleGroup) {
    super(new BorderLayout());

    this.title = title;
    //        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    this.kdxdb = kdxdb;
    this.trial = trial;
    this.sampleGroup = sampleGroup;

    initialise();/*from w ww. j  ava  2  s . c  om*/
    if (plotInfoByPlotId.isEmpty()) {
        add(new JLabel("No Plots available"), BorderLayout.CENTER);
    } else {
        tiChoiceTableModel = new TraitInstanceChoiceTableModel();
        JTable tiTable = new JTable(tiChoiceTableModel);
        tiTable.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (SwingUtilities.isRightMouseButton(e)) {
                    List<Integer> modelRows = GuiUtil.getSelectedModelRows(tiTable);
                    if (modelRows.isEmpty()) {
                        Point pt = e.getPoint();
                        int vrow = tiTable.rowAtPoint(pt);
                        if (vrow >= 0) {
                            int mrow = tiTable.convertRowIndexToModel(vrow);
                            if (mrow >= 0) {
                                showPopupMenu(tiTable, pt, Arrays.asList(Integer.valueOf(mrow)));
                            }
                        }
                    } else {
                        showPopupMenu(tiTable, e.getPoint(), modelRows);
                    }
                }
            }
        });

        tableModel = new DataTableModel(plotInfoByPlotId);
        JTable table = new JTable(tableModel);
        DefaultTableCellRenderer r = new DefaultTableCellRenderer();
        r.setHorizontalAlignment(SwingConstants.CENTER);
        table.setDefaultRenderer(String.class, r);

        splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(tiTable),
                new JScrollPane(table));
        splitPane.setResizeWeight(0.2);
        add(splitPane, BorderLayout.CENTER);
        table.setTransferHandler(TableTransferHandler.initialiseForCopySelectAll(table, true));
    }
}

From source file:edu.purdue.cc.bionet.ui.ClusteringDisplayPanel.java

/**
 * Creates the visualization instance for a ClusteringDisplayPanel
 * //from  w  ww. j  ava  2s .co m
 * @param experiments The experiments to be associated with this instance.
 * @return true if creating the visualization succeeded.
 */
public boolean createView(Collection<Experiment> experiments) {
    Logger logger = Logger.getLogger(getClass());
    this.experiments = experiments;
    this.samples = new SampleGroup("");
    this.molecules = new TreeSet<Molecule>();
    for (Experiment experiment : experiments) {
        this.samples.addAll(experiment.getSamples());
        this.molecules.addAll(experiment.getMolecules());
    }
    Collection<SampleGroup> sampleGroups = new ArrayList<SampleGroup>();
    sampleGroups.add(new SampleGroup("", samples));
    this.sampleSelectorTree = new SampleSelectorTreePanel(this.experiments);

    this.splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    this.treeSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    JPanel treePanel = new JPanel(new BorderLayout());
    this.treeSplitPane.setBottomComponent(this.sampleSelectorTree);
    treePanel.add(this.treeSplitPane, BorderLayout.CENTER);
    this.splitPane.setLeftComponent(treePanel);
    this.clusterGraphPanel = new JPanel(new GridLayout(1, 1, 3, 3));
    this.clusterGraphPanel.setBackground(Color.LIGHT_GRAY);
    this.splitPane.setRightComponent(this.clusterGraphPanel);
    this.add(this.splitPane, BorderLayout.CENTER);
    this.splitPane.setDividerLocation(250);

    this.selectorPanel = new JPanel(new GridLayout(1, 1));
    this.treeSplitPane.setTopComponent(this.selectorPanel);
    this.setSampleGroups(sampleGroups);

    return true;
}

From source file:edu.ucla.stat.SOCR.applications.demo.BinomialTradingApplication.java

/**
 * This method initializes the application.
 *///from   www. ja v a2s .c  o  m
public void init() {
    tabbedPanelContainer = new JTabbedPane();

    initJGraphPanel();
    initGraphPanel2();

    addTabbedPane(GRAPH, jgraphPanel);
    //addTabbedPane("GRAPH2", graphPanel2);
    tabbedPanelContainer.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == GRAPH) {
                jgraphPanel.removeAll();
                //setChart();

            } /*else    if(   tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex())==GRAPH2) {
                //               
                //setInputPanel();
              }*/
        }
    });

    /* The following components need to be set
     * 1. Control JPanel
     *       1.a Floating-point Text-Field for So = Price of the stock at time zero, So>=0.
     *       1.b Floating-Point Text-Field for EP = Exercise price (it is exercised at the end if price of stock at the end > EP), EP>=0.
     *       1.c Integer Slider for t = Time until expiration in years, 0<=t<=365.
     *       1.d Floating-Point Text-Field for r = Interest rate per year (0.000<=r).
     *       1.e Floating Point Text-Field for sigma = Annual volatility (0.000<=sigma).
     *       1.f Integer Slider for n = Number of periods that we divide the time to expiration (0<=n<=1000).
     * 
     * 2. Graph JPanel
     *       2.a For now, make this Graph panel just include a JTextArea where we will print out results
     *             for debugging the calculator. Later, we'll replace this by a (Node, Edge)-Graph object
     * 
     */

    /*masterPanel = new JPanel();
    masterPanel.setSize(new Dimension (500,500));
    controlPanel.add(new JTextArea("Control Panel"));
    graphPanel.add(new JTextArea("Graph Panel"));
            
    vSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 
     new JScrollPane(controlPanel), new JScrollPane(graphPanel));
    vSplitPane.setOneTouchExpandable(true);
    vSplitPane.setDividerLocation(150);
     //add(vSplitPane);
    // What should this be - how/where can we attach this pane to the main Panel?
    masterPanel.add(vSplitPane);
    masterPanel.validate();
    getDisplayPane().removeAll();
    getDisplayPane().add(masterPanel, BorderLayout.CENTER);*/

    upContainer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel),
            new JScrollPane(tabbedPanelContainer));

    this.getMainPanel().removeAll();
    this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER);
    this.getMainPanel().validate();

    //initGraph();
    updateAllNodes();
}