Java Code Examples for javax.swing.JSplitPane#VERTICAL_SPLIT
The following examples show how to use
javax.swing.JSplitPane#VERTICAL_SPLIT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GUIBulkSender.java From PacketProxy with Apache License 2.0 | 6 votes |
private JComponent createRecvPanel() throws Exception { recvData = new GUIBulkSenderData(owner, GUIBulkSenderData.Type.SERVER, data -> { OneShotPacket pkt = recvPackets.get(selectedRecvPacketId); if (pkt != null) pkt.setData(data); }); recvTable = new GUIBulkSenderTable(GUIBulkSenderTable.Type.SERVER, oneshotId -> { selectedRecvPacketId = oneshotId; OneShotPacket pkt = recvPackets.get(oneshotId); if (pkt != null) recvData.setData(pkt.getData()); }); JSplitPane split_panel = new JSplitPane(JSplitPane.VERTICAL_SPLIT); split_panel.add(recvTable.createPanel()); split_panel.add(recvData.createPanel()); split_panel.setAlignmentX(Component.CENTER_ALIGNMENT); return split_panel; }
Example 2
Source File: StyledSplitPaneUI.java From stendhal with GNU General Public License v2.0 | 5 votes |
@Override public void paint(Graphics g) { StyleUtil.fillBackground(style, g, 0, 0, getWidth(), getHeight()); // Ribbing Insets insets = style.getBorder().getBorderInsets(this); if (splitPane.getOrientation() == JSplitPane.VERTICAL_SPLIT) { int y = insets.top + 1; int maxY = getHeight() - insets.bottom - 1; while (y < maxY) { g.setColor(style.getShadowColor()); g.drawLine(5, y, getWidth() - 6, y); y++; g.setColor(style.getHighLightColor()); g.drawLine(5, y, getWidth() - 6, y); y++; } } else { int x = insets.left + 1; int maxX = getWidth() - insets.right - 1; while (x < maxX) { g.setColor(style.getShadowColor()); g.drawLine(x, 5, x, getHeight() - 6); x++; g.setColor(style.getHighLightColor()); g.drawLine(x, 5, x, getHeight() - 6); x++; } } // highlighting if (isMouseOver()) { highLightBorder(g); } else { paintBorder(g); } }
Example 3
Source File: DeckEditorSplitPanel.java From magarena with GNU General Public License v3.0 | 5 votes |
private Container getMainContentContainer() { // card pool cardPoolDefs = filterPanel.getFilteredCards(); cardPoolTable = new CardTablePanelB(cardPoolDefs, generatePoolTitle(), false); cardPoolTable.addMouseListener(new CardPoolMouseListener()); cardPoolTable.addCardSelectionListener(this); cardPoolTable.setDeckEditorSelectionMode(); deckDefs = this.deck; deckTable = new CardTablePanelB(deckDefs, generateDeckTitle(deckDefs), true); deckTable.addMouseListener(new DeckMouseListener()); deckTable.addCardSelectionListener(this); deckTable.setDeckEditorSelectionMode(); deckTable.showCardCount(true); final JPanel deckPanel = new JPanel(); deckPanel.setOpaque(false); deckPanel.setLayout(new MigLayout("insets 0, gap 0, flowy")); deckPanel.add(buttonsPanel, "w 100%, h 40!"); deckPanel.add(deckTable, "w 100%, h 100%"); cardsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); cardsSplitPane.setOneTouchExpandable(false); cardsSplitPane.setLeftComponent(cardPoolTable); cardsSplitPane.setRightComponent(deckPanel); cardsSplitPane.setResizeWeight(0.5); cardsSplitPane.setDividerSize(14); cardsSplitPane.setBorder(null); cardsSplitPane.setOpaque(false); cardsSplitPane.setDividerLocation(getDividerPosition()); // update deck stats sideBarPanel.setDeck(this.deck); return cardsSplitPane; }
Example 4
Source File: Manager.java From netbeans with Apache License 2.0 | 5 votes |
/** * Updates the layout orientation of the test result window based on the * dimensions of the ResultWindow in its position. */ private void updateDisplayHandlerLayouts() { int x = ResultWindow.getInstance().getWidth(); int y = ResultWindow.getInstance().getHeight(); int orientation = x > y ? JSplitPane.HORIZONTAL_SPLIT : JSplitPane.VERTICAL_SPLIT; ResultWindow.getInstance().setOrientation(orientation); }
Example 5
Source File: DefaultContentPanel.java From opt4j with MIT License | 5 votes |
@Override public void startup() { setLayout(new BorderLayout()); final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setOneTouchExpandable(true); splitPane.setResizeWeight(1.0); add(splitPane); modulesPanel.setPreferredSize(new Dimension(220, 200)); selectedPanel.setPreferredSize(new Dimension(350, 200)); JPanel top = new JPanel(new BorderLayout()); top.add(modulesPanel, BorderLayout.WEST); top.add(selectedPanel, BorderLayout.CENTER); JTabbedPane bottom = new JTabbedPane(); bottom.addTab("Tasks", Icons.getIcon(Icons.CONSOLE), tasksPanel); bottom.setPreferredSize(new Dimension(300, 160)); top.setMinimumSize(new Dimension(300, 80)); splitPane.add(top, JSplitPane.TOP); splitPane.add(bottom, JSplitPane.BOTTOM); modulesPanel.startup(); selectedPanel.startup(); tasksPanel.startup(); setVisible(true); }
Example 6
Source File: DocumentsPanelProvider.java From lucene-solr with Apache License 2.0 | 5 votes |
public JPanel get() { JPanel panel = new JPanel(new GridLayout(1, 1)); panel.setOpaque(false); panel.setBorder(BorderFactory.createLineBorder(Color.gray)); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, initUpperPanel(), initLowerPanel()); splitPane.setOpaque(false); splitPane.setDividerLocation(0.4); panel.add(splitPane); setUpDocumentContextMenu(); return panel; }
Example 7
Source File: CodeEditor.java From CQL with GNU Affero General Public License v3.0 | 5 votes |
private void situateNotElongated() { JPanel cp = new JPanel(new BorderLayout()); cp.add(sp); cp.add(errorStrip, BorderLayout.LINE_END); cp.setBorder(BorderFactory.createEtchedBorder()); JComponent newtop = cp; if (enable_outline) { JSplitPane xx2 = new Split(.8, JSplitPane.HORIZONTAL_SPLIT); xx2.setDividerSize(6); if (outline_on_left) { xx2.setResizeWeight(.2); xx2.add(p); xx2.add(cp); } else { xx2.setResizeWeight(.8); xx2.add(cp); xx2.add(p); } xx2.setBorder(BorderFactory.createEmptyBorder()); newtop = xx2; } JSplitPane xx1 = new Split(.8, JSplitPane.VERTICAL_SPLIT); xx1.setDividerSize(6); xx1.setResizeWeight(.8); xx1.add(newtop); xx1.add(respAreaX); xx1.setBorder(BorderFactory.createEmptyBorder()); respAreaX.setMinimumSize(new Dimension(0, 0)); this.removeAll(); add(xx1); revalidate(); }
Example 8
Source File: CETechnologyPanel.java From open-ig with GNU Lesser General Public License v3.0 | 4 votes |
/** * Construct the GUI. */ private void initGUI() { technologiesModel = new GenericTableModel<XElement>() { /** */ private static final long serialVersionUID = 2557373261832556243L; @Override public Object getValueFor(XElement item, int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return rowIndex; case 1: return item.get("id", ""); case 2: return context.dataManager().label(item.get("name", null)); case 3: return context.get(item.get("category", null)); case 4: return item.getIntObject("level"); case 5: return item.get("race", null); case 6: return item.getIntObject("production-cost"); case 7: return item.getIntObject("research-cost"); case 8: return context.getIcon(validateItem(item)); default: return null; } } }; technologiesModel.setColumnNames( get("tech.#"), get("tech.id"), get("tech.name"), get("tech.category"), get("tech.level"), get("tech.race"), get("tech.research_cost"), get("tech.production_cost"), ""); technologiesModel.setColumnTypes( Integer.class, String.class, String.class, String.class, Integer.class, String.class, Integer.class, Integer.class, ImageIcon.class ); technologies = new JTable(technologiesModel); technologiesSorter = new TableRowSorter<>(technologiesModel); technologies.setRowSorter(technologiesSorter); technologies.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int idx = technologies.getSelectedRow(); if (idx >= 0) { idx = technologies.convertRowIndexToModel(idx); doDetails(technologiesModel.get(idx), idx); } else { doDetails(null, -1); } } } }); JPanel top = createTopPanel(); verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); verticalSplit.setTopComponent(top); JPanel bottom = createBottomPanel(); verticalSplit.setBottomComponent(bottom); verticalSplit.setResizeWeight(0.75); setLayout(new BorderLayout()); add(verticalSplit, BorderLayout.CENTER); doUpdateCount(); doDetails(null, -1); }
Example 9
Source File: javax_swing_JSplitPane.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected JSplitPane getAnotherObject() { return new JSplitPane(JSplitPane.VERTICAL_SPLIT); }
Example 10
Source File: TreeDemo.java From OpenDA with GNU Lesser General Public License v3.0 | 4 votes |
public TreeDemo() { super(new GridLayout(1,0)); //Create the nodes. DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series"); createNodes(top); //Create a tree that allows one selection at a time. tree = new JTree(top); tree.getSelectionModel().setSelectionMode (TreeSelectionModel.SINGLE_TREE_SELECTION); //Listen for when the selection changes. tree.addTreeSelectionListener(this); if (playWithLineStyle) { System.out.println("line style = " + lineStyle); tree.putClientProperty("JTree.lineStyle", lineStyle); } //Create the scroll pane and add the tree to it. JScrollPane treeView = new JScrollPane(tree); //Create the HTML viewing pane. htmlPane = new JEditorPane(); htmlPane.setEditable(false); initHelp(); JScrollPane htmlView = new JScrollPane(htmlPane); //Add the scroll panes to a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(treeView); splitPane.setBottomComponent(htmlView); Dimension minimumSize = new Dimension(100, 50); htmlView.setMinimumSize(minimumSize); treeView.setMinimumSize(minimumSize); splitPane.setDividerLocation(100); splitPane.setPreferredSize(new Dimension(500, 300)); //Add the split pane to this panel. add(splitPane); }
Example 11
Source File: SwingSet3.java From littleluck with Apache License 2.0 | 4 votes |
protected JComponent createMainPanel() { // Create main panel with demo selection on left and demo/source on right mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); // Create demo selector panel on left demoSelectorPanel = new DemoSelectorPanel(demoListTitle, demoList); demoSelectorPanel.setPreferredSize(new Dimension(DEMO_SELECTOR_WIDTH, MAIN_FRAME_HEIGHT)); demoSelectorPanel.addPropertyChangeListener(new DemoSelectionListener()); mainPanel.add(demoSelectorPanel, BorderLayout.WEST); // Create splitpane on right to hold demo and source code demoSplitPane = new AnimatingSplitPane(JSplitPane.VERTICAL_SPLIT); demoSplitPane.setBorder(EMPTY_BORDER); mainPanel.add(demoSplitPane, BorderLayout.CENTER); // Create panel to contain currently running demo demoContainer = new JPanel(); demoContainer.setLayout(new BorderLayout()); demoContainer.setBorder(PANEL_BORDER); demoContainer.setPreferredSize(new Dimension(DEMO_PANEL_WIDTH, DEMO_PANEL_HEIGHT)); demoSplitPane.setTopComponent(demoContainer); currentDemoPanel = demoPlaceholder; demoContainer.add(demoPlaceholder, BorderLayout.CENTER); // Create collapsible source code pane codeViewer = new CodeViewer(); codeContainer = new JPanel(new BorderLayout()); codeContainer.add(codeViewer); codeContainer.setBorder(PANEL_BORDER); codeContainer.setMinimumSize(new Dimension(0,0)); demoSplitPane.setBottomComponent(codeContainer); addPropertyChangeListener(new SwingSetPropertyListener()); // Create shareable popup menu for demo actions popup = new JPopupMenu(); popup.add(new EditPropertiesAction()); popup.add(new ViewCodeSnippetAction()); return mainPanel; }
Example 12
Source File: SourceTab.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
private void buildBottomPanel(JPanel parent, String layout, JPanel bottomPanel) { //parent.add(bottomPanel, layout); ////bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS)); bottomPanel.setLayout(new BorderLayout(3, 3)); bottomPanel.setPreferredSize(new Dimension(800, 250)); /* JPanel audioOpts = new JPanel(); bottomPanel.add(audioOpts, BorderLayout.NORTH); rdbtnShowFFT = new JCheckBox("Show FFT"); rdbtnShowFFT.addItemListener(this); rdbtnShowFFT.setSelected(true); audioOpts.add(rdbtnShowFFT); */ audioGraph = new AudioGraphPanel(); audioGraph.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); bottomPanel.add(audioGraph, BorderLayout.CENTER); audioGraph.setBackground(Color.LIGHT_GRAY); //audioGraph.setPreferredSize(new Dimension(800, 250)); if (audioGraphThread != null) { audioGraph.stopProcessing(); } audioGraphThread = new Thread(audioGraph); audioGraphThread.setUncaughtExceptionHandler(Log.uncaughtExHandler); audioGraphThread.start(); JPanel eyePhasorPanel = new JPanel(); eyePhasorPanel.setLayout(new BorderLayout()); eyePanel = new EyePanel(); eyePanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); bottomPanel.add(eyePhasorPanel, BorderLayout.EAST); eyePhasorPanel.add(eyePanel, BorderLayout.WEST); eyePanel.setBackground(Color.LIGHT_GRAY); eyePanel.setPreferredSize(new Dimension(200, 100)); eyePanel.setMaximumSize(new Dimension(200, 100)); eyePanel.setVisible(true); phasorPanel = new PhasorPanel(); phasorPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); eyePhasorPanel.add(phasorPanel, BorderLayout.EAST); phasorPanel.setBackground(Color.LIGHT_GRAY); phasorPanel.setPreferredSize(new Dimension(200, 100)); phasorPanel.setMaximumSize(new Dimension(200, 100)); phasorPanel.setVisible(false); fftPanel = new FFTPanel(); fftPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); fftPanel.setBackground(Color.LIGHT_GRAY); //bottomPanel.add(fftPanel, BorderLayout.SOUTH); showFFT(false); fftPanel.setPreferredSize(new Dimension(100, 150)); fftPanel.setMaximumSize(new Dimension(100, 150)); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, bottomPanel, fftPanel); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); // repaint as we resize, otherwise we can not see the moved line against the dark background if (Config.splitPaneHeight != 0) splitPane.setDividerLocation(Config.splitPaneHeight); else splitPane.setDividerLocation(200); SplitPaneUI spui = splitPane.getUI(); if (spui instanceof BasicSplitPaneUI) { // Setting a mouse listener directly on split pane does not work, because no events are being received. ((BasicSplitPaneUI) spui).getDivider().addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (Config.iq == true) { splitPaneHeight = splitPane.getDividerLocation(); //Log.println("SplitPane: " + splitPaneHeight); Config.splitPaneHeight = splitPaneHeight; } } }); } ; parent.add(splitPane, layout); }
Example 13
Source File: TreeDemo.java From marathonv5 with Apache License 2.0 | 4 votes |
public TreeDemo() { super(new GridLayout(1, 0)); // Create the nodes. DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series"); createNodes(top); // Create a tree that allows one selection at a time. tree = new JTree(top); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); // Listen for when the selection changes. tree.addTreeSelectionListener(this); if (playWithLineStyle) { System.out.println("line style = " + lineStyle); tree.putClientProperty("JTree.lineStyle", lineStyle); } // Create the scroll pane and add the tree to it. JScrollPane treeView = new JScrollPane(tree); // Create the HTML viewing pane. htmlPane = new JEditorPane(); htmlPane.setEditable(false); initHelp(); JScrollPane htmlView = new JScrollPane(htmlPane); // Add the scroll panes to a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(treeView); splitPane.setBottomComponent(htmlView); Dimension minimumSize = new Dimension(100, 50); htmlView.setMinimumSize(minimumSize); treeView.setMinimumSize(minimumSize); splitPane.setDividerLocation(100); splitPane.setPreferredSize(new Dimension(500, 300)); // Add the split pane to this panel. add(splitPane); }
Example 14
Source File: SwingSet3.java From beautyeye with Apache License 2.0 | 4 votes |
protected JComponent createMainPanel() { // Create main panel with demo selection on left and demo/source on right mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); // Create demo selector panel on left demoSelectorPanel = new DemoSelectorPanel(demoListTitle, demoList); demoSelectorPanel.setPreferredSize(new Dimension(DEMO_SELECTOR_WIDTH, MAIN_FRAME_HEIGHT)); demoSelectorPanel.addPropertyChangeListener(new DemoSelectionListener()); mainPanel.add(demoSelectorPanel, BorderLayout.WEST); // Create splitpane on right to hold demo and source code demoSplitPane = new AnimatingSplitPane(JSplitPane.VERTICAL_SPLIT); demoSplitPane.setBorder(EMPTY_BORDER); mainPanel.add(demoSplitPane, BorderLayout.CENTER); // Create panel to contain currently running demo demoContainer = new JPanel(); demoContainer.setLayout(new BorderLayout()); demoContainer.setBorder(PANEL_BORDER); demoContainer.setPreferredSize(new Dimension(DEMO_PANEL_WIDTH, DEMO_PANEL_HEIGHT)); demoSplitPane.setTopComponent(demoContainer); currentDemoPanel = demoPlaceholder; demoContainer.add(demoPlaceholder, BorderLayout.CENTER); // Create collapsible source code pane codeViewer = new CodeViewer(); codeContainer = new JPanel(new BorderLayout()); codeContainer.add(codeViewer); codeContainer.setBorder(PANEL_BORDER); codeContainer.setMinimumSize(new Dimension(0,0)); demoSplitPane.setBottomComponent(codeContainer); addPropertyChangeListener(new SwingSetPropertyListener()); // Create shareable popup menu for demo actions popup = new JPopupMenu(); popup.add(new EditPropertiesAction()); popup.add(new ViewCodeSnippetAction()); return mainPanel; }
Example 15
Source File: UnicornSplitPaneUI.java From Data_Processor with Apache License 2.0 | 4 votes |
/** * Creates and return an instance of JButton that can be used to * collapse the right component in the split pane. */ @Override protected JButton createRightOneTouchButton() { JButton b = new JButton() { private static final long serialVersionUID = 1L; public void setBorder(Border border) { } @Override public void paint(Graphics g) { if (splitPane != null) { int[] xs = new int[3]; int[] ys = new int[3]; int blockSize; // Fill the background first ... g.setColor(new Color(255,0,255)); g.fillRect(0, 0, this.getWidth(), this.getHeight()); // ... then draw the arrow. if (orientation == JSplitPane.VERTICAL_SPLIT) { blockSize = Math.min(getHeight(), oneTouchSize); xs[0] = blockSize; xs[1] = blockSize << 1; xs[2] = 0; ys[0] = blockSize; ys[1] = ys[2] = 0; } else { blockSize = Math.min(getWidth(), oneTouchSize); xs[0] = xs[2] = 0; xs[1] = blockSize; ys[0] = 0; ys[1] = blockSize; ys[2] = blockSize << 1; } g.setColor(new Color(255,0,255)); g.fillPolygon(xs, ys, 3); } } // Don't want the button to participate in focus traversable. public boolean isFocusTraversable() { return false; } }; b.setMinimumSize(new Dimension(oneTouchSize, oneTouchSize)); b.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); b.setFocusPainted(false); b.setBorderPainted(false); b.setRequestFocusEnabled(false); return b; }
Example 16
Source File: ScriptConsoleTopComponent.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
public ScriptConsoleTopComponent() { this.actionMap = new HashMap<>(); registerAction(new NewAction(this)); registerAction(new OpenAction(this)); registerAction(new SaveAction(this)); registerAction(new SaveAsAction(this)); registerAction(new RunAction(this)); registerAction(new StopAction(this)); registerAction(new HelpAction(this)); inputTextArea = new JTextArea(); // todo - replace by JIDE code editor component (nf) inputTextArea.setWrapStyleWord(false); inputTextArea.setTabSize(4); inputTextArea.setRows(10); inputTextArea.setColumns(80); inputTextArea.setFont(new Font("Courier", Font.PLAIN, 13)); outputTextArea = new JTextArea(); outputTextArea.setWrapStyleWord(false); outputTextArea.setTabSize(4); outputTextArea.setRows(3); outputTextArea.setColumns(80); outputTextArea.setEditable(false); outputTextArea.setBackground(Color.LIGHT_GRAY); outputTextArea.setFont(new Font("Courier", Font.PLAIN, 13)); final JToolBar toolBar = new JToolBar("Script Console"); toolBar.setFloatable(false); toolBar.add(getToolButton(NewAction.ID)); toolBar.add(getToolButton(OpenAction.ID)); toolBar.add(getToolButton(SaveAction.ID)); toolBar.add(getToolButton(SaveAsAction.ID)); toolBar.addSeparator(); toolBar.add(getToolButton(RunAction.ID)); toolBar.add(getToolButton(StopAction.ID)); toolBar.addSeparator(); toolBar.add(getToolButton(HelpAction.ID)); getAction(NewAction.ID).setEnabled(true); getAction(OpenAction.ID).setEnabled(true); getAction(SaveAction.ID).setEnabled(false); getAction(SaveAsAction.ID).setEnabled(false); getAction(RunAction.ID).setEnabled(false); getAction(StopAction.ID).setEnabled(false); getAction(HelpAction.ID).setEnabled(true); inputTextArea.setEditable(false); inputTextArea.setEnabled(false); JScrollPane inputEditorScrollPane = new JScrollPane(inputTextArea); inputEditorScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); inputEditorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); JScrollPane outputEditorScrollPane = new JScrollPane(outputTextArea); outputEditorScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); outputEditorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); JSplitPane documentPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, inputEditorScrollPane, outputEditorScrollPane); documentPanel.setDividerLocation(0.7); documentPanel.setBorder(null); setLayout(new BorderLayout(4, 4)); setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); setPreferredSize(new Dimension(800, 400)); add(toolBar, BorderLayout.NORTH); add(documentPanel, BorderLayout.CENTER); output = new PrintWriter(new ScriptOutput(), true); scriptManager = new ScriptManager(getClass().getClassLoader(), output); updateTitle(); }
Example 17
Source File: TreeIconDemo.java From marathonv5 with Apache License 2.0 | 4 votes |
public TreeIconDemo() { super(new GridLayout(1, 0)); // Create the nodes. DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series"); createNodes(top); // Create a tree that allows one selection at a time. tree = new JTree(top); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); // Set the icon for leaf nodes. ImageIcon leafIcon = createImageIcon("images/middle.gif"); if (leafIcon != null) { DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); renderer.setLeafIcon(leafIcon); tree.setCellRenderer(renderer); } else { System.err.println("Leaf icon missing; using default."); } // Listen for when the selection changes. tree.addTreeSelectionListener(this); // Create the scroll pane and add the tree to it. JScrollPane treeView = new JScrollPane(tree); // Create the HTML viewing pane. htmlPane = new JEditorPane(); htmlPane.setEditable(false); initHelp(); JScrollPane htmlView = new JScrollPane(htmlPane); // Add the scroll panes to a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(treeView); splitPane.setBottomComponent(htmlView); Dimension minimumSize = new Dimension(100, 50); htmlView.setMinimumSize(minimumSize); treeView.setMinimumSize(minimumSize); splitPane.setDividerLocation(100); // XXX: ignored in some releases // of Swing. bug 4101306 // workaround for bug 4101306: // treeView.setPreferredSize(new Dimension(100, 100)); splitPane.setPreferredSize(new Dimension(500, 300)); // Add the split pane to this panel. add(splitPane); }
Example 18
Source File: InstancesControllerUI.java From visualvm with GNU General Public License v2.0 | 4 votes |
private void initComponents() { JPanel fieldsBrowserPanel = instancesController.getFieldsBrowserController().getPanel(); JPanel referencesBrowserPanel = instancesController.getReferencesBrowserController().getPanel(); JPanel instancesListPanel = instancesController.getInstancesListController().getPanel(); browsersSplit = new JExtendedSplitPane(JSplitPane.VERTICAL_SPLIT, fieldsBrowserPanel, referencesBrowserPanel); tweakSplitPaneUI(browsersSplit); browsersSplit.setResizeWeight(0.5d); contentsSplit = new JExtendedSplitPane(JSplitPane.HORIZONTAL_SPLIT, instancesListPanel, browsersSplit); tweakSplitPaneUI(contentsSplit); contentsSplit.setDividerLocation(instancesListPanel.getPreferredSize().width); JPanel classPresenterPanel = instancesController.getClassPresenterPanel(); classPresenterPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 3, 0, getBackground()), classPresenterPanel.getBorder())); legendPanel = new LegendPanel(true); dataPanel = new JPanel(new BorderLayout()); dataPanel.setOpaque(false); dataPanel.add(classPresenterPanel, BorderLayout.NORTH); dataPanel.add(contentsSplit, BorderLayout.CENTER); dataPanel.add(legendPanel, BorderLayout.SOUTH); noDataPanel = new JPanel(new BorderLayout()); noDataPanel.setBorder(BorderFactory.createLoweredBevelBorder()); HTMLTextArea hintArea = new HTMLTextArea() { protected void showURL(URL url) { instancesController.getHeapFragmentWalker().switchToClassesView(); } }; hintArea.setBorder(BorderFactory.createEmptyBorder(10, 8, 8, 8)); String classesRes = Icons.getResource(LanguageIcons.CLASS); String hintText = Bundle.InstancesControllerUI_NoClassDefinedMsg( "<a href='#'><img border='0' align='bottom' src='nbresloc:/" + classesRes + "'></a>"); // NOI18N hintArea.setText(hintText); noDataPanel.add(hintArea, BorderLayout.CENTER); contents = new CardLayout(); setLayout(contents); add(noDataPanel, NO_DATA); add(dataPanel, DATA); LegendUpdater legendUpdater = new LegendUpdater(); fieldsBrowserPanel.addHierarchyListener(legendUpdater); referencesBrowserPanel.addHierarchyListener(legendUpdater); }
Example 19
Source File: javax_swing_JSplitPane.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
protected JSplitPane getAnotherObject() { return new JSplitPane(JSplitPane.VERTICAL_SPLIT); }
Example 20
Source File: YogaCombinationsView.java From Astrosoft with GNU General Public License v2.0 | 3 votes |
private JSplitPane createResultPane(){ chartPanel = new JPanel(new BorderLayout()); //chartPanel.add(new Chart(new PlanetChartData(Varga.Rasi, planetaryInfo), chartSize), BorderLayout.CENTER); chartPanel.add(new VargaChartPanel(planetaryInfo, chartSize), BorderLayout.CENTER); final JSplitPane yogaResultPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, chartPanel, createYogaDetailPane()); chartPanel.setBorder(BorderFactory.createEtchedBorder()); yogaResultPane.setBorder(BorderFactory.createEmptyBorder()); return yogaResultPane; }