Example usage for javax.swing JSplitPane getUI

List of usage examples for javax.swing JSplitPane getUI

Introduction

In this page you can find the example usage for javax.swing JSplitPane getUI.

Prototype

@BeanProperty(bound = false, expert = true, description = "The L&F object that renders this component.")
public SplitPaneUI getUI() 

Source Link

Document

Returns the SplitPaneUI that is providing the current look and feel.

Usage

From source file:jmemorize.gui.swing.frames.MainFrame.java

public static void beautifyDividerBorder(final JSplitPane splitPane) {
    final BasicSplitPaneUI ui = (BasicSplitPaneUI) splitPane.getUI();
    ui.getDivider().setBorder(new EmptyBorder(5, 2, 5, 2));
}

From source file:com.nikonhacker.gui.EmulatorUI.java

/**
 * Method circumventing package access to getKeepHidden() method of BasicSplitPaneUI
 * @param splitPane/*from   w w  w .jav a  2  s. co m*/
 * @return true if one panel is hidden
 * @author inspired by http://java-swing-tips.googlecode.com/svn/trunk/OneTouchExpandable/src/java/example/MainPanel.java
 */
private boolean getKeepHidden(JSplitPane splitPane) {
    if (splitPane.getUI() instanceof BasicSplitPaneUI) {
        try {
            //noinspection RedundantArrayCreation
            Method getKeepHidden = BasicSplitPaneUI.class.getDeclaredMethod("getKeepHidden", new Class<?>[] {});
            getKeepHidden.setAccessible(true);
            return (Boolean) (getKeepHidden.invoke(splitPane.getUI()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return false;
}

From source file:com.nikonhacker.gui.EmulatorUI.java

/**
 * Method circumventing package access to setKeepHidden() method of BasicSplitPaneUI
 * @param splitPane//  www  .jav a  2  s .c o m
 * @param keepHidden
 * @author taken from http://java-swing-tips.googlecode.com/svn/trunk/OneTouchExpandable/src/java/example/MainPanel.java
 */
private void setKeepHidden(JSplitPane splitPane, boolean keepHidden) {
    if (splitPane.getUI() instanceof BasicSplitPaneUI) {
        try {
            Method setKeepHidden = BasicSplitPaneUI.class.getDeclaredMethod("setKeepHidden",
                    new Class<?>[] { Boolean.TYPE }); //boolean.class });
            setKeepHidden.setAccessible(true);
            setKeepHidden.invoke(splitPane.getUI(), new Object[] { keepHidden });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}