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:DragFileDemo.java
public DragFileDemo() { super(new BorderLayout()); fc = new JFileChooser(); ;/*from w w w. j a v a 2s. c o m*/ fc.setMultiSelectionEnabled(true); fc.setDragEnabled(true); fc.setControlButtonsAreShown(false); JPanel fcPanel = new JPanel(new BorderLayout()); fcPanel.add(fc, BorderLayout.CENTER); clear = new JButton("Clear All"); clear.addActionListener(this); JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); buttonPanel.add(clear, BorderLayout.LINE_END); JPanel upperPanel = new JPanel(new BorderLayout()); upperPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); upperPanel.add(fcPanel, BorderLayout.CENTER); upperPanel.add(buttonPanel, BorderLayout.PAGE_END); //The TabbedPaneController manages the panel that //contains the tabbed pane. When there are no files //the panel contains a plain text area. Then, as //files are dropped onto the area, the tabbed panel //replaces the file area. JTabbedPane tabbedPane = new JTabbedPane(); JPanel tabPanel = new JPanel(new BorderLayout()); tabPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tpc = new TabbedPaneController(tabbedPane, tabPanel); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upperPanel, tabPanel); splitPane.setDividerLocation(400); splitPane.setPreferredSize(new Dimension(530, 650)); add(splitPane, BorderLayout.CENTER); }
From source file:com.offbynull.peernetic.debug.visualizer.JGraphXVisualizer.java
/** * Creates a {@link JGraphXVisualizer} object. *//*from ww w.j a va 2 s . co m*/ public JGraphXVisualizer() { graph = new mxGraph(); graph.setCellsEditable(false); graph.setAllowDanglingEdges(false); graph.setAllowLoops(false); graph.setCellsDeletable(false); graph.setCellsCloneable(false); graph.setCellsDisconnectable(false); graph.setDropEnabled(false); graph.setSplitEnabled(false); graph.setCellsBendable(false); graph.setConnectableEdges(false); graph.setCellsMovable(false); graph.setCellsResizable(false); graph.setAutoSizeCells(true); component = new mxGraphComponent(graph); component.setConnectable(false); component.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); component.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); nodeLookupMap = new DualHashBidiMap<>(); connToEdgeLookupMap = new MultiValueMap<>(); edgeToConnLookupMap = new HashMap<>(); vertexLingerTriggerMap = new HashMap<>(); textOutputArea = new JTextArea(); textOutputArea.setLineWrap(false); textOutputArea.setEditable(false); JScrollPane textOutputScrollPane = new JScrollPane(textOutputArea); textOutputScrollPane.setPreferredSize(new Dimension(0, 100)); frame = new JFrame("Visualizer"); frame.setSize(400, 400); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, component, textOutputScrollPane); splitPane.setResizeWeight(1.0); frame.setContentPane(splitPane); component.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { zoomFit(); } }); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { Recorder<A> rec = recorder.get(); if (rec != null) { IOUtils.closeQuietly(rec); } VisualizerEventListener veListener = listener.get(); if (veListener != null) { veListener.closed(); } } }); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); splitPane.setDividerLocation(0.2); }
From source file:hermes.browser.actions.AbstractFIXBrowserDocumentComponent.java
protected void init() { headerScrollPane.setViewportView(getHeaderComponent()); bottomPanel.add(new FilterablePanel(), BorderLayout.NORTH); bottomPanel.add(getStatusPanel(), BorderLayout.SOUTH); getTopPanel().setLayout(new BorderLayout()); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setDividerLocation(200);/* w w w . j av a 2 s .c o m*/ splitPane.setOneTouchExpandable(false); splitPane.setContinuousLayout(false); splitPane.add(headerScrollPane, "top"); splitPane.add(messageTabbedPane, "bottom"); messageTabbedPane.setTabPlacement(JTabbedPane.BOTTOM); getTopPanel().add(splitPane, BorderLayout.CENTER); getTopPanel().add(getBottomComponent(), BorderLayout.SOUTH); HermesBrowser.getBrowser().addDocumentComponent(this); addDocumentComponentListener(this); updateTableRows(true); }
From source file:test.integ.be.fedict.performance.util.PerformanceResultDialog.java
public PerformanceResultDialog(PerformanceResultsData data) { super((Frame) null, "Performance test results"); setSize(1000, 800);/*from w ww. j a va 2s . c om*/ JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu fileMenu = new JMenu("File"); menuBar.add(fileMenu); JMenuItem savePerformanceMenuItem = new JMenuItem("Save Performance"); fileMenu.add(savePerformanceMenuItem); savePerformanceMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Save as PNG..."); int result = fileChooser.showSaveDialog(PerformanceResultDialog.this); if (JFileChooser.APPROVE_OPTION == result) { File file = fileChooser.getSelectedFile(); try { ChartUtilities.saveChartAsPNG(file, performanceChart, 1024, 768); } catch (IOException e) { JOptionPane.showMessageDialog(null, "error saving to file: " + e.getMessage()); } } } }); JMenuItem saveMemoryMenuItem = new JMenuItem("Save Memory"); fileMenu.add(saveMemoryMenuItem); saveMemoryMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Save as PNG..."); int result = fileChooser.showSaveDialog(PerformanceResultDialog.this); if (JFileChooser.APPROVE_OPTION == result) { File file = fileChooser.getSelectedFile(); try { ChartUtilities.saveChartAsPNG(file, memoryChart, 1024, 768); } catch (IOException e) { JOptionPane.showMessageDialog(null, "error saving to file: " + e.getMessage()); } } } }); // memory chart memoryChart = getMemoryChart(data.getIntervalSize(), data.getMemory()); // performance chart performanceChart = getPerformanceChart(data.getIntervalSize(), data.getPerformance(), data.getExpectedRevokedCount()); Container container = getContentPane(); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); if (null != performanceChart) { splitPane.setTopComponent(new ChartPanel(performanceChart)); } if (null != memoryChart) { splitPane.setBottomComponent(new ChartPanel(memoryChart)); } splitPane.setDividerLocation(getHeight() / 2); splitPane.setDividerSize(1); container.add(splitPane); setVisible(true); }
From source file:edu.purdue.cc.bionet.ui.MoleculeDetailPanel.java
public MoleculeDetailPanel(Molecule molecule, Range range, DetailWindow detailWindow, int correlationMethod) { super(new BorderLayout()); Logger logger = Logger.getLogger(getClass()); this.molecule = molecule; this.correlations = detailWindow.getCorrelations(); this.correlationMethod = correlationMethod; logger.debug(String.format("Showing Molecule detail:\n" + "\tMolecule: %s\n\tRange: %s\n", this.molecule, range)); this.correlationRange = range.clone(); this.detailWindow = detailWindow; Language language = Settings.getLanguage(); this.moleculeDetailTable = DataTable.getMoleculeTable(this.correlations, this.molecule); this.correlationsTable = DataTable.getCorrelatedTable(this.correlations, this.molecule, this.correlationRange, this.correlationMethod); this.selectedMoleculeLabel = new JLabel(language.get("Selected Molecule")); this.showElementButton = new JButton(language.get("Show Element")); this.showCorrelationButton = new JButton(language.get("Show Correlation")); this.coefLabel = new JLabel(String.format(language.get("Correlations between %.3f and %.3f"), this.correlationRange.getMin(), this.correlationRange.getMax())); // JPanel leftPanel = new JPanel( new BorderLayout( )); // JPanel rightPanel = new JPanel( new BorderLayout( )); JPanel moleculePanel = new JPanel(new BorderLayout()); JPanel correlationPanel = new JPanel(new BorderLayout()); JPanel buttonPanel = new JPanel(new BorderLayout()); this.showElementButton.addActionListener(this); this.showCorrelationButton.addActionListener(this); buttonPanel.add(this.showElementButton, BorderLayout.WEST); buttonPanel.add(this.showCorrelationButton, BorderLayout.EAST); moleculePanel.add(this.selectedMoleculeLabel, BorderLayout.NORTH); moleculePanel.add(new JScrollPane(this.moleculeDetailTable), BorderLayout.CENTER); correlationPanel.add(this.coefLabel, BorderLayout.NORTH); correlationPanel.add(new JScrollPane(this.correlationsTable), BorderLayout.CENTER); correlationPanel.add(buttonPanel, BorderLayout.SOUTH); JSplitPane leftPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, moleculePanel, correlationPanel); leftPanel.setDividerLocation(200);//www . java2s . c o m // leftPanel.add( moleculePanel, BorderLayout.NORTH ); // leftPanel.add( correlationPanel, BorderLayout.CENTER ); JPanel rightPanel = new ResponseGraph(this.molecule.getSampleMap(this.correlations.getSamples())); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel); splitPane.setDividerLocation(300); this.add(splitPane, BorderLayout.CENTER); }
From source file:org.moeaframework.examples.gp.regression.SymbolicRegressionGUI.java
/** * Layout the components on the GUI.//w w w. j a va 2s .com */ protected void layoutComponents() { container.setMinimumSize(new Dimension(300, 300)); JScrollPane detailsPane = new JScrollPane(details); detailsPane.setMinimumSize(new Dimension(150, 150)); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, container, detailsPane); splitPane.setResizeWeight(0.5); splitPane.setDividerLocation(0.4); JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.CENTER)); buttonPane.add(close); getContentPane().setLayout(new BorderLayout()); getContentPane().add(splitPane, BorderLayout.CENTER); getContentPane().add(buttonPane, BorderLayout.SOUTH); }
From source file:com.AandR.beans.plotting.LinePlotPanel.LinePlotPanel.java
private void initialize() { plotsMap = new TreeMap<String, XYSeries>(); plotSeries = new XYSeriesCollection(); dropListeners = new ArrayList<DropListener>(); plotPanelListener = new ScatterPanelListener(); centerSplitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT); centerSplitter.setTopComponent(createDataPanel()); centerSplitter.setBottomComponent(createChartPanel()); centerSplitter.setDividerLocation(0); }
From source file:logdruid.ui.mainpanel.StatRecordingSelectorPanel.java
/** * Create the panel.//ww w.j a v a 2 s .c o m */ public StatRecordingSelectorPanel(final Repository rep, Source src) { repository = rep; source = src; records = rep.getRecordings(StatRecording.class); // Collections.sort(records); Iterator it = records.iterator(); while (it.hasNext()) { Recording record = (Recording) it.next(); data.add(new Object[] { record.getName(), record.getRegexp(), record.getType(), src.isActiveRecordingOnSource(record) }); } model = new logdruid.ui.mainpanel.StatRecordingSelectorPanel.MyTableModel(data, header); StatRecordingSelectorPanel thiis = this; logger.info("source is " + ((source == null) ? "null" : src.getSourceName())); setLayout(new BorderLayout(0, 0)); JPanel panel_1 = new JPanel(); panel_1.setLayout(new BorderLayout(0, 0)); table = new JTable(model); JScrollPane scrollPane = new JScrollPane(table); panel_1.add(scrollPane, BorderLayout.CENTER); table.setPreferredScrollableViewportSize(new Dimension(0, 150)); table.setFillsViewportHeight(true); table.setAutoCreateRowSorter(true); // Set up column sizes. initColumnSizes(table); JSplitPane splitPane = new JSplitPane(); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); add(splitPane); jPanelDetail = new JPanel(); splitPane.setBottomComponent(jPanelDetail); splitPane.setTopComponent(panel_1); jPanelDetail.setLayout(new BorderLayout(0, 0)); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { int selectedRow = ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1); logger.info("ListSelectionListener - selectedRow: " + selectedRow); if (selectedRow >= 0) { if (jPanelDetail != null) { logger.debug("ListSelectionListener - valueChanged"); jPanelDetail.removeAll(); recEditor = getEditor(repository.getRecording(StatRecording.class, selectedRow)); if (recEditor != null) { jPanelDetail.add(recEditor, BorderLayout.CENTER); } jPanelDetail.revalidate(); } } } }); if (repository.getRecordings(StatRecording.class).size() > 0) { recEditor = getEditor(repository.getRecording(StatRecording.class, 0)); jPanelDetail.add(recEditor, BorderLayout.CENTER); table.setRowSelectionInterval(0, 0); } if (model.getRowCount() > 0) { table.getRowSorter().toggleSortOrder(0); table.setRowSelectionInterval(0, 0); } }
From source file:TextComponentDemo.java
public TextComponentDemo() { super("TextComponentDemo"); // Create the text pane and configure it. textPane = new JTextPane(); textPane.setCaretPosition(0);//from w w w .ja va 2 s . c om 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:eu.cassandra.platform.gui.GUI.java
public GUI() { //redirectSystemStreams(); a = new ListenInstallationComboBox(); installationCombo.setPreferredSize(new Dimension(300, 20)); startButton.addActionListener(new ListenStartButton()); exitButton.addActionListener(new ListenExitButton()); projectFileField.addMouseListener(new ListenProjectFileField()); logTextAreaScrollPane.setPreferredSize(new Dimension(400, 500)); projectFileField.setPreferredSize(new Dimension(600, 20)); // projectFileField.setText(new File(Params.SIM_PROPS).getAbsolutePath()); projectFileField.setText(""); projectFileField.setEditable(false); f.setJMenuBar(menuBar);/* w ww .j a v a 2s . c o m*/ menuFile.add(menuItemQuit); menuHelp.add(menuItemAbout); menuBar.add(menuFile); menuBar.add(menuHelp); statsTextArea.setFont(new Font("Tahoma", Font.BOLD, 12)); TimeSeries series = new TimeSeries(""); dataset = new TimeSeriesCollection(series); JFreeChart chart = createChart("Consumption", dataset); ChartPanel chartPanel = new ChartPanel(chart); graphScrollPane = new JScrollPane(chartPanel); buttonPanel.add(projectFileField); buttonPanel.add(startButton); buttonPanel.add(holdButton); buttonPanel.add(installationCombo); buttonPanel.add(exitButton); statsTextArea.setText("Statistics:\n"); logTextArea.setText("Logs:\n"); JSplitPane textAreaSplitPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT); textAreaSplitPanel.setDividerLocation((int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2)); textAreaSplitPanel.add(statsTextAreaScrollPane, JSplitPane.TOP); textAreaSplitPanel.add(logTextAreaScrollPane, JSplitPane.BOTTOM); JSplitPane mainSplitPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); mainSplitPanel.add(graphScrollPane, JSplitPane.LEFT); mainSplitPanel.add(textAreaSplitPanel, JSplitPane.RIGHT); mainSplitPanel.setDividerLocation((int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 1.5)); f.getContentPane().setLayout(new BorderLayout()); f.getContentPane().add(mainSplitPanel, BorderLayout.CENTER); f.getContentPane().add(buttonScrollPane, BorderLayout.SOUTH); f.addWindowListener(new ListenCloseWdw()); menuItemQuit.addActionListener(new ListenMenuQuit()); }