Java Code Examples for javax.swing.UIManager#getBoolean()

The following examples show how to use javax.swing.UIManager#getBoolean() . 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: SeaGlassDesktopIconUI.java    From seaglass with Apache License 2.0 6 votes vote down vote up
protected void installComponents() {
    if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
        iconPane = new JToggleButton(frame.getTitle(), frame.getFrameIcon()) {
            public String getToolTipText() {
                return getText();
            }

            public JPopupMenu getComponentPopupMenu() {
                return frame.getComponentPopupMenu();
            }
        };
        ToolTipManager.sharedInstance().registerComponent(iconPane);
        iconPane.setFont(desktopIcon.getFont());
        iconPane.setBackground(desktopIcon.getBackground());
        iconPane.setForeground(desktopIcon.getForeground());
    } else {
        iconPane = new SeaGlassInternalFrameTitlePane(frame);
        iconPane.setName("InternalFrame.northPane");
    }
    desktopIcon.setLayout(new BorderLayout());
    desktopIcon.add(iconPane, BorderLayout.CENTER);
}
 
Example 2
Source File: FlatTreeUI.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installBorder( tree, "Tree.border" );

	selectionBackground = UIManager.getColor( "Tree.selectionBackground" );
	selectionForeground = UIManager.getColor( "Tree.selectionForeground" );
	selectionInactiveBackground = UIManager.getColor( "Tree.selectionInactiveBackground" );
	selectionInactiveForeground = UIManager.getColor( "Tree.selectionInactiveForeground" );
	selectionBorderColor = UIManager.getColor( "Tree.selectionBorderColor" );
	wideSelection = UIManager.getBoolean( "Tree.wideSelection" );
	showCellFocusIndicator = UIManager.getBoolean( "Tree.showCellFocusIndicator" );

	// scale
	int rowHeight = FlatUIUtils.getUIInt( "Tree.rowHeight", 16 );
	if( rowHeight > 0 )
		LookAndFeel.installProperty( tree, "rowHeight", UIScale.scale( rowHeight ) );
	setLeftChildIndent( UIScale.scale( getLeftChildIndent() ) );
	setRightChildIndent( UIScale.scale( getRightChildIndent() ) );
}
 
Example 3
Source File: SeaGlassDesktopPaneUI.java    From seaglass with Apache License 2.0 5 votes vote down vote up
protected void installDesktopManager() {
    if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
        desktopManager = oldDesktopManager = desktop.getDesktopManager();
        if (!(desktopManager instanceof SeaGlassDesktopManager)) {
            desktopManager = new SeaGlassDesktopManager();
            desktop.setDesktopManager(desktopManager);
        }
    } else {
        super.installDesktopManager();
    }
}
 
Example 4
Source File: MultiSplitPane.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public MultiSplitPane() {
    setLayout( new MultiSplitLayout() );
    addMouseMotionListener( this );
    addMouseListener( this );

    Color bkColor = UIManager.getColor("NbSplitPane.background");
    if( null != bkColor ) {
        setBackground(bkColor);
        setOpaque(true);
    }
    if( UIManager.getBoolean( "NbMainWindow.showCustomBackground" ) ) //NOI18N
        setOpaque(false);
}
 
Example 5
Source File: SlideBarContainer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public VisualPanel (SlideBarContainer modeContainer) {
    super(new BorderLayout());
    this.modeContainer = modeContainer;
    // To be able to activate on mouse click.
    enableEvents(java.awt.AWTEvent.MOUSE_EVENT_MASK);
    side = modeContainer.getSlidingView().getSide();
    if( isAqua ) {
        setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        setOpaque(true);
    }
    if( UIManager.getBoolean( "NbMainWindow.showCustomBackground" ) ) //NOI18N
        setOpaque( false);
}
 
Example 6
Source File: SwingUtilities2.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the client property for the given key if it is set; otherwise
 * returns the {@L&F} property.
 *
 * @param component the component
 * @param key an {@code String} specifying the key for the desired boolean value
 * @return the boolean value of the client property if it is set or the {@L&F}
 *         property in other case.
 */
public static boolean getBoolean(JComponent component, String key) {
    Object clientProperty = component.getClientProperty(key);

    if (clientProperty instanceof Boolean) {
        return Boolean.TRUE.equals(clientProperty);
    }

    return UIManager.getBoolean(key);
}
 
