Example usage for javax.swing JSplitPane JSplitPane

List of usage examples for javax.swing JSplitPane JSplitPane

Introduction

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

Prototype

public JSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent) 

Source Link

Document

Creates a new JSplitPane with the specified orientation and the specified components.

Usage

From source file:de.huberlin.cuneiform.compiler.debug.DebugDispatcher.java

public DebugDispatcher(File buildDir, File logFile, String dagid) {

    super(buildDir, logFile, dagid);

    JSplitPane splitPane;// w w w  .  ja  va  2 s  . c  o m

    frame = new JFrame("Cuneiform Debug Interface");
    frame.setSize(700, 500);
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.setLayout(new BorderLayout());

    addMenu();

    invocOverview = new InvocOverview(this);
    contentOverview = new ContentOverview(frame);

    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, invocOverview, contentOverview);
    // splitPane.setResizeWeight( .5 );
    splitPane.setDividerLocation(350);

    frame.add(splitPane, BorderLayout.CENTER);

}

From source file:hr.fer.zemris.vhdllab.platform.support.SimplisticEclipseBasedApplicationPage.java

@Override
protected JComponent createControl() {
    projectExplorerPane = new JPanel(new BorderLayout());
    editorsPane = new JPanel(new BorderLayout());
    viewsTabbedPane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
    viewsTabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            // if we're adding a component, ignore change of active
            // component
            if (!addingView && getViewsTabbedPane().getSelectedIndex() >= 0) {
                setActiveComponent(getComponent(getViewsTabbedPane().getSelectedIndex()));
            }/*from  w  w w  .ja v  a 2  s  .  c om*/
        }
    });

    final double horizontalLocation = 0.15;
    final double verticalLocation = 0.75;
    final JSplitPane horizontalPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, projectExplorerPane,
            editorsPane);
    horizontalPane.setDividerLocation(horizontalLocation);
    final JSplitPane verticalPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, horizontalPane, viewsTabbedPane);
    verticalPane.setDividerLocation(verticalLocation);

    JPanel maximizedPanel = new JPanel(new BorderLayout());
    maximizedPanel.add(verticalPane, BorderLayout.CENTER);
    JPanel control = new JPanel(new BorderLayout());
    control.add(maximizedPanel, BorderLayout.CENTER);
    control.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            horizontalPane.setDividerLocation(horizontalLocation);
            verticalPane.setDividerLocation(verticalLocation);
        }
    });

    this.getPageDescriptor().buildInitialLayout(this);

    if (viewsTabbedPane.getTabCount() > 0) {
        viewsTabbedPane.setSelectedIndex(0);
    }

    Logger.getRootLogger().addAppender(new AppenderSkeleton() {
        @Override
        public boolean requiresLayout() {
            return false;
        }

        @Override
        public void close() {
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void append(LoggingEvent event) {
            if (event.getLevel().equals(Level.INFO)) {
                Object message = event.getMessage();
                if (message != null) {
                    getActiveWindow().getStatusBar().setMessage(message.toString());
                }
            }
        }
    });
    return control;
}

From source file:gchisto.gui.panels.gcdistribution.ChartPanelSingle.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.
 *//* w  w w . j  a v a  2 s . c o  m*/
private void addChart() {
    JFreeChart chart = ChartFactory.createXYBarChart(getTitle(), "Buckets (sec)", false, "Count", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    chart.addProgressListener(locker);
    XYPlot plot = (XYPlot) chart.getPlot();
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setToolTipGenerator(dataset);

    groupActivatingPanel = new GroupActivatingPanel(dataset, locker);

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

From source file:gchisto.gui.panels.gctimeline.ChartPanel.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.
 *//* ww w.  j av  a  2s  . co  m*/
private void addChart() {
    JFreeChart chart = ChartFactory.createXYBarChart(getTitle(), "Elapsed Time (sec)", false,
            "Time" + unitSuffix(), dataset, PlotOrientation.VERTICAL, true, true, false);
    chart.addProgressListener(locker);
    XYPlot plot = (XYPlot) chart.getPlot();
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setToolTipGenerator(dataset);

    groupActivatingTable = new GroupActivatingPanel(dataset, locker);

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

From source file:com.diversityarrays.kdxplore.field.TrialLayoutEditPanel.java

public TrialLayoutEditPanel(Closure<TrialLayout> onLayoutComplete) {
    super(new BorderLayout());

    this.onLayoutComplete = onLayoutComplete;

    plotIdTrialLayoutPane.addPropertyChangeListener(TrialLayoutPane.PROP_LAYOUT_CHANGED,
            selectionChangedListener);/*ww w  .  j  av a 2 s  .c  o  m*/
    xyTrialLayoutPane.addPropertyChangeListener(TrialLayoutPane.PROP_LAYOUT_CHANGED, selectionChangedListener);

    cardPanel.add(plotIdTrialLayoutPane, CARD_PLOT_ID);
    cardPanel.add(xyTrialLayoutPane, CARD_X_AND_Y);
    cardPanel.add(noDateTrialLayoutPane, CARD_NO_DATA);

    //      saveAction.setEnabled(false);
    //      Box buttons = Box.createHorizontalBox();
    //      buttons.add(new JButton(cancelAction));
    //      buttons.add(new JButton(saveAction));

    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cardPanel, new JLabel());
    splitPane.setResizeWeight(0.0);

    add(splitPane, BorderLayout.CENTER);
    //      add(buttons, BorderLayout.SOUTH);
}

From source file:SplitPaneDemo2.java

public SplitPaneDemo2() {
    super("SplitPaneDemo2");

    //Create an instance of SplitPaneDemo
    SplitPaneDemo splitPaneDemo = new SplitPaneDemo();
    JSplitPane top = splitPaneDemo.getSplitPane();
    splitPaneDemo.getImageList().addListSelectionListener(this);

    //XXXX: Bug #4131528, borders on nested split panes accumulate.
    //Workaround: Set the border on any split pane within
    //another split pane to null. Components within nested split
    //panes need to have their own border for this to work well.
    top.setBorder(null);/*from w ww . j a v a2s. c om*/

    //Create a regular old label
    label = new JLabel("Click on an image name in the list.", JLabel.CENTER);

    //Create a split pane and put "top" (a split pane)
    //and JLabel instance in it.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, label);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(180);

    //Provide minimum sizes for the two components in the split pane
    top.setMinimumSize(new Dimension(100, 50));
    label.setMinimumSize(new Dimension(100, 30));

    //Add the split pane to this frame
    getContentPane().add(splitPane);
}

From source file:components.TextComponentDemo.java

public TextComponentDemo() {
    super("TextComponentDemo");

    //Create the text pane and configure it.
    textPane = new JTextPane();
    textPane.setCaretPosition(0);//from  ww  w .  j a  v  a2  s  .  co m
    textPane.setMargin(new Insets(5, 5, 5, 5));
    StyledDocument styledDoc = textPane.getStyledDocument();
    if (styledDoc instanceof AbstractDocument) {
        doc = (AbstractDocument) styledDoc;
        doc.setDocumentFilter(new DocumentSizeFilter(MAX_CHARACTERS));
    } else {
        System.err.println("Text pane's document isn't an AbstractDocument!");
        System.exit(-1);
    }
    JScrollPane scrollPane = new JScrollPane(textPane);
    scrollPane.setPreferredSize(new Dimension(200, 200));

    //Create the text area for the status log and configure it.
    changeLog = new JTextArea(5, 30);
    changeLog.setEditable(false);
    JScrollPane scrollPaneForLog = new JScrollPane(changeLog);

    //Create a split pane for the change log and the text area.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, scrollPaneForLog);
    splitPane.setOneTouchExpandable(true);

    //Create the status area.
    JPanel statusPane = new JPanel(new GridLayout(1, 1));
    CaretListenerLabel caretListenerLabel = new CaretListenerLabel("Caret Status");
    statusPane.add(caretListenerLabel);

    //Add the components.
    getContentPane().add(splitPane, BorderLayout.CENTER);
    getContentPane().add(statusPane, BorderLayout.PAGE_END);

    //Set up the menu bar.
    actions = createActionTable(textPane);
    JMenu editMenu = createEditMenu();
    JMenu styleMenu = createStyleMenu();
    JMenuBar mb = new JMenuBar();
    mb.add(editMenu);
    mb.add(styleMenu);
    setJMenuBar(mb);

    //Add some key bindings.
    addBindings();

    //Put the initial text into the text pane.
    initDocument();
    textPane.setCaretPosition(0);

    //Start watching for undoable edits and caret changes.
    doc.addUndoableEditListener(new MyUndoableEditListener());
    textPane.addCaretListener(caretListenerLabel);
    doc.addDocumentListener(new MyDocumentListener());
}

From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformQQNormalPlotChart.java

public void init() {

    sliderPanel = new JPanel();
    powerSlider = new FloatSlider("Power", 1.0, -10.0, 10.0);
    powerSlider.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80));
    powerSlider.addObserver(this);
    powerSlider.setToolTipText("Slider for adjusting the value of power.");
    sliderPanel.add(this.powerSlider);

    super.init();
    depLabel.setText("Data"); // Y

    toolBar = new JToolBar();
    createActionComponents(toolBar);//from   w w  w.  j a  va  2 s .  co  m
    JPanel toolBarContainer = new JPanel();
    toolBarContainer.add(toolBar);

    JSplitPane toolContainer = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolBarContainer,
            new JScrollPane(sliderPanel));
    toolContainer.setContinuousLayout(true);
    toolContainer.setDividerLocation(0.6);
    this.getContentPane().add(toolContainer, BorderLayout.NORTH);
}

From source file:it.cnr.icar.eric.client.ui.swing.DiscoveryPanel.java

/**
 * Class Constructor./*from  www  .j av  a2  s. c  om*/
 */
public DiscoveryPanel() throws JAXRException {
    GridBagLayout gbl = new GridBagLayout();
    setLayout(gbl);

    findParamsPanel = new FindParamsPanel(this);

    JPanel findResultsPanel = createFindResultsPanel();

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, findParamsPanel, findResultsPanel);
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(splitPane, c);
    add(splitPane);

    //add listener for 'locale' bound property
    RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this);
}

From source file:com.clank.launcher.dialog.LauncherFrame.java

private void initComponents() {
    webView = WebpagePanel.forURL(launcher.getNewsURL(), false);
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, instanceScroll, webView);
    selfUpdateButton.setVisible(false);/*from w  ww .  j  a  v  a2  s.  co  m*/

    updateCheck.setSelected(true);
    instancesTable.setModel(instancesModel);
    launchButton.setFont(launchButton.getFont().deriveFont(Font.BOLD));
    splitPane.setDividerLocation(200);
    splitPane.setDividerSize(4);
    SwingHelper.flattenJSplitPane(splitPane);
    buttonsPanel.addElement(refreshButton);
    buttonsPanel.addElement(updateCheck);
    buttonsPanel.addGlue();
    buttonsPanel.addElement(selfUpdateButton);
    buttonsPanel.addElement(optionsButton);
    buttonsPanel.addElement(launchButton);
    container.setLayout(new BorderLayout());
    container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
    container.add(splitPane, BorderLayout.CENTER);
    add(buttonsPanel, BorderLayout.SOUTH);
    add(container, BorderLayout.CENTER);

    instancesModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            if (instancesTable.getRowCount() > 0) {
                instancesTable.setRowSelectionInterval(0, 0);
            }
        }
    });

    instancesTable.addMouseListener(new DoubleClickToButtonAdapter(launchButton));

    refreshButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            loadInstances();
            checkLauncherUpdate();
        }
    });

    selfUpdateButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            selfUpdate();
        }
    });

    optionsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showOptions();
        }
    });

    launchButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            launch();
        }
    });

    instancesTable.addMouseListener(new PopupMouseAdapter() {
        @Override
        protected void showPopup(MouseEvent e) {
            int index = instancesTable.rowAtPoint(e.getPoint());
            Instance selected = null;
            if (index >= 0) {
                instancesTable.setRowSelectionInterval(index, index);
                selected = launcher.getInstances().get(index);
            }
            popupInstanceMenu(e.getComponent(), e.getX(), e.getY(), selected);
        }
    });
}