Java Code Examples for javax.swing.JSplitPane#setDividerSize()

The following examples show how to use javax.swing.JSplitPane#setDividerSize() . 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: SqlViewer.java    From CQL with GNU Affero General Public License v3.0 6 votes vote down vote up
public SqlViewer(Color color, SqlSchema info, SqlInstance inst) {
	super(new GridLayout(1, 1));
	this.info = info;
	this.inst = inst;
	this.color = color;

	makeCards();
	makeGraph();
	makeUI();

	if (inst == null) {
		add(top);
	} else {
		JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		pane.setResizeWeight(.75);
		pane.setDividerSize(2);
		pane.add(top);
		pane.add(bottom);
		add(pane);
	}
	setBorder(BorderFactory.createEtchedBorder());
}
 
Example 2
Source File: TransactionView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initialize() {

	mgr = new ExplorerManager();
	mgr.addPropertyChangeListener(this);
	mgr.setRootContext(controller.getRoot());

        // following line tells the top component which lookup should be associated with it
        associateLookup (ExplorerUtils.createLookup (mgr, getActionMap ()));

        setLayout(new java.awt.BorderLayout());
	tree = new BeanTreeView();
	tree.setDefaultActionAllowed(true);
	tree.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(TransactionView.class).getString("ACS_MON_treeName"));
	tree.getAccessibleContext().setAccessibleName(NbBundle.getBundle(TransactionView.class).getString("ACS_MON_treeDesc"));

	createLogPanel(); 
	createDataPanel(); 
	splitPanel = 
	    new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, logPanel, dataPanel); 
	splitPanel.setDividerLocation((int)(logD.getWidth()));
	splitPanel.setResizeWeight(dividerRatio);
	splitPanel.setDividerSize(1); 
	splitPanel.setOneTouchExpandable(true); 
	this.add(splitPanel);
	setName(NbBundle.getBundle(TransactionView.class).getString("MON_Title"));
    }
 
Example 3
Source File: SampleVerifier.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Create an instance of SampleVerifier.
 */
private SampleVerifier ()
{
    // Pane split vertically: selectors then browser
    JSplitPane vertSplitPane = new JSplitPane(
            JSplitPane.VERTICAL_SPLIT,
            getSelectorsPanel(),
            glyphBrowser.getComponent());
    vertSplitPane.setName("SampleVerifierSplitPane");
    vertSplitPane.setDividerSize(1);

    // Hosting frame
    frame = new JFrame();
    frame.setName("SampleVerifierFrame");
    frame.add(vertSplitPane);

    // Resource injection
    ResourceMap resource = MainGui.getInstance().getContext().
            getResourceMap(
            getClass());
    resource.injectComponents(frame);
}
 
Example 4
Source File: DomGui.java    From DominionSim with MIT License 6 votes vote down vote up
private void initializeComponent()	{
  setJMenuBar( createMenu() );
  
     myVPLineChart = new DomLineChart(myEngine.getPlayers(), "VP");
  myBarChart = new DomBarChart(myEngine.getPlayers());
     myMoneyLineChart = new DomLineChart(myEngine.getPlayers(), "Money");

     myTopSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(getControlPanel()), myVPLineChart.getChartPanel());
     myBottomSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, myBarChart.getChartPanel(), myMoneyLineChart.getChartPanel());
  myBigSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, myTopSplit, myBottomSplit);
     myBigSplit.setResizeWeight(0.8);
     myTopSplit.setResizeWeight(0.50);
     myBottomSplit.setResizeWeight(0.5);
     myBottomSplit.setDividerSize(5);
     myBigSplit.setDividerSize(5);
     myTopSplit.setDividerSize(5);

  add(myBigSplit);
}
 
Example 5
Source File: PreferencesDialog.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected JComponent getCenter()
{
	// Build the settings panel
	JPanel emptyPanel = new JPanel();
	emptyPanel.setPreferredSize(new Dimension(780, 420));

	settingsTree = new TreeView<>();
	settingsTree.setRoot(new TreeItem<>(null));

	// Build the split pane
	splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, GuiUtility.wrapParentAsJFXPanel(settingsTree),
			emptyPanel
	);
	splitPane.setOneTouchExpandable(true);
	splitPane.setDividerSize(10);

	return splitPane;
}
 
Example 6
Source File: ClassesControllerUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void tweakSplitPaneUI(JSplitPane splitPane) {
    splitPane.setOpaque(false);
    splitPane.setBorder(null);
    splitPane.setDividerSize(3);

    if (!(splitPane.getUI() instanceof BasicSplitPaneUI)) {
        return;
    }

    BasicSplitPaneDivider divider = ((BasicSplitPaneUI) splitPane.getUI()).getDivider();

    if (divider != null) {
        divider.setBorder(null);
    }
}
 
Example 7
Source File: CPSMasterDetailModule.java    From cropplanning with GNU General Public License v3.0 5 votes vote down vote up
protected void buildUI() {
    splitPane = new JSplitPane( JSplitPane.VERTICAL_SPLIT, 
                                master.getJPanel(),
                                detail.getJPanel() );
    splitPane.setDividerSize(5);
    splitPane.setDividerLocation(0.5);
    splitPane.setResizeWeight(1.0); // top get's more space
    splitPane.setOneTouchExpandable(false);
    splitPane.setContinuousLayout(true);
    initUI();
    mainPanel.add(splitPane);
}
 
Example 8
Source File: ChatPanel.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
public ChatPanel(final Chat chat, final ChatSoundProfile chatSoundProfile) {
  setSize(300, 200);
  chatPlayerPanel = new ChatPlayerPanel(chat);
  chatMessagePanel = new ChatMessagePanel(chat, chatSoundProfile);
  setLayout(new BorderLayout());
  final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  split.setLeftComponent(chatMessagePanel);
  split.setRightComponent(chatPlayerPanel);
  split.setOneTouchExpandable(false);
  split.setDividerSize(DIVIDER_SIZE);
  split.setResizeWeight(1);
  add(split, BorderLayout.CENTER);
}
 
Example 9
Source File: FeatureOverviewWindow.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
private JSplitPane addSpectraMS2() {
  JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  SpectraVisualizerWindow spectraWindowMS2 = new SpectraVisualizerWindow(rawFiles[0]);
  spectraWindowMS2.loadRawData(rawFiles[0].getScan(feature.getMostIntenseFragmentScanNumber()));

  pane.add(spectraWindowMS2.getSpectrumPlot());
  pane.add(spectraWindowMS2.getToolBar());
  pane.setResizeWeight(1);
  pane.setEnabled(false);
  pane.setDividerSize(0);
  return pane;
}
 
Example 10
Source File: GUIBrowser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private JSplitPane createUnderPane(JTree tree) {
    JTextArea toStringArea = new JTextArea();
    toStringArea.setLineWrap(true);
    toStringArea.setEditable(false);
    tree.addTreeSelectionListener(new ToStringListener(toStringArea));
    JSplitPane result = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
            new JScrollPane(tree),
            new JScrollPane(toStringArea));
    result.setOneTouchExpandable(true);
    result.setDividerSize(8);
    result.setDividerLocation(0.8);
    return result;
}
 
Example 11
Source File: InstancesControllerUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void tweakSplitPaneUI(JSplitPane splitPane) {
    splitPane.setOpaque(false);
    splitPane.setBorder(null);
    splitPane.setDividerSize(3);

    if (!(splitPane.getUI() instanceof BasicSplitPaneUI)) {
        return;
    }

    BasicSplitPaneDivider divider = ((BasicSplitPaneUI) splitPane.getUI()).getDivider();

    if (divider != null) {
        divider.setBorder(null);
    }
}
 
Example 12
Source File: SqlMapper.java    From CQL with GNU Affero General Public License v3.0 5 votes vote down vote up
private SqlMapper() {
	super(new BorderLayout());

	JButton transButton = new JButton("Guess Mapping");

	transButton.addActionListener(x -> doRun());

	JPanel tp = new JPanel(new GridLayout(1, 4));

	tp.add(transButton);
	tp.add(new JLabel());
	tp.add(new JLabel());
	tp.add(new JLabel());

	JSplitPane jspX = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
	jspX.setBorder(BorderFactory.createEmptyBorder());
	jspX.setDividerSize(2);
	jspX.setResizeWeight(0.5d);
	jspX.add(input1);
	jspX.add(input2);

	JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
	jsp.setBorder(BorderFactory.createEmptyBorder());
	jsp.setDividerSize(4);
	jsp.setResizeWeight(0.7d);
	jsp.add(jspX);
	jsp.add(output);
	JPanel ret = new JPanel(new GridLayout(1, 1));
	ret.add(jsp);

	add(ret, BorderLayout.CENTER);
	add(tp, BorderLayout.NORTH);

	setBorder(BorderFactory.createEtchedBorder());

}
 
Example 13
Source File: ChatPanel.java    From xyTalk-pc with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initView() {
	this.setLayout(new GridLayout(1, 1));

	if (roomId == null) {
		messagePanel.setVisible(false);
		messageEditorPanel.setVisible(false);
		DebugUtil.debug("roomId == null");
	}

	splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
	// splitPane.setBorder(new RCBorder(RCBorder.BOTTOM,
	// Colors.LIGHT_GRAY));
	splitPane.setBorder(null);
	// splitPane.setUI(new BasicSplitPaneUI());
	// BasicSplitPaneDivider divider = (BasicSplitPaneDivider)
	// splitPane.getComponent(0);
	// divider.setBackground(Colors.FONT_BLACK);
	// divider.setBorder(null);
	splitPane.setOneTouchExpandable(false);
	splitPane.setDividerLocation(450);
	// splitPane.setResizeWeight(0.1);
	splitPane.setDividerSize(2);

	splitPane.setTopComponent(messagePanel);
	splitPane.setBottomComponent(messageEditorPanel);
	splitPane.setPreferredSize(new Dimension(MainFrame.DEFAULT_WIDTH, MainFrame.DEFAULT_HEIGHT));
	// add(splitPane, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 4));
	// add(splitPane, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 10));
	add(splitPane);
	// add(messagePanel, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 4));
	// add(messageEditorPanel, new GBC(0, 1).setFill(GBC.BOTH).setWeight(1,
	// 1));

}
 
Example 14
Source File: ConsolePanel.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
private void initialize() {
    this.setIcon(
            new ImageIcon(ZAP.class.getResource("/resource/icon/16/059.png"))); // 'script' icon
    this.setDefaultAccelerator(
            extension
                    .getView()
                    .getMenuShortcutKeyStroke(
                            KeyEvent.VK_C,
                            KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK,
                            false));
    this.setMnemonic(Constant.messages.getChar("scripts.panel.mnemonic"));
    this.setLayout(new BorderLayout());
    startPollingForChanges();

    runnableScriptsToThreadMap =
            Collections.synchronizedMap(
                    new HashMap<ScriptWrapper, WeakReference<ScriptExecutorThread>>());

    panelContent = new JPanel(new GridBagLayout());
    this.add(panelContent, BorderLayout.CENTER);

    JSplitPane splitPane = new JSplitPane();
    splitPane.setDividerSize(3);
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPane.setResizeWeight(0.5D);
    splitPane.setTopComponent(getCommandPanel());
    splitPane.setBottomComponent(getOutputPanel());

    panelContent.add(this.getPanelToolbar(), LayoutHelper.getGBC(0, 0, 1, 1.0D, 0.0D));
    panelContent.add(splitPane, LayoutHelper.getGBC(0, 1, 1, 1.0D, 1.0D));
}
 
Example 15
Source File: DomGameFrame.java    From DominionSim with MIT License 5 votes vote down vote up
private JSplitPane getTopSplit() {
	JSplitPane theSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false, getLogPanel(), getInfoPanel());
	theSplit.setResizeWeight(1);
	theSplit.setDividerSize(1);
//	theSplit.resetToPreferredSizes();
	return theSplit;
}
 
Example 16
Source File: CodeEditor.java    From CQL with GNU Affero General Public License v3.0 5 votes vote down vote up
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 17
Source File: SummaryControllerUI.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void tweakSplitPaneUI(JSplitPane splitPane) {
    splitPane.setOpaque(false);
    splitPane.setBorder(null);
    splitPane.setDividerSize(3);

    if (!(splitPane.getUI() instanceof BasicSplitPaneUI)) {
        return;
    }

    BasicSplitPaneDivider divider = ((BasicSplitPaneUI) splitPane.getUI()).getDivider();

    if (divider != null) {
        divider.setBorder(null);
    }
}
 
Example 18
Source File: Demo5.java    From jexer with MIT License 4 votes vote down vote up
/**
 * Run two demo applications in separate panes.
 */
private void addApplications() {

    /*
     * In this demo we will create two swing panels with two
     * independently running applications, each with a different font
     * size.
     */

    /*
     * First we create a panel to put it on.  We need this to pass to
     * SwingBackend's constructor, so that it knows not to create a new
     * frame.
     */
    JPanel app1Panel = new JPanel();

    /*
     * Next, we create the Swing backend.  The "listener" (second
     * argument, set to null) is what the backend wakes up on every event
     * received.  Typically this is the TApplication.  TApplication sets
     * it in its constructor, so we can pass null here and be fine.
     */
    SwingBackend app1Backend = new SwingBackend(app1Panel, null,
        80, 25, 16);
    // Now that we have the backend, construct the TApplication.
    app1 = new DemoApplication(app1Backend);

    /*
     * The second panel is the same sequence, except that we also change
     * the font from the default Terminus to JVM monospaced.
     */
    JPanel app2Panel = new JPanel();
    SwingBackend app2Backend = new SwingBackend(app2Panel, null,
        80, 25, 18);
    app2 = new DemoApplication(app2Backend);
    Font font = new Font(Font.MONOSPACED, Font.PLAIN, 18);
    app2Backend.setFont(font);

    /*
     * Now that the applications are ready, spin them off on their
     * threads.
     */
    (new Thread(app1)).start();
    (new Thread(app2)).start();

    /*
     * The rest of this is standard Swing.  Set up a frame, a split pane,
     * put each of the panels on it, and make it visible.
     */
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.addWindowListener(this);
    JSplitPane mainPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
        app1Panel, app2Panel);
    mainPane.setOneTouchExpandable(true);
    mainPane.setDividerLocation(500);
    mainPane.setDividerSize(6);
    mainPane.setBorder(null);
    frame.setContentPane(mainPane);

    frame.setTitle("Two Jexer Apps In One Swing UI");
    frame.setSize(1000, 640);
    frame.setVisible(true);
}
 
Example 19
Source File: SqlChecker.java    From CQL with GNU Affero General Public License v3.0 4 votes vote down vote up
public SqlChecker() {

		JButton transButton = new JButton("Check");

		JComboBox<Example> box = new JComboBox<>(examples);
		box.setSelectedIndex(-1);
		box.addActionListener((ActionEvent e) -> input.setText(((Example) box.getSelectedItem()).getText()));

		transButton.addActionListener(x -> check());

		JPanel p = new JPanel(new BorderLayout());

		JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		jsp.setBorder(BorderFactory.createEmptyBorder());
		jsp.setDividerSize(2);
		jsp.setResizeWeight(0.5d);
		jsp.add(input);
		jsp.add(output);

		JPanel tp = new JPanel(new GridLayout(1, 4));

		tp.add(transButton);
		tp.add(haltOnErrors);
		tp.add(new JLabel("Load Example", SwingConstants.RIGHT));
		tp.add(box);

		p.add(jsp, BorderLayout.CENTER);
		p.add(tp, BorderLayout.NORTH);

		JSplitPane jspX = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		jspX.setBorder(BorderFactory.createEmptyBorder());

		JPanel panX = new JPanel(new GridLayout(1, 1));
		jspX.setDividerSize(2);
		jspX.setResizeWeight(0.4d);

		panX.add(jspX);
		jspX.add(loader);
		jspX.add(p);

		p.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "SQL Checker"));

		JFrame f = new JFrame("SQL Checker");
		f.setContentPane(panX);
		f.pack();
		f.setSize(new Dimension(700, 600));
		f.setLocationRelativeTo(null);
		f.setVisible(true);
	}
 
Example 20
Source File: MainGui.java    From libreveris with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void defineLayout ()
{
    /*
     * +=============================================================+
     * |toolKeyPanel . . . . . . . . . . . . . . . . . . . . . . . . |
     * |+=================+=============================+===========+|
     * || toolBar . . . . . . . . . .| progressBar . . .| Memory . .||
     * |+=================+=============================+===========+|
     * +=============================================================+
     * | horiSplitPane . . . . . . . . . . . . . . . . . . . . . . . |
     * |+=========================================+=================+|
     * | . . . . . . . . . . . . . . . . . . . . .|boardsScrollPane ||
     * | +========================================+ . . . . . . . . ||
     * | | sheetController . . . . . . . . . . . .| . . . . . . . . ||
     * | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * | | . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |v| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |e| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |r| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |t| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |S| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |p| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |l| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |i| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |t| . . . . . . . . . . . . . . . . . . . .| . . . . . . . . ||
     * |P+=====================+==================+ . . . . . . . . ||
     * |a| logPane . . . . . . | errors . . . . . | . . . . . . . . ||
     * |n| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
     * |e| . . . . . . . . . . |. . . . . . . . . | . . . . . . . . ||
     * | +=====================+==================+=================+|
     * +=============================================================+
     */

    // Individual panes
    logPane = new LogPane();
    boardsScrollPane = new BoardsScrollPane();
    boardsScrollPane.setPreferredSize(new Dimension(350, 500));

    // Bottom = Log & Errors
    bottomPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    bottomPane.setBorder(null);
    bottomPane.setDividerSize(1);
    bottomPane.setResizeWeight(0.5d); // Cut in half initially

    // mainPane =  sheetsController / bottomPane
    mainPane = new JSplitPane(
            JSplitPane.VERTICAL_SPLIT,
            sheetsController.getComponent(),
            null);
    mainPane.setBorder(null);
    mainPane.setDividerSize(1);
    mainPane.setResizeWeight(0.9d); // Give bulk space to upper part

    // horiSplitPane = mainPane | boards
    appPane = new Panel();
    appPane.setNoInsets();
    appPane.setBorder(null);
    appPane.setLayout(new BorderLayout());
    appPane.add(mainPane, BorderLayout.CENTER); // + boardsScrollPane later
    appPane.setName("appPane");

    // Global layout: Use a toolbar on top and a double split pane below
    ///toolBar.add(toolKeyPanel);
    Container content = frame.getContentPane();
    content.setLayout(new BorderLayout());
    content.add(
            ActionManager.getInstance().getToolBar(),
            BorderLayout.NORTH);
    content.add(appPane, BorderLayout.CENTER);

    // Suppress all internal borders, recursively
    ///UIUtilities.suppressBorders(frame.getContentPane());

    // Display the boards pane?
    if (GuiActions.getInstance()
            .isBoardsDisplayed()) {
        appPane.add(boardsScrollPane, BorderLayout.EAST);
    }

    // Display the log pane?
    if (GuiActions.getInstance()
            .isLogDisplayed()) {
        bottomPane.setLeftComponent(logPane.getComponent());
    }

    // Display the errors pane?
    if (GuiActions.getInstance()
            .isErrorsDisplayed()) {
        bottomPane.setRightComponent(null);
    }

    // BottomPane = Log & Errors
    if (needBottomPane()) {
        mainPane.setBottomComponent(bottomPane);
    }
}