javax.swing.plaf.basic.BasicSplitPaneUI Java Examples

The following examples show how to use javax.swing.plaf.basic.BasicSplitPaneUI. 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: DiffSplitPaneDivider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
DiffSplitPaneDivider(BasicSplitPaneUI splitPaneUI, EditableDiffView master) {
    super(splitPaneUI);
    this.master = master;
    fontColor = new JLabel().getForeground();

    actionIconsHeight = insertAllImage.getHeight(this);
    actionIconsWidth = insertAllImage.getWidth(this);
    
    setBorder(null);
    setLayout(new BorderLayout());
    mydivider = new DiffSplitDivider();
    add(mydivider);
    
    addMouseListener(this);
    addMouseMotionListener(this);
}
 
Example #2
Source File: OurUtil.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
private MainPanel() {
  super(new GridLayout(2, 1));

  JSplitPane splitPane = new JSplitPane();
  Container divider = ((BasicSplitPaneUI) splitPane.getUI()).getDivider();
  divider.addMouseListener(new MouseAdapter() {
    @Override public void mousePressed(MouseEvent e) {
      super.mousePressed(e);
      splitPane.requestFocusInWindow();
      // or
      // Action startResize = splitPane.getActionMap().get("startResize");
      // startResize.actionPerformed(new ActionEvent(splitPane, ActionEvent.ACTION_PERFORMED, "startResize"));
    }
  });

  add(makeTitledPanel("Default", new JSplitPane()));
  add(makeTitledPanel("Divider.addMouseListener", splitPane));
  setPreferredSize(new Dimension(320, 240));
}
 
Example #4
Source File: PluggableTreeTableView.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
protected JComponent createComponent() {
    final JComponent comp = super.createComponent();
    
    if (toolbar == null) init();
    
    JExtendedSplitPane contentSplit = new JExtendedSplitPane(JExtendedSplitPane.VERTICAL_SPLIT, true, comp, pluginsComponent) {
        public boolean requestFocusInWindow() {
            return comp.requestFocusInWindow();
        }
    };
    BasicSplitPaneDivider contentDivider = ((BasicSplitPaneUI)contentSplit.getUI()).getDivider();
    contentDivider.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, SEPARATOR_COLOR));
    contentDivider.setDividerSize(5);
    contentSplit.setBorder(BorderFactory.createEmptyBorder());
    contentSplit.setResizeWeight(0.7d);
    
    return contentSplit;
}
 
Example #5
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 #6
Source File: JExtendedSplitPane.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Component getDivider() {
    if (getUI() == null) {
        return null;
    }

    return ((BasicSplitPaneUI) getUI()).getDivider();
}
 
Example #7
Source File: CombinedPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void tweakUI() {
    setBorder(null);
    setDividerSize(5);

    if (!(getUI() instanceof BasicSplitPaneUI)) return;

    BasicSplitPaneDivider divider = ((BasicSplitPaneUI)getUI()).getDivider();
    if (divider != null) {
        Color c = UIUtils.isNimbus() ? UIUtils.getDisabledLineColor() :
                new JSeparator().getForeground();
        divider.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, c));
    }
}
 
Example #8
Source File: PaneBuilders.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected BasicSplitPaneDivider createInstanceImpl() {
    final JSplitPane split = new JSplitPane(orientation);
    BasicSplitPaneUI ui = split.getUI() instanceof BasicSplitPaneUI ?
            (BasicSplitPaneUI)split.getUI() : new BasicSplitPaneUI() {
                { installUI(split); }
            };
    return new BasicSplitPaneDivider(ui);
}
 
Example #9
Source File: MotifSplitPaneDivider.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Motif SplitPaneDivider
 */
public MotifSplitPaneDivider(BasicSplitPaneUI ui) {
    super(ui);
    highlightColor = UIManager.getColor("SplitPane.highlight");
    shadowColor = UIManager.getColor("SplitPane.shadow");
    focusedColor = UIManager.getColor("SplitPane.activeThumb");
    setDividerSize(hThumbWidth + pad);
}
 
Example #10
Source File: SummaryControllerUI.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 #11
Source File: JCompoundSplitPane.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void tweakUI() {
    if (!(getUI() instanceof BasicSplitPaneUI)) {
        return;
    }

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

    if (divider != null) {
        divider.addMouseListener(new DividerMouseListener());
    }
}
 
Example #12
Source File: InstancesControllerUI.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 #13
Source File: MotifSplitPaneDivider.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Motif SplitPaneDivider
 */