Example 7
Source File: ProfilerTreeTable.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public void setUI(TreeUI ui) {
            if (ui instanceof SynthTreeUI) {
//                if (synthLikeUI == null) {
                    super.setUI(ui);
                    SynthTreeUI synthUI = (SynthTreeUI)ui;
                    int left = synthUI.getLeftChildIndent();
                    int right = synthUI.getRightChildIndent();

                    synthLikeUI = new SynthLikeTreeUI();
                    super.setUI(synthLikeUI);

                    boolean nimbus = UIUtils.isNimbusLookAndFeel();
                    synthLikeUI.setLeftChildIndent(left + (nimbus ? 4 : 6));
                    synthLikeUI.setRightChildIndent(right);
//                } else {
//                    super.setUI(synthLikeUI);
//                }
            } else {
                synthLikeUI = null;
                
                super.setUI(ui);
                
                // #269500 - performance workaround for BasicTreeUI
                if (!DISABLE_TREEUI_FIX && ui instanceof BasicTreeUI)
                    workaroundVerticalLines = UIManager.getBoolean("Tree.paintLines"); // NOI18N
            }
        }
 
Example 8
Source File: FlatComboBoxUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installProperty( comboBox, "opaque", false );

	minimumWidth = UIManager.getInt( "ComboBox.minimumWidth" );
	editorColumns = UIManager.getInt( "ComboBox.editorColumns" );
	buttonStyle = UIManager.getString( "ComboBox.buttonStyle" );
	arrowType = UIManager.getString( "Component.arrowType" );
	isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
	borderColor = UIManager.getColor( "Component.borderColor" );
	disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );

	editableBackground = UIManager.getColor( "ComboBox.editableBackground" );
	disabledBackground = UIManager.getColor( "ComboBox.disabledBackground" );
	disabledForeground = UIManager.getColor( "ComboBox.disabledForeground" );

	buttonBackground = UIManager.getColor( "ComboBox.buttonBackground" );
	buttonEditableBackground = UIManager.getColor( "ComboBox.buttonEditableBackground" );
	buttonArrowColor = UIManager.getColor( "ComboBox.buttonArrowColor" );
	buttonDisabledArrowColor = UIManager.getColor( "ComboBox.buttonDisabledArrowColor" );
	buttonHoverArrowColor = UIManager.getColor( "ComboBox.buttonHoverArrowColor" );

	// set maximumRowCount
	int maximumRowCount = UIManager.getInt( "ComboBox.maximumRowCount" );
	if( maximumRowCount > 0 && maximumRowCount != 8 && comboBox.getMaximumRowCount() == 8 )
		comboBox.setMaximumRowCount( maximumRowCount );

	// scale
	padding = UIScale.scale( padding );

	MigLayoutVisualPadding.install( comboBox );
}
 
Example 9
Source File: FlatTextFieldUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	String prefix = getPropertyPrefix();
	minimumWidth = UIManager.getInt( "Component.minimumWidth" );
	isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
	placeholderForeground = UIManager.getColor( prefix + ".placeholderForeground" );

	LookAndFeel.installProperty( getComponent(), "opaque", false );

	MigLayoutVisualPadding.install( getComponent() );
}
 
Example 10
Source File: LookAndFeelAddons.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
/**
 * With applets, if you reload the current applet, the UIManager will be
 * reinitialized (entries previously added by LookAndFeelAddons will be
 * removed) but the addon will not reinitialize because addon initialize
 * itself through the static block in components and the classes do not get
 * reloaded. This means component.updateUI will fail because it will not find
 * its UI.
 * 
 * This method ensures LookAndFeelAddons get re-initialized if needed. It must
 * be called in every component updateUI methods.
 */
private static synchronized void maybeInitialize() {
  if (currentAddon != null) {
    // this is to ensure "UIManager#maybeInitialize" gets called and the
    // LAFState initialized
    UIManager.getLookAndFeelDefaults();
    
    if (!UIManager.getBoolean(APPCONTEXT_INITIALIZED)) {
      setAddon(currentAddon);
    }
  }
}
 
Example 11
Source File: FlatViewTabDisplayerUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Initialization of colors
 */
private static void initColors() {
    if (!colorsReady) {
        background = UIManager.getColor("ViewTab.background"); // NOI18N
        activeBackground = Utils.getUIColor("ViewTab.activeBackground", background); // NOI18N
        selectedBackground = Utils.getUIColor("ViewTab.selectedBackground", activeBackground); // NOI18N
        hoverBackground = UIManager.getColor("ViewTab.hoverBackground"); // NOI18N
        attentionBackground = UIManager.getColor("ViewTab.attentionBackground"); // NOI18N

        foreground = Utils.getUIColor("ViewTab.foreground", "TabbedPane.foreground"); // NOI18N
        activeForeground = Utils.getUIColor("ViewTab.activeForeground", foreground); // NOI18N
        selectedForeground = Utils.getUIColor("ViewTab.selectedForeground", activeForeground); // NOI18N
        hoverForeground = Utils.getUIColor("ViewTab.hoverForeground", foreground); // NOI18N
        attentionForeground = Utils.getUIColor("ViewTab.attentionForeground", foreground); // NOI18N

        underlineColor = UIManager.getColor("ViewTab.underlineColor"); // NOI18N
        inactiveUnderlineColor = UIManager.getColor("ViewTab.inactiveUnderlineColor"); // NOI18N
        tabSeparatorColor = UIManager.getColor("ViewTab.tabSeparatorColor"); // NOI18N
        contentBorderColor = UIManager.getColor("TabbedContainer.view.contentBorderColor"); // NOI18N

        tabInsets = UIManager.getInsets("ViewTab.tabInsets"); // NOI18N
        underlineHeight = UIManager.getInt("ViewTab.underlineHeight"); // NOI18N
        underlineAtTop = UIManager.getBoolean("ViewTab.underlineAtTop"); // NOI18N
        showTabSeparators = UIManager.getBoolean("ViewTab.showTabSeparators"); // NOI18N

        // scale on Java 8 and Linux
        tabInsets = UIScale.scale(tabInsets);
        underlineHeight = UIScale.scale(underlineHeight);

        colorsReady = true;
    }
}
 
Example 12
Source File: ProfilerTreeTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void setUI(TreeUI ui) {
            if (ui instanceof SynthTreeUI) {
//                if (synthLikeUI == null) {
                    super.setUI(ui);
                    SynthTreeUI synthUI = (SynthTreeUI)ui;
                    int left = synthUI.getLeftChildIndent();
                    int right = synthUI.getRightChildIndent();

                    synthLikeUI = new SynthLikeTreeUI();
                    super.setUI(synthLikeUI);

                    boolean nimbus = UIUtils.isNimbusLookAndFeel();
                    synthLikeUI.setLeftChildIndent(left + (nimbus ? 4 : 6));
                    synthLikeUI.setRightChildIndent(right);
//                } else {
//                    super.setUI(synthLikeUI);
//                }
            } else {
                synthLikeUI = null;
                
                super.setUI(ui);
                
                // #269500 - performance workaround for BasicTreeUI
                if (!DISABLE_TREEUI_FIX && ui instanceof BasicTreeUI)
                    workaroundVerticalLines = UIManager.getBoolean("Tree.paintLines"); // NOI18N
            }
        }
 
Example 13
Source File: FlatTextAreaUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	minimumWidth = UIManager.getInt( "Component.minimumWidth" );
	isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
	disabledBackground = UIManager.getColor( "TextArea.disabledBackground" );
	inactiveBackground = UIManager.getColor( "TextArea.inactiveBackground" );
}
 
Example 14
Source File: DesktopImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void updateCorners() {
    if( UIManager.getBoolean( "NbMainWindow.showCustomBackground" ) ) //NOI18N
        return;
    
    SlidingView leftSlide = null;
    SlidingView topSlide = null;
    for( SlidingView view : slidingViews ) {
        if( Constants.LEFT.equals(view.getSide()) ) {
            leftSlide = view;
        }
        if( Constants.TOP.equals(view.getSide()) ) {
            topSlide = view;
        }
    }
    if( null == leftSlide || null == topSlide )
        return;

    desktop.setOpaque(true);
    if( !leftSlide.getTopComponents().isEmpty() || !topSlide.getTopComponents().isEmpty() ) {
        desktop.setBackground(new JPanel().getBackground());
    } else {
        Color bkColor = UIManager.getColor("NbSplitPane.background"); //NOI18N
        if( null != bkColor ) {
            desktop.setBackground(bkColor);
        }
    }
}
 
Example 15
Source File: FlatPasswordFieldUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	String prefix = getPropertyPrefix();
	minimumWidth = UIManager.getInt( "Component.minimumWidth" );
	isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
	placeholderForeground = UIManager.getColor( prefix + ".placeholderForeground" );
	capsLockIcon = UIManager.getIcon( "PasswordField.capsLockIcon" );

	LookAndFeel.installProperty( getComponent(), "opaque", false );

	MigLayoutVisualPadding.install( getComponent() );
}
 
Example 16
Source File: TabTableUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static Border createTabBorder( JTable table, int tabsLocation ) {
    if( IS_AQUA ) {
        return BorderFactory.createMatteBorder( 1, 0, 0, 0, table.getGridColor());
    } else {
        if( tabsLocation != JTabbedPane.TOP && !UIManager.getBoolean("nb.multitabs.noTabBorder") ) //NOI18N
            return BorderFactory.createMatteBorder( 1, 0, 0, 0, table.getGridColor());
    }
    return BorderFactory.createEmptyBorder();
}
 
Example 17
Source File: FileChooserUI.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public Action getNewFolderAction() {
	Action newFolderAction = new NewFolderAction();
	// Note: Don't return null for readOnly, it might
	// break older apps.
	if (UIManager.getBoolean("FileChooser.readOnly")) {
		newFolderAction.setEnabled(false);
	}
	return newFolderAction;
}
 
Example 18
Source File: Utils.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static boolean isSimpleTabs() {
    return UIManager.getBoolean( "nb.startpage.simpletabs" ); //NOI18N
}
 
Example 19
Source File: BEToolBarUI.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
public void paint(Graphics g, JComponent c) 
{
	//~* @since 3.4, add by Jack Jiang 2012-11-05
	//~* 【BeautyEye外观的特有定制属性】:true表示BEToolBarUI里,将使用其它典型外观
	//~*  一样的默认纯色填充背景(颜色由ToolBar.background属性指定), 否则将使用BeautyEye
	//~*  默认的渐变NinePatch图实现背景的填充。另外,还可以使用
	//~*  JToolBar.putClientProperty("ToolBar.isPaintPlainBackground", Boolean.TRUE);来进行
	//~*  独立控制背景的填充方法,ClientProperty相比UIManager中的本方法拥有最高优先级
	boolean isPaintPlainBackground = false;
	String isPaintPlainBackgroundKey = "ToolBar.isPaintPlainBackground";//~* 【BeautyEye外观的特有定制属性】@since 3.4
	//首先看看有没有独立在ClientProperty中设置"ToolBar.isPaintPlainBackground"属性(ClientProperty中设置拥有最高优先级)
	Object isPaintPlainBackgroundObj = c.getClientProperty(isPaintPlainBackgroundKey);
	//如果ClientProperty中没有设置,则尝试取UIManager中的该属性默认值
	if(isPaintPlainBackgroundObj == null)
		isPaintPlainBackgroundObj = UIManager.getBoolean(isPaintPlainBackgroundKey);
	if(isPaintPlainBackgroundObj != null)
		isPaintPlainBackground = (Boolean)isPaintPlainBackgroundObj;
	
	//* 如果用户作了自定义颜色设置则使用父类方法来实现绘制,否则BE LNF中没法支持这些设置哦
   	if(isPaintPlainBackground || isUseParentPaint())
   	{
   		super.paint(g, c);
   	}
   	else
   	{
   		//* 根据工具条所放在父类的位置不同来决定它的背景该使用哪个图片(图片的差别在于方向不同,主要是边缘阴影的方向)
   		NinePatch np = __Icon9Factory__.getInstance().getToolBarBg_NORTH();
   		//int orientation = toolBar.getOrientation();
   		Container parent = toolBar.getParent();
   		if(parent != null)
   		{
   			LayoutManager lm = parent.getLayout();
   			if(lm instanceof BorderLayout)
   			{
   				Object cons = ((BorderLayout)lm).getConstraints(toolBar);
   				if(cons != null)
   				{
   					if(cons.equals(BorderLayout.NORTH))
   						np = __Icon9Factory__.getInstance().getToolBarBg_NORTH();
   					else if(cons.equals(BorderLayout.SOUTH))
   						np = __Icon9Factory__.getInstance().getToolBarBg_SOUTH();
   					else if(cons.equals(BorderLayout.WEST))
   						np = __Icon9Factory__.getInstance().getToolBarBg_WEST();
   					else if(cons.equals(BorderLayout.EAST))
   						np = __Icon9Factory__.getInstance().getToolBarBg_EAST();
   				}
   			}
   		}
   		np.draw((Graphics2D)g, 0, 0, c.getWidth(), c.getHeight());
   	}
}
 
Example 20
Source File: ImageUtilities.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static boolean isDarkLaF() {
    return UIManager.getBoolean("nb.dark.theme"); //NOI18N 
}