List of usage examples for javax.swing JSplitPane VERTICAL_SPLIT
int VERTICAL_SPLIT
To view the source code for javax.swing JSplitPane VERTICAL_SPLIT.
Click Source Link
Component
s are split along the y axis. From source file:sample.fa.ScriptRunnerApplication.java
void createGUI() { Box buttonBox = Box.createHorizontalBox(); JButton loadButton = new JButton("Load"); loadButton.addActionListener(this::loadScript); buttonBox.add(loadButton);// w ww . j a v a2 s. co m JButton saveButton = new JButton("Save"); saveButton.addActionListener(this::saveScript); buttonBox.add(saveButton); JButton executeButton = new JButton("Execute"); executeButton.addActionListener(this::executeScript); buttonBox.add(executeButton); languagesModel = new DefaultComboBoxModel(); ScriptEngineManager sem = new ScriptEngineManager(); for (ScriptEngineFactory sef : sem.getEngineFactories()) { languagesModel.addElement(sef.getScriptEngine()); } JComboBox<ScriptEngine> languagesCombo = new JComboBox<>(languagesModel); JLabel languageLabel = new JLabel(); languagesCombo.setRenderer((JList<? extends ScriptEngine> list, ScriptEngine se, int index, boolean isSelected, boolean cellHasFocus) -> { ScriptEngineFactory sef = se.getFactory(); languageLabel.setText(sef.getEngineName() + " - " + sef.getLanguageName() + " (*." + String.join(", *.", sef.getExtensions()) + ")"); return languageLabel; }); buttonBox.add(Box.createHorizontalGlue()); buttonBox.add(languagesCombo); scriptContents = new JTextArea(); scriptContents.setRows(8); scriptContents.setColumns(40); scriptResults = new JTextArea(); scriptResults.setEditable(false); scriptResults.setRows(8); scriptResults.setColumns(40); JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scriptContents, scriptResults); JFrame frame = new JFrame("Script Runner"); frame.add(buttonBox, BorderLayout.NORTH); frame.add(jsp, BorderLayout.CENTER); frame.pack(); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); }
From source file:ec.ui.view.RevisionSaSeriesView.java
/** * Constructs a new view/*from w ww .j a v a 2s . c o m*/ */ public RevisionSaSeriesView() { setLayout(new BorderLayout()); sRenderer = new XYLineAndShapeRenderer(); sRenderer.setBaseShapesVisible(false); //sRenderer.setSeriesStroke(1, new BasicStroke(0.75f, 1, 1, 1.0f, new float[]{2f, 3f}, 0.0f)); sRenderer.setBasePaint(themeSupport.getLineColor(ColorScheme.KnownColor.RED)); revRenderer = new XYLineAndShapeRenderer(false, true); mainChart = createMainChart(); chartpanel_ = new JChartPanel(ChartFactory.createLineChart(null, null, null, null, PlotOrientation.VERTICAL, false, false, false)); documentpanel_ = ComponentFactory.getDefault().newHtmlView(); JSplitPane splitpane = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, chartpanel_, NbComponents.newJScrollPane(documentpanel_)); splitpane.setDividerLocation(0.5); splitpane.setResizeWeight(.5); popup = new ChartPopup(null, false); chartpanel_.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent e) { if (lastIndexSelected != -1) { revRenderer.setSeriesShapesFilled(lastIndexSelected, false); } if (e.getEntity() != null) { if (e.getEntity() instanceof XYItemEntity) { XYItemEntity item = (XYItemEntity) e.getEntity(); if (item.getDataset().equals(mainChart.getXYPlot().getDataset(REV_INDEX))) { int i = item.getSeriesIndex(); revRenderer.setSeriesShape(i, new Ellipse2D.Double(-3, -3, 6, 6)); revRenderer.setSeriesShapesFilled(i, true); revRenderer.setSeriesPaint(i, themeSupport.getLineColor(ColorScheme.KnownColor.BLUE)); lastIndexSelected = i; showRevisionPopup(e); } } } } @Override public void chartMouseMoved(ChartMouseEvent cme) { } }); chartpanel_.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(JChartPanel.ZOOM_SELECTION_CHANGED)) { showSelectionPopup((Rectangle2D) evt.getNewValue()); } } }); this.add(splitpane, BorderLayout.CENTER); splitpane.setResizeWeight(0.5); onColorSchemeChange(); }
From source file:ec.util.chart.swing.JTimeSeriesRendererSupportDemo.java
public JTimeSeriesRendererSupportDemo() { this.colorSchemeSupport = SwingColorSchemeSupport.from(new TangoColorScheme()); this.support = new CustomRendererSupport(3, 24, colorSchemeSupport); this.chart = createTsChart(); RANDOM_DATA.executeSafely(chart);//from w ww . ja v a 2 s . c o m setLayout(new BorderLayout()); add(createToolBar(), BorderLayout.NORTH); add(ModernUI.withEmptyBorders( new JSplitPane(JSplitPane.VERTICAL_SPLIT, createChartPanel(), createMissionControl())), BorderLayout.CENTER); }
From source file:ListSelectionDemo.java
public ListSelectionDemo() { super(new BorderLayout()); String[] listData = { "one", "two", "three", "four", "five", "six", "seven" }; String[] columnNames = { "French", "Spanish", "Italian" }; list = new JList(listData); listSelectionModel = list.getSelectionModel(); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); JScrollPane listPane = new JScrollPane(list); JPanel controlPane = new JPanel(); String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" }; final JComboBox comboBox = new JComboBox(modes); comboBox.setSelectedIndex(2);//from w w w.j av a 2 s . co m comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newMode = (String) comboBox.getSelectedItem(); if (newMode.equals("SINGLE_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } else { listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } output.append("----------" + "Mode: " + newMode + "----------" + newline); } }); controlPane.add(new JLabel("Selection mode:")); controlPane.add(comboBox); // Build output area. output = new JTextArea(1, 10); output.setEditable(false); JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); // Do the layout. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); add(splitPane, BorderLayout.CENTER); JPanel topHalf = new JPanel(); topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS)); JPanel listContainer = new JPanel(new GridLayout(1, 1)); listContainer.setBorder(BorderFactory.createTitledBorder("List")); listContainer.add(listPane); topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); topHalf.add(listContainer); // topHalf.add(tableContainer); topHalf.setMinimumSize(new Dimension(100, 50)); topHalf.setPreferredSize(new Dimension(100, 110)); splitPane.add(topHalf); JPanel bottomHalf = new JPanel(new BorderLayout()); bottomHalf.add(controlPane, BorderLayout.PAGE_START); bottomHalf.add(outputPane, BorderLayout.CENTER); // XXX: next line needed if bottomHalf is a scroll pane: // bottomHalf.setMinimumSize(new Dimension(400, 50)); bottomHalf.setPreferredSize(new Dimension(450, 135)); splitPane.add(bottomHalf); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_2.CFAstSwing.CFAstSwingSysClusterViewEditJPanel.java
public CFAstSwingSysClusterViewEditJPanel(ICFAstSwingSchema argSchema, ICFAstSysClusterObj argFocus) { super();//from w w w . java 2 s .c o m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; setSwingFocus(argFocus); setSize(1024, 480); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); attrJPanel = argSchema.getSysClusterFactory().newAttrJPanel(argFocus); attrScrollPane = new CFHSlaveJScrollPane(attrJPanel); eltJTabbedPane = argSchema.getSysClusterFactory().newEltJTabbedPane(argFocus); splitPane.setTopComponent(attrScrollPane); splitPane.setBottomComponent(eltJTabbedPane); add(splitPane); splitPane.setBounds(0, 0, 1024, 455); splitPane.setDividerLocation(200); if (getSwingFocus() != null) { setPanelMode(CFJPanel.PanelMode.View); } doLayout(); }
From source file:org.ash.history.TopActivityDetail.java
/** * Load Top Activity and Detail tabs with data. * /*from w w w . j a v a2 s . co m*/ * @param begin * @param end * @throws DatabaseException */ private void loadPreviewStackedChartP(double begin, double end) throws DatabaseException { try { TopActivityPreview stackedChart = new TopActivityPreview(this.databaseHistory); // Set Max CPU stackedChart.setThresholdMaxCpu(getMaxCPUValue(databaseHistory)); // Set Title stackedChart.setTitle(getTitle(databaseHistory, begin, end)); // Set chart panel this.chartChartPanel = stackedChart.createDemoPanelTopActivity(begin, end); // Set legend to stacked chart stackedChart.addLegend(10); // Set format for x axis stackedChart.setFormat("HH:mm"); /** Initialize Sqls & Sessions JPanel*/ this.sqlsAndSessions = new GanttH(this.mainFrame, this.databaseHistory); this.splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT); this.splitPaneMain.add(this.chartChartPanel, "top"); this.splitPaneMain.add(this.sqlsAndSessions, "bottom"); this.splitPaneMain.setDividerLocation(240); this.splitPaneMain.setOneTouchExpandable(true); this.mainPanelHistory = new JPanel(); this.mainPanelHistory.setLayout(new GridLayout(1, 1, 1, 1)); this.mainPanelHistory.add(splitPaneMain); this.chartChartPanel.addListenerReleaseMouse(this.sqlsAndSessions); this.sqlsAndSessions.repaint(); this.tabsMain = new JTabbedPane(); DetailsPanelH detailJPanelH = new DetailsPanelH(this.databaseHistory, begin, end, getMaxCPUValue(databaseHistory)); this.tabsMain.add(this.mainPanelHistory, Options.getInstance().getResource("tabMain.text")); this.tabsMain.add(detailJPanelH, Options.getInstance().getResource("tabDetail.text")); this.mainPanel.removeAll(); this.mainPanel.add(this.tabsMain); this.validate(); } catch (DatabaseException e) { e.printStackTrace(); } }
From source file:gdt.jgui.entity.procedure.JProcedurePanel.java
/** * The default constructor.// w w w . j av a 2s .c o m */ public JProcedurePanel() { sourcePanel = new JEditorPane(); JScrollPane scrollPaneTop = new JScrollPane(sourcePanel); scrollPaneTop.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Java Source", TitledBorder.CENTER, TitledBorder.TOP)); reportPanel = new JEditorPane(); JScrollPane scrollPaneBottom = new JScrollPane(reportPanel); scrollPaneBottom.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Report", TitledBorder.CENTER, TitledBorder.TOP)); setLayout(new BorderLayout(0, 0)); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPaneTop, scrollPaneBottom); splitPane.setDividerLocation(0.5); add(splitPane); splitPane.addComponentListener(new ShowListener()); }
From source file:com.intuit.tank.tools.script.ScriptFilterRunner.java
/** * @return/*from ww w .ja va 2s. c o m*/ */ private Component createContentPanel() { JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true); scriptEditorTA = new RSyntaxTextArea(); setSyntaxStyle(); RTextScrollPane sp = new RTextScrollPane(scriptEditorTA); pane.setTopComponent(sp); JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JPanel panel = new JPanel(new BorderLayout()); output = new TextAreaOutputLogger(scrollPane, INITIAL_OUTPUT_CONTENT); output.setEditable(false); output.setAutoscrolls(true); output.setScrollContent(true); output.setWrapStyleWord(true); scrollPane.setViewportView(output); JToolBar toolBar = new JToolBar(); JButton clearBT = new JButton("Clear"); clearBT.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { output.setText(INITIAL_OUTPUT_CONTENT); } }); final JCheckBox scrollCB = new JCheckBox("Auto Scroll Content"); scrollCB.setSelected(true); scrollCB.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { output.setScrollContent(scrollCB.isSelected()); } }); toolBar.add(clearBT); toolBar.add(scrollCB); panel.add(toolBar, BorderLayout.NORTH); panel.add(scrollPane, BorderLayout.CENTER); pane.setBottomComponent(panel); pane.setDividerLocation(300); return pane; }
From source file:TextComponentDemo.java
public TextComponentDemo() { super("TextComponentDemo"); // Create the text pane and configure it. textPane = new JTextPane(); textPane.setCaretPosition(0);/*from w ww.j a v a 2 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. 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(); // Start watching for undoable edits and caret changes. doc.addUndoableEditListener(new MyUndoableEditListener()); textPane.addCaretListener(caretListenerLabel); doc.addDocumentListener(new MyDocumentListener()); }
From source file:TableSelectionDemo.java
public TableSelectionDemo() { super(new BorderLayout()); String[] columnNames = { "French", "Spanish", "Italian" }; String[][] tableData = { { "un", "uno", "uno" }, { "deux", "dos", "due" }, { "trois", "tres", "tre" }, { "quatre", "cuatro", "quattro" }, { "cinq", "cinco", "cinque" }, { "six", "seis", "sei" }, { "sept", "siete", "sette" } }; table = new JTable(tableData, columnNames); listSelectionModel = table.getSelectionModel(); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); table.setSelectionModel(listSelectionModel); JScrollPane tablePane = new JScrollPane(table); // Build control area (use default FlowLayout). JPanel controlPane = new JPanel(); String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" }; final JComboBox comboBox = new JComboBox(modes); comboBox.setSelectedIndex(2);/*from w w w . j ava 2 s. co m*/ comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newMode = (String) comboBox.getSelectedItem(); if (newMode.equals("SINGLE_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } else { listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } output.append("----------" + "Mode: " + newMode + "----------" + newline); } }); controlPane.add(new JLabel("Selection mode:")); controlPane.add(comboBox); // Build output area. output = new JTextArea(1, 10); output.setEditable(false); JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); // Do the layout. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); add(splitPane, BorderLayout.CENTER); JPanel topHalf = new JPanel(); topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS)); JPanel listContainer = new JPanel(new GridLayout(1, 1)); JPanel tableContainer = new JPanel(new GridLayout(1, 1)); tableContainer.setBorder(BorderFactory.createTitledBorder("Table")); tableContainer.add(tablePane); tablePane.setPreferredSize(new Dimension(420, 130)); topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); topHalf.add(listContainer); topHalf.add(tableContainer); topHalf.setMinimumSize(new Dimension(250, 50)); topHalf.setPreferredSize(new Dimension(200, 110)); splitPane.add(topHalf); JPanel bottomHalf = new JPanel(new BorderLayout()); bottomHalf.add(controlPane, BorderLayout.PAGE_START); bottomHalf.add(outputPane, BorderLayout.CENTER); // XXX: next line needed if bottomHalf is a scroll pane: // bottomHalf.setMinimumSize(new Dimension(400, 50)); bottomHalf.setPreferredSize(new Dimension(450, 110)); splitPane.add(bottomHalf); }