public MotifSplitPaneDivider(BasicSplitPaneUI ui) {
    super(ui);
    highlightColor = UIManager.getColor("SplitPane.highlight");
    shadowColor = UIManager.getColor("SplitPane.shadow");
    focusedColor = UIManager.getColor("SplitPane.activeThumb");
    setDividerSize(hThumbWidth + pad);
}
 
Example #14
Source File: MotifSplitPaneDivider.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the SplitPaneUI that is using the receiver. This is completely
 * overriden from super to create a different MouseHandler.
 */
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
    if (splitPane != null) {
        splitPane.removePropertyChangeListener(this);
       if (mouseHandler != null) {
           splitPane.removeMouseListener(mouseHandler);
           splitPane.removeMouseMotionListener(mouseHandler);
           removeMouseListener(mouseHandler);
           removeMouseMotionListener(mouseHandler);
           mouseHandler = null;
       }
    }
    splitPaneUI = newUI;
    if (newUI != null) {
        splitPane = newUI.getSplitPane();
        if (splitPane != null) {
            if (mouseHandler == null) mouseHandler=new MotifMouseHandler();
            splitPane.addMouseListener(mouseHandler);
            splitPane.addMouseMotionListener(mouseHandler);
            addMouseListener(mouseHandler);
            addMouseMotionListener(mouseHandler);
            splitPane.addPropertyChangeListener(this);
            if (splitPane.isOneTouchExpandable()) {
                oneTouchExpandableChanged();
            }
        }
    }
    else {
        splitPane = null;
    }
}
 
Example #15
Source File: MotifSplitPaneDivider.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Motif SplitPaneDivider
 */
public MotifSplitPaneDivider(BasicSplitPaneUI ui) {
    super(ui);
    highlightColor = UIManager.getColor("SplitPane.highlight");
    shadowColor = UIManager.getColor("SplitPane.shadow");
    focusedColor = UIManager.getColor("SplitPane.activeThumb");
    setDividerSize(hThumbWidth + pad);
}
 
Example #16
Source File: MotifSplitPaneDivider.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the SplitPaneUI that is using the receiver. This is completely
 * overriden from super to create a different MouseHandler.
 */
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
    if (splitPane != null) {
        splitPane.removePropertyChangeListener(this);
       if (mouseHandler != null) {
           splitPane.removeMouseListener(mouseHandler);
           splitPane.removeMouseMotionListener(mouseHandler);
           removeMouseListener(mouseHandler);
           removeMouseMotionListener(mouseHandler);
           mouseHandler = null;
       }
    }
    splitPaneUI = newUI;
    if (newUI != null) {
        splitPane = newUI.getSplitPane();
        if (splitPane != null) {
            if (mouseHandler == null) mouseHandler=new MotifMouseHandler();
            splitPane.addMouseListener(mouseHandler);
            splitPane.addMouseMotionListener(mouseHandler);
            addMouseListener(mouseHandler);
            addMouseMotionListener(mouseHandler);
            splitPane.addPropertyChangeListener(this);
            if (splitPane.isOneTouchExpandable()) {
                oneTouchExpandableChanged();
            }
        }
    }
    else {
        splitPane = null;
    }
}
 
Example #17
Source File: ClassesControllerUI.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: JCompoundSplitPane.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void tweakUI() {
    if (!(getUI() instanceof BasicSplitPaneUI)) {
        return;
    }

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

    if (divider != null) {
        divider.addMouseListener(new DividerMouseListener());
    }
}
 
Example #19
Source File: MotifSplitPaneDivider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Motif SplitPaneDivider
 */
public MotifSplitPaneDivider(BasicSplitPaneUI ui) {
    super(ui);
    highlightColor = UIManager.getColor("SplitPane.highlight");
    shadowColor = UIManager.getColor("SplitPane.shadow");
    focusedColor = UIManager.getColor("SplitPane.activeThumb");
    setDividerSize(hThumbWidth + pad);
}
 
Example #20
Source File: MotifSplitPaneDivider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the SplitPaneUI that is using the receiver. This is completely
 * overriden from super to create a different MouseHandler.
 */
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
    if (splitPane != null) {
        splitPane.removePropertyChangeListener(this);
       if (mouseHandler != null) {
           splitPane.removeMouseListener(mouseHandler);
           splitPane.removeMouseMotionListener(mouseHandler);
           removeMouseListener(mouseHandler);
           removeMouseMotionListener(mouseHandler);
           mouseHandler = null;
       }
    }
    splitPaneUI = newUI;
    if (newUI != null) {
        splitPane = newUI.getSplitPane();
        if (splitPane != null) {
            if (mouseHandler == null) mouseHandler=new MotifMouseHandler();
            splitPane.addMouseListener(mouseHandler);
            splitPane.addMouseMotionListener(mouseHandler);
            addMouseListener(mouseHandler);
            addMouseMotionListener(mouseHandler);
            splitPane.addPropertyChangeListener(this);
            if (splitPane.isOneTouchExpandable()) {
                oneTouchExpandableChanged();
            }
        }
    }
    else {
        splitPane = null;
    }
}
 
Example #21
Source File: MotifSplitPaneDivider.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new Motif SplitPaneDivider
 */
public MotifSplitPaneDivider(BasicSplitPaneUI ui) {
    super(ui);
    highlightColor = UIManager.getColor("SplitPane.highlight");
    shadowColor = UIManager.getColor("SplitPane.shadow");
    focusedColor = UIManager.getColor("SplitPane.activeThumb");
    setDividerSize(hThumbWidth + pad);
}
 
Example #22
Source File: MotifSplitPaneDivider.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the SplitPaneUI that is using the receiver. This is completely
 * overriden from super to create a different MouseHandler.
 */
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
    if (splitPane != null) {
        splitPane.removePropertyChangeListener(this);
       if (mouseHandler != null) {
           splitPane.removeMouseListener(mouseHandler);
           splitPane.removeMouseMotionListener(mouseHandler);
           removeMouseListener(mouseHandler);
           removeMouseMotionListener(mouseHandler);
           mouseHandler = null;
       }
    }
    splitPaneUI = newUI;
    if (newUI != null) {
        splitPane = newUI.getSplitPane();
        if (splitPane != null) {
            if (mouseHandler == null) mouseHandler=new MotifMouseHandler();
            splitPane.addMouseListener(mouseHandler);
            splitPane.addMouseMotionListener(mouseHandler);
            addMouseListener(mouseHandler);
            addMouseMotionListener(mouseHandler);
            splitPane.addPropertyChangeListener(this);
            if (splitPane.isOneTouchExpandable()) {
                oneTouchExpandableChanged();
            }
        }
    }
    else {
        splitPane = null;
    }
}
 
Example #23
Source File: Splitter.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public void reshape(int x, int y, int width, int height) {
    super.reshape(x, y, width, height);
    if (width > 0 && height > 0 && requestedDividerLocation != -1) {
        super.setDividerLocation(requestedDividerLocation);
        dividerLocation = requestedDividerLocation;
        // SplitPaneUI.paint() needs to be invoked here to set the
        // BasicSplitPaneUI.painted flag to enable resizing the divider
        // even if the component hasn't been shown yet.
        ((BasicSplitPaneUI)getUI()).paint(getGraphics(), this);
        requestedDividerLocation = -1;
    }
}
 
Example #24
Source File: MotifSplitPaneDivider.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Motif SplitPaneDivider
 */
public MotifSplitPaneDivider(BasicSplitPaneUI ui) {
    super(ui);
    highlightColor = UIManager.getColor("SplitPane.highlight");
    shadowColor = UIManager.getColor("SplitPane.shadow");
    focusedColor = UIManager.getColor("SplitPane.activeThumb");
    setDividerSize(hThumbWidth + pad);
}
 
Example #25
Source File: MotifSplitPaneDivider.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the SplitPaneUI that is using the receiver. This is completely
 * overriden from super to create a different MouseHandler.
 */
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
    if (splitPane != null) {
        splitPane.removePropertyChangeListener(this);
       if (mouseHandler != null) {
           splitPane.removeMouseListener(mouseHandler);
           splitPane.removeMouseMotionListener(mouseHandler);
           removeMouseListener(mouseHandler);
           removeMouseMotionListener(mouseHandler);
           mouseHandler = null;
       }
    }
    splitPaneUI = newUI;
    if (newUI != null) {
        splitPane = newUI.getSplitPane();
        if (splitPane != null) {
            if (mouseHandler == null) mouseHandler=new MotifMouseHandler();
            splitPane.addMouseListener(mouseHandler);
            splitPane.addMouseMotionListener(mouseHandler);
            addMouseListener(mouseHandler);
            addMouseMotionListener(mouseHandler);
            splitPane.addPropertyChangeListener(this);
            if (splitPane.isOneTouchExpandable()) {
                oneTouchExpandableChanged();
            }
        }
    }
    else {
        splitPane = null;
    }
}
 
Example #26
Source File: MotifSplitPaneDivider.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the SplitPaneUI that is using the receiver. This is completely
 * overriden from super to create a different MouseHandler.
 */
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
    if (splitPane != null) {
        splitPane.removePropertyChangeListener(this);
       if (mouseHandler != null) {
           splitPane.removeMouseListener(mouseHandler);
           splitPane.removeMouseMotionListener(mouseHandler);
           removeMouseListener(mouseHandler);
           removeMouseMotionListener(mouseHandler);
           mouseHandler = null;
       }
    }
    splitPaneUI = newUI;
    if (newUI != null) {
        splitPane = newUI.getSplitPane();
        if (splitPane != null) {
            if (mouseHandler == null) mouseHandler=new MotifMouseHandler();
            splitPane.addMouseListener(mouseHandler);
            splitPane.addMouseMotionListener(mouseHandler);
            addMouseListener(mouseHandler);
            addMouseMotionListener(mouseHandler);
            splitPane.addPropertyChangeListener(this);
            if (splitPane.isOneTouchExpandable()) {
                oneTouchExpandableChanged();
            }
        }
    }
    else {
        splitPane = null;
    }
}
 
Example #27
Source File: MotifSplitPaneDivider.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the SplitPaneUI that is using the receiver. This is completely
 * overriden from super to create a different MouseHandler.
 */
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
    if (splitPane != null) {
        splitPane.removePropertyChangeListener(this);
       if (mouseHandler != null) {
           splitPane.removeMouseListener(mouseHandler);
           splitPane.removeMouseMotionListener(mouseHandler);
           removeMouseListener(mouseHandler);
           removeMouseMotionListener(mouseHandler);
           mouseHandler = null;
       }
    }
    splitPaneUI = newUI;
    if (newUI != null) {
        splitPane = newUI.getSplitPane();
        if (splitPane != null) {
            if (mouseHandler == null) mouseHandler=new MotifMouseHandler();
            splitPane.addMouseListener(mouseHandler);
            splitPane.addMouseMotionListener(mouseHandler);
            addMouseListener(mouseHandler);
            addMouseMotionListener(mouseHandler);
            splitPane.addPropertyChangeListener(this);
            if (splitPane.isOneTouchExpandable()) {
                oneTouchExpandableChanged();
            }
        }
    }
    else {
        splitPane = null;
    }
}
 
Example #28
Source File: MotifSplitPaneDivider.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Motif SplitPaneDivider
 */
public MotifSplitPaneDivider(BasicSplitPaneUI ui) {
    super(ui);
    highlightColor = UIManager.getColor("SplitPane.highlight");
    shadowColor = UIManager.getColor("SplitPane.shadow");
    focusedColor = UIManager.getColor("SplitPane.activeThumb");
    setDividerSize(hThumbWidth + pad);
}
 
Example #29
Source File: MotifSplitPaneDivider.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the SplitPaneUI that is using the receiver. This is completely
 * overriden from super to create a different MouseHandler.
 */
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
    if (splitPane != null) {
        splitPane.removePropertyChangeListener(this);
       if (mouseHandler != null) {
           splitPane.removeMouseListener(mouseHandler);
           splitPane.removeMouseMotionListener(mouseHandler);
           removeMouseListener(mouseHandler);
           removeMouseMotionListener(mouseHandler);
           mouseHandler = null;
       }
    }
    splitPaneUI = newUI;
    if (newUI != null) {
        splitPane = newUI.getSplitPane();
        if (splitPane != null) {
            if (mouseHandler == null) mouseHandler=new MotifMouseHandler();
            splitPane.addMouseListener(mouseHandler);
            splitPane.addMouseMotionListener(mouseHandler);
            addMouseListener(mouseHandler);
            addMouseMotionListener(mouseHandler);
            splitPane.addPropertyChangeListener(this);
            if (splitPane.isOneTouchExpandable()) {
                oneTouchExpandableChanged();
            }
        }
    }
    else {
        splitPane = null;
    }
}
 
Example #30
Source File: MotifSplitPaneDivider.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new Motif SplitPaneDivider
 */
public MotifSplitPaneDivider(BasicSplitPaneUI ui) {
    super(ui);
    highlightColor = UIManager.getColor("SplitPane.highlight");
    shadowColor = UIManager.getColor("SplitPane.shadow");
    focusedColor = UIManager.getColor("SplitPane.activeThumb");
    setDividerSize(hThumbWidth + pad);
}