public AbstractTreeEditor() { tree = createTree(); tree.addTreeSelectionListener(this); tree.setPreferredSize(new Dimension(325, 0)); tree.setMinimumSize(new Dimension(325, 0)); // Ensure the root nodes start loading tree.loadChildren(tree.getRootNode()); editArea = new JPanel(new GridLayout(1, 1)); AppletGuiUtils.removeBordersFromSplitPane(this); setOrientation(JSplitPane.HORIZONTAL_SPLIT); setContinuousLayout(true); setResizeWeight(0.05); add(tree, JSplitPane.LEFT); add(editArea, JSplitPane.RIGHT); noSelectionEditor = new BasicMessageEditor( CurrentLocale.get("com.tle.admin.gui.common.tree.nodeeditor.nonodeselected")); showTreeNodeEditor(noSelectionEditor); }
public void selectSplitPaneDividerLocation() throws InterruptedException { final LoggingRecorder lr = new LoggingRecorder(); siw(new Runnable() { @Override public void run() { JSplitPane splitPane = (JSplitPane) ComponentUtils.findComponent(JSplitPane.class, frame); splitPane.setDividerLocation(300); BasicSplitPaneDivider divider = (BasicSplitPaneDivider) ComponentUtils.findComponent(BasicSplitPaneDivider.class, splitPane); RSplitPane rDivider = new RSplitPane(divider, null, null, lr); rDivider.mouseReleased(null); } }); Call call = lr.getCall(); AssertJUnit.assertEquals("select", call.getFunction()); AssertJUnit.assertEquals("300", call.getState()); }
public ServiceTimesPanel(ServiceTimesParametricAnalysis stpa, ClassDefinition classDef, StationDefinition stationDef, SimulationDefinition simDef) { super(); STPA = stpa; super.setOrientation(JSplitPane.HORIZONTAL_SPLIT); super.setDividerSize(3); DESCRIPTION = "Repeat the simulation with different service times of a station for" + " the jobs of all the classes.\n\n" + "The 'To' value represents the proportion of the final service time with" + " respect to the initial value.\n\n" + "The 'all class proportionally' option" + " will not be enabled for those stations where at least one of the two following conditions is true:\n" + " - there is at least one class with a service time distribution with infinite or null mean value;\n" + " - there is at least one load dependent class"; DESCRIPTION_SINGLE = "Repeat the simulation changing the service time of a station for" + " one class only.\n\n" + "The 'To' value represents the final mean value of service time distribution."; cd = classDef; sd = stationDef; simd = simDef; checker = new ParametricAnalysisChecker(cd, sd, simd); initialize(); }
public ViewTreeGroups(String directory) { //super("JTree FileSystem Viewer - JavaProgrammingForums.com"); setTitle("GroupsTree Structure"); fileDetailsTextArea.setEditable(false); fileSystemModel = new FileSystemModel(new File(directory)); fileTree = new JTree(fileSystemModel); fileTree.setEditable(true); fileTree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent event) { File file = (File) fileTree.getLastSelectedPathComponent(); fileDetailsTextArea.setText(getFileDetails(file)); } }); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(fileTree), new JScrollPane( fileDetailsTextArea)); getContentPane().add(splitPane); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(640, 480); setVisible(true); }
/** * 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. */ 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); }
/** * Constructs a new SplitPane containing the two components given as * arguments * * @param orientation - the orientation (HORIZONTAL_SPLIT or VERTICAL_SPLIT) * @param first - the left component (if horizontal) or top component (if * vertical) * @param second - the right component (if horizontal) or bottom component * (if vertical) * @param initialDividerLocation - the initial divider location (in pixels) */ public static JSplitPane splitpane(int orientation, Component first, Component second, int initialDividerLocation) { JSplitPane x = make(new JSplitPane(orientation, first, second), new EmptyBorder(0, 0, 0, 0)); x.setContinuousLayout(true); x.setDividerLocation(initialDividerLocation); x.setOneTouchExpandable(false); x.setResizeWeight(0.5); if (Util.onMac() && (x.getUI() instanceof BasicSplitPaneUI)) { boolean h = (orientation != JSplitPane.HORIZONTAL_SPLIT); ((BasicSplitPaneUI) (x.getUI())).getDivider().setBorder(new OurBorder(h, h, h, h)); // Makes // the // border // look // nicer // on // Mac // OS // X } return x; }
/** * Return true if the given component is likely to be a container such the each * component within the container should be be considered as a user input. * * @param c * @return true if the component children should have this listener added. */ protected boolean isProbablyAContainer (Component c) { boolean result = extListener != null ? extListener.isContainer(c) : false; if (!result) { boolean isSwing = isSwingClass(c); if (isSwing) { result = c instanceof JPanel || c instanceof JSplitPane || c instanceof JToolBar || c instanceof JViewport || c instanceof JScrollPane || c instanceof JFrame || c instanceof JRootPane || c instanceof Window || c instanceof Frame || c instanceof Dialog || c instanceof JTabbedPane || c instanceof JInternalFrame || c instanceof JDesktopPane || c instanceof JLayeredPane; } else { result = c instanceof Container; } } return result; }
/** * overrides to hardcode the size of the divider * PENDING(jeff) - rewrite JSplitPane so that this ins't needed */ public void setDividerSize(int newSize) { Insets insets = getInsets(); int borderSize = 0; if (getBasicSplitPaneUI().getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { if (insets != null) { borderSize = insets.left + insets.right; } } else if (insets != null) { borderSize = insets.top + insets.bottom; } if (newSize < pad + minimumThumbSize + borderSize) { setDividerSize(pad + minimumThumbSize + borderSize); } else { vThumbHeight = hThumbWidth = newSize - pad - borderSize; super.setDividerSize(newSize); } }
public ArrivalRatesPanel(ArrivalRateParametricAnalysis arpa, ClassDefinition classDef, StationDefinition stationDef, SimulationDefinition simDef) { super(); ARPA = arpa; super.setOrientation(JSplitPane.HORIZONTAL_SPLIT); super.setDividerSize(3); DESCRIPTION = "Repeat the simulation with different arrival rate for all open " + "classes.\n\n" + "The 'To' value represents the percentage of the final arrival rate with" + " respect to the initial value.\n\n" + "This option will not be available if there is at least one" + " open class with an interarrival time distribution with infinite or null mean value.\n\n"; DESCRIPTION_SINGLE = "Repeat the simulation with different arrival rates for an open " + "classes, provided that the interarrival time distribution has a finite, not null, mean value. " + "The 'To' value is the final arrival rate.\n\n "; cd = classDef; sd = stationDef; simd = simDef; checker = new ParametricAnalysisChecker(cd, sd, simd); initialize(); }
private void computeDividerLocationWhenHidden(Component hiddenComponent) { if (getTopComponent().isVisible() || getBottomComponent().isVisible()) { if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { if (hiddenComponent == getFirstComponent()) { dividerLocation = hiddenComponent.getSize().width / (getSize().getWidth() - dividerSize); } else { dividerLocation = (getSize().getWidth() - dividerSize - hiddenComponent.getSize().width) / (getSize() .getWidth() - dividerSize); } } else { if (hiddenComponent == getFirstComponent()) { dividerLocation = hiddenComponent.getSize().height / (getSize().getHeight() - dividerSize); } else { dividerLocation = (getSize().getHeight() - dividerSize - hiddenComponent.getSize().height) / (getSize() .getHeight() - dividerSize); } } dividerLocation = Math.max(0, dividerLocation); dividerLocation = Math.min(1, dividerLocation); } }
private void computeDividerLocationWhenInitiallyHidden(Component hiddenComponent) { if (getTopComponent().isVisible() || getBottomComponent().isVisible()) { if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { if (hiddenComponent == getFirstComponent()) { dividerLocation = hiddenComponent.getPreferredSize().width / (getPreferredSize().getWidth() - dividerSize); } else { dividerLocation = (getPreferredSize().getWidth() - dividerSize - hiddenComponent.getPreferredSize().width) / (getPreferredSize() .getWidth() - dividerSize); } } else { if (hiddenComponent == getFirstComponent()) { dividerLocation = hiddenComponent.getPreferredSize().height / (getPreferredSize().getHeight() - dividerSize); } else { dividerLocation = (getPreferredSize().getHeight() - dividerSize - hiddenComponent.getPreferredSize().height) / (getPreferredSize() .getHeight() - dividerSize); } } dividerLocation = Math.max(0, dividerLocation); dividerLocation = Math.min(1, dividerLocation); } }
public static void removeBordersFromSplitPane(JSplitPane split) { // remove the border from the split pane split.setBorder(null); // check the UI. If we can't work with the UI any further, then // exit here. if( !(split.getUI() instanceof BasicSplitPaneUI) ) { return; } // grab the divider from the UI and remove the border from it final BasicSplitPaneDivider divider = ((BasicSplitPaneUI) split.getUI()).getDivider(); if( divider != null ) { // Taken from http://forums.sun.com/thread.jspa?threadID=566152 divider.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0), new SplitPaneBorder(UIManager.getColor("SplitPane.background")))); //$NON-NLS-1$ } }
private void configureSecondComponent() { JSplitPane secondSplit = (JSplitPane) getSecondComponent(); int newWidth = secondSplit.getMinimumSize().width; int newHeight = 0; if (getFirstComponent(secondSplit).isVisible() && getSecondComponent(secondSplit).isVisible()) { newHeight = getSecondComponent(secondSplit).getSize().height + (getFirstComponent(secondSplit).isVisible() ? (getFirstComponent(secondSplit).getMinimumSize().height + secondSplit.getDividerSize()) : 0); } else if (getFirstComponent(secondSplit).isVisible()) { newHeight = getFirstComponent(secondSplit).getMinimumSize().height; } else { newHeight = getSecondComponent(secondSplit).getMinimumSize().height; } secondSplit.setMinimumSize(new Dimension(newWidth, newHeight)); }
private void initComponents() { this.setLayout(new BorderLayout()); //building mainPanel mainPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); mainPanel.setDividerSize(4); mainPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); //layout of main panel WarningScrollTable jsp = new WarningScrollTable(joinStrategies, WARNING_CLASS); jsp.setBorder(new TitledBorder(new EtchedBorder(), "Join Strategies")); mainPanel.setResizeWeight(1.0); jsp.setMinimumSize(new Dimension(200, 100)); mainPanel.setLeftComponent(jsp); joinEditor.setMinimumSize(new Dimension(225, 100)); mainPanel.setRightComponent(joinEditor); add(mainPanel, BorderLayout.CENTER); }
public ArrivalRatesPanel(ArrivalRateParametricAnalysis arpa, ClassDefinition classDef, StationDefinition stationDef, SimulationDefinition simDef) { super(); ARPA = arpa; super.setOrientation(JSplitPane.HORIZONTAL_SPLIT); super.setDividerSize(3); DESCRIPTION = "Repeat the simulation with different arrival rate for all open " + "classes.\n\n" + "The 'To' value represents the percentage of the final arrival rate with" + " respect to the initial value.\n\n" + "This option will not be available if there is at least one" + " open class with an interarrival time distribution with infinite or null mean value.\n\n"; DESCRIPTION_SINGLE = "Repeat the simulation with different arrival rates for an open " + "classes, provided that the interarrival time distribution has a finite, positive, mean value. " + "The 'To' value is the final arrival rate.\n\n "; cd = classDef; sd = stationDef; simd = simDef; checker = new ParametricAnalysisChecker(cd, sd, simd); initialize(); }
public NumberOfCustomersPanel(NumberOfCustomerParametricAnalysis ncpa, ClassDefinition classDef, StationDefinition stationDef, SimulationDefinition simDef, GuiInterface guiInterface) { super(); super.setOrientation(JSplitPane.HORIZONTAL_SPLIT); super.setDividerSize(3); DESCRIPTION = "Repeat the simulation with different number of jobs in each iteration, " + "starting from the current number of jobs in the closed class.\n\n" + "The proportion of the number of jobs in the different " + "classes will be kept constant, so the number of steps that can be practically executed " + "may be very small (since only integer values are allowed)."; DESCRIPTION_SINGLE = "Repeat the simulation with different number of jobs in each iteration, " + "starting from the current number of jobs in the closed class, and increasing the number of jobs of" + " selected class only.\n\n"; NCPA = ncpa; cd = classDef; sd = stationDef; simd = simDef; gui = guiInterface; initialize(); }
@Override public void init() { Insets insets = new Insets(10, 10, 10, 10); Dimension size = new Dimension(getWidth() / 2, getHeight()); JSplitPane pane = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, create("Color", size, new MatteBorder(insets, RED)), create("Icon", size, new MatteBorder(insets, this))); pane.setDividerLocation(size.width - pane.getDividerSize() / 2); add(pane); }
private void doCheck(TopComponent mvc, InstanceContent ic) { assertNotNull("MultiViewComponent cloned", mvc); MultiViewHandler handler = MultiViews.findMultiViewHandler(mvc); assertNotNull("Handler found", handler); MultiViewPerspective[] arr = handler.getPerspectives(); assertEquals("Two perspetives found", 2, arr.length); assertEquals("Contextual", arr[0].getDisplayName()); assertEquals("Contextual", arr[1].getDisplayName()); MultiViewDescription description = Accessor.DEFAULT.extractDescription(arr[0]); assertTrue(description instanceof ContextAwareDescription); assertFalse("First one is not for split", ((ContextAwareDescription)description).isSplitDescription()); description = Accessor.DEFAULT.extractDescription(arr[1]); assertTrue(description instanceof ContextAwareDescription); assertTrue("Second one is for split", ((ContextAwareDescription)description).isSplitDescription()); assertPersistence("Always", TopComponent.PERSISTENCE_ALWAYS, mvc); mvc.open(); mvc.requestActive(); mvc.requestVisible(); handler.requestActive(arr[0]); assertNull("No integer now", mvc.getLookup().lookup(Integer.class)); ic.add(1); assertEquals("1 now", Integer.valueOf(1), mvc.getLookup().lookup(Integer.class)); ((MultiViewCloneableTopComponent)mvc).splitComponent(JSplitPane.HORIZONTAL_SPLIT, -1); handler.requestActive(arr[0]); ic.remove(1); assertNull("No integer now", mvc.getLookup().lookup(Integer.class)); ic.add(2); assertEquals("2 now", Integer.valueOf(2), mvc.getLookup().lookup(Integer.class)); }
/** * Maps {@code JSplitPane.isOneTouchExpandable()} through queue */ public boolean isOneTouchExpandable() { return (runMapping(new MapBooleanAction("isOneTouchExpandable") { @Override public boolean map() { return ((JSplitPane) getSource()).isOneTouchExpandable(); } })); }
private void setup_main_split_pane_bottom(final JSplitPane split_pane) { JScrollPane list_scroll_pane = new JScrollPane(); split_pane.setRightComponent(list_scroll_pane); gate_list = new GateList(gate_table_cell_size); list_scroll_pane.setViewportView(gate_list); }
/** Adds real components to given container (according to layout * constraints stored for the components). * @param container instance of a real container to be added to * @param containerDelegate effective container delegate of the container * @param components components to be added * @param index position at which to add the components to container */ @Override public void addComponentsToContainer(Container container, Container containerDelegate, Component[] components, int index) { if (!(container instanceof JSplitPane)) return; for (int i=0; i < components.length; i++) { JSplitPane splitPane = (JSplitPane) container; int descPos = convertPosition(getConstraints(i + index)); if (descPos == 0) { if(splitPane.getClientProperty(LEFT_TOP_BUTTON)==null) { // store the defaul swing button, so we can fall back to it // if component[i] will be removed later... splitPane.putClientProperty(LEFT_TOP_BUTTON, splitPane.getLeftComponent()); } splitPane.setLeftComponent(components[i]); } else if (descPos == 1) { if(splitPane.getClientProperty(RIGHT_BOTTOM_BUTTON)==null) { // store the defaul swing button, so we can fall back to it // if component[i] will be removed later... splitPane.putClientProperty(RIGHT_BOTTOM_BUTTON, splitPane.getRightComponent()); } splitPane.setRightComponent(components[i]); } } }
/** * Invokes the <code>getDividerLocation</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public int getDividerLocation(JSplitPane a) { int returnValue = ((SplitPaneUI) (uis.elementAt(0))).getDividerLocation(a); for (int i = 1; i < uis.size(); i++) { ((SplitPaneUI) (uis.elementAt(i))).getDividerLocation(a); } return returnValue; }
/** * Overridden to handle our layout requirements */ public void doLayout() { Component[] c = getComponents(); if (c.length > 0 && getWidth() >= 0 && getHeight() >= 0) { Insets ins = getInsets(); c[0].setBounds(ins.left, ins.top, getWidth() - (ins.right + ins.left), getHeight() - ins.top + ins.bottom); if (c[0] instanceof JSplitPane && Boolean.TRUE.equals(firstSplit)) { JSplitPane pane = (JSplitPane) c[0]; pane.setDividerLocation(0.80f); pane.resetToPreferredSizes(); JComponent dc = findDescriptionComponent(); if (dc != null) { if (dc.getHeight() > 0) { firstSplit = Boolean.FALSE; } } else { firstSplit = Boolean.FALSE; } } if (c.length > 1) { throw new IllegalStateException("Hmm, something is wrong: " + Arrays.asList(c)); } } }
public DiffResultsView (SearchHistoryPanel parent, List<RepositoryRevision> results) { this.parent = parent; this.results = results; treeView = new DiffTreeTable(parent); treeView.setResults(results); treeView.addAncestorListener(this); diffView = new JSplitPane(JSplitPane.VERTICAL_SPLIT); diffView.setTopComponent(treeView); setBottomComponent(new NoContentPanel(NbBundle.getMessage(DiffResultsView.class, "MSG_DiffPanel_NoRevisions"))); // NOI18N list = WeakListeners.propertyChange(this, null); }
private int getResultsSplitPaneDivider(int orientation) { if (JSplitPane.VERTICAL_SPLIT == orientation) { return getPreferences().getInt(RESULTS_SPLITPANE_DIVIDER_VERTICAL, DEFAULT_DIVIDER_LOCATION_VERTICAL); } else { return getPreferences().getInt(RESULTS_SPLITPANE_DIVIDER_HORIZONTAL, DEFAULT_DIVIDER_LOCATION_HORIZONTAL); } }
private void setResultsSplitPaneDivider(int dividerLocation, int orientation) { if (JSplitPane.VERTICAL_SPLIT == orientation) { getPreferences().putInt(RESULTS_SPLITPANE_DIVIDER_VERTICAL, dividerLocation); } else { getPreferences().putInt(RESULTS_SPLITPANE_DIVIDER_HORIZONTAL, dividerLocation); } }
public Application() { clipboard = new Clipboard(); componentGroups = new HashMap<String, HashMap<ComponentAttributes, Class<? extends Component>>>(); componentButtons = new Vector<ComponentButton>(); collapsiblePanels = new Vector<CollapsiblePanel>(); loadBuildinComponents(); loadPluginComponents(); this.configureGlassPane(); this.setJMenuBar(createMenuBar()); this.add(toolbar=createToolBar(), BorderLayout.NORTH); this.setSize(new Dimension(1000, 600)); this.setLocationByPlatform(true); if(!hasConfiguration(CONFIGURATION_WINDOW_MAXIMIZED)||!Boolean.parseBoolean(getConfiguration(CONFIGURATION_WINDOW_MAXIMIZED))) { if(hasConfiguration(CONFIGURATION_WINDOW_SIZE)) { String[] size = getConfiguration(CONFIGURATION_WINDOW_SIZE).split(", ", 3); if(size.length==2&&Utilities.isNumeric(size[0])&&Utilities.isNumeric(size[1])) this.setSize(new Dimension(Integer.parseInt(size[0]), Integer.parseInt(size[1]))); } if(hasConfiguration(CONFIGURATION_WINDOW_LOCATION)) { String[] location = getConfiguration(CONFIGURATION_WINDOW_LOCATION).split(", ", 3); if(location.length==2&&Utilities.isNumeric(location[0])&&Utilities.isNumeric(location[1])) this.setLocation(Integer.parseInt(location[0]), Integer.parseInt(location[1])); } } else this.setExtendedState(MAXIMIZED_BOTH); this.add(createSplitPane(JSplitPane.VERTICAL_SPLIT, Guitilities.getActualSize(this).height-200, true, 0.95d, createSplitPane(JSplitPane.HORIZONTAL_SPLIT, 200, true, 0.1d, createSidePanel(), new JScrollPane(desktop=createDesktopPanel())), new JScrollPane(oscilloscope=createOscilloscope())), BorderLayout.CENTER); this.setToolBarButtonHeight(40); this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); this.setIconImage(Guitilities.createImageIcon("icon.png").getImage()); this.setTitle("JDigitalSimulator "+getTranslation("translation.title")); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent event) { exitApplication(); } }); this.setVisible(true); applications.add(this); }
/** */ public JSplitPane getDisplayComponent() { if (displayComp == null) { displayComp = createDisplayComp(); } return displayComp; }
/** */ private JSplitPane createDisplayComp() { DividerSettings dividerSettings = TestRunnerSettings.getDefault().getDividerSettings(null); statisticsPanel = new StatisticsPanel(this); return createDisplayComp(statisticsPanel, getOutputComponent(), dividerSettings.getOrientation(), dividerSettings.getLocation()); }
/** * Maps {@code JSplitPane.setBottomComponent(Component)} through queue */ public void setBottomComponent(final Component component) { runMapping(new MapVoidAction("setBottomComponent") { @Override public void map() { ((JSplitPane) getSource()).setBottomComponent(component); } }); }
public void updateOptionStatus(String property, boolean selected) { NbPreferences.forModule(StatisticsPanel.class).putBoolean(property, selected); for (int i = 0; i < tabPane.getTabCount(); i++) { StatisticsPanel sp = (StatisticsPanel)((JSplitPane)tabPane.getComponentAt(i)).getLeftComponent(); sp.updateOptionStatus(property, selected); } }
private void setupGui(ClientService clientService, PluginService pluginService) { model = new SecurityTreeModel(clientService, pluginService); tree = new JTree(model); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setCellRenderer(new MyTreeCellRenderer()); tree.addTreeSelectionListener(this); tabManager = new TabManager(clientService, allowEditing); JScrollPane scroller = new JScrollPane(tree); scroller.setMinimumSize(new Dimension(200, Integer.MAX_VALUE)); JSplitPane split = AppletGuiUtils.createSplitPane(); split.setOrientation(JSplitPane.HORIZONTAL_SPLIT); split.setContinuousLayout(true); split.add(scroller, JSplitPane.LEFT); split.add(tabManager, JSplitPane.RIGHT); JButton closeButton = new JButton(closeAction); final int[] rows = {TableLayout.FILL, closeButton.getPreferredSize().height,}; final int[] cols = {TableLayout.FILL, closeButton.getPreferredSize().width,}; content = new JPanel(new TableLayout(rows, cols)); content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); content.add(split, new Rectangle(0, 0, 2, 1)); content.add(closeButton, new Rectangle(1, 1, 1, 1)); updateEditor(); }
/** Creates a panel consisting of the error panel and the status bar. */ private JSplitPane getMainPanel() { if (this.mainPanel == null) { this.mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, getGraphPanel(), getErrorPanel()); this.mainPanel.setDividerSize(1); this.mainPanel.setContinuousLayout(true); this.mainPanel.setResizeWeight(0.9); this.mainPanel.resetToPreferredSizes(); this.mainPanel.setBorder(null); } return this.mainPanel; }
public @Override boolean requestFocusInWindow() { JSplitPane view = getCurrentResultView(); if (view == null) { return super.requestFocusInWindow(); } Component left = view.getLeftComponent(); if (left == null) { return super.requestFocusInWindow(); } return left.requestFocusInWindow(); }
/** * Maps {@code JSplitPane.setTopComponent(Component)} through queue */ public void setTopComponent(final Component component) { runMapping(new MapVoidAction("setTopComponent") { @Override public void map() { ((JSplitPane) getSource()).setTopComponent(component); } }); }
private static StatisticsPanel getStatisticsPanel() { JSplitPane view = getCurrentResultView(); if (view == null || !(view.getLeftComponent() instanceof StatisticsPanel)) { return null; } return (StatisticsPanel) view.getLeftComponent(); }
/** * Initialization. */ public SwingSpyPanel() { setPreferredSize(new Dimension(INITIAL_WIDTH, INITIAL_HEIGHT)); setLayout(new BorderLayout()); root = new DefaultMutableTreeNode(); componentTree = new JTree(root); componentTree.setRootVisible(false); componentTree.setCellRenderer(new SwingComponentRenderer()); componentTree.addTreeSelectionListener(new CustomSelectionListener()); // add(new JScrollPane(componentTree), BorderLayout.CENTER); detailsData = new JEditorPane(); detailsData.setBackground(new Color(250, 250, 250)); detailsData.setForeground(new Color(33, 33, 33)); detailsData.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 244), 1)); detailsData.setPreferredSize(new Dimension(150, INITIAL_HEIGHT)); detailsData.setEditable(false); detailsData.setContentType("text/html"); SwingUtil.enforceJEditorPaneFont(detailsData, font); detailsScrollPane = new JScrollPane(detailsData); // add(detailsScrollPane, BorderLayout.EAST); JSplitPane hPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(componentTree), detailsScrollPane); hPane.setContinuousLayout(true); hPane.setOneTouchExpandable(true); hPane.setDividerLocation(INITIAL_WIDTH - 200); add(hPane, BorderLayout.CENTER); componentData = new JEditorPane(); componentData.setBackground(new Color(250, 250, 250)); componentData.setForeground(new Color(33, 33, 33)); componentData.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 244), 1)); componentData.setPreferredSize(new Dimension(INITIAL_WIDTH, 36)); componentData.setEditable(false); componentData.setContentType("text/html"); SwingUtil.enforceJEditorPaneFont(componentData, font); add(componentData, BorderLayout.SOUTH); }
@Override public void init() { SwingUtilities.invokeLater(() -> { JPanel left = new JPanel(); left.setBackground(Color.GRAY); JPanel right = new JPanel(); right.setBackground(Color.GRAY); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right); splitPane.setOneTouchExpandable(true); getContentPane().add(splitPane); }); }