Java Code Examples for javax.swing.LookAndFeel#installProperty()

The following examples show how to use javax.swing.LookAndFeel#installProperty() . 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: SeaGlassScrollPaneUI.java    From seaglass with Apache License 2.0 6 votes vote down vote up
protected void installDefaults(JScrollPane scrollpane) {
    LookAndFeel.installBorder(scrollpane, "ScrollPane.border");
    LookAndFeel.installColorsAndFont(scrollpane, "ScrollPane.background", "ScrollPane.foreground", "ScrollPane.font");

    Border vpBorder = scrollpane.getViewportBorder();
    if ((vpBorder == null) || (vpBorder instanceof UIResource)) {
        vpBorder = UIManager.getBorder("ScrollPane.viewportBorder");
        scrollpane.setViewportBorder(vpBorder);
    }

    Object obj = UIManager.get("ScrollPane.cornerPainter");
    if (obj != null && obj instanceof SeaGlassPainter) {
        cornerPainter = (SeaGlassPainter) obj;
    }

    LookAndFeel.installProperty(scrollpane, "opaque", Boolean.TRUE);
    updateStyle(scrollpane);
}
 
Example 2
Source File: BEButtonUI.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
protected void installDefaults(AbstractButton b) {
		super.installDefaults(b);
		b.setOpaque(false);
		
		if(!defaults_initialized) {
			String pp = getPropertyPrefix();
			dashedRectGapX = UIManager.getInt(pp + "dashedRectGapX");
			dashedRectGapY = UIManager.getInt(pp + "dashedRectGapY");
			dashedRectGapWidth = UIManager.getInt(pp + "dashedRectGapWidth");
			dashedRectGapHeight = UIManager.getInt(pp + "dashedRectGapHeight");
			focusColor = UIManager.getColor(pp + "focus");
			defaults_initialized = true;
		}

//		BEXPStyle xp = BEXPStyle.getXP();
//		if (xp != null) 
		{
			b.setBorder(new XPEmptyBorder(new Insets(3,3,3,3)));//xp.getBorder(b, getXPButtonType(b)));
			LookAndFeel.installProperty(b, "rolloverEnabled", Boolean.TRUE);
		}
	}
 
Example 3
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 4
Source File: FlatRadioButtonMenuItemUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installProperty( menuItem, "iconTextGap", FlatUIUtils.getUIInt( "MenuItem.iconTextGap", 4 ) );

	renderer = createRenderer();
}
 
Example 5
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 6
Source File: FlatTableUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" );
	showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" );
	intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );

	selectionBackground = UIManager.getColor( "Table.selectionBackground" );
	selectionForeground = UIManager.getColor( "Table.selectionForeground" );
	selectionInactiveBackground = UIManager.getColor( "Table.selectionInactiveBackground" );
	selectionInactiveForeground = UIManager.getColor( "Table.selectionInactiveForeground" );

	toggleSelectionColors();

	int rowHeight = FlatUIUtils.getUIInt( "Table.rowHeight", 16 );
	if( rowHeight > 0 )
		LookAndFeel.installProperty( table, "rowHeight", UIScale.scale( rowHeight ) );

	if( !showHorizontalLines ) {
		oldShowHorizontalLines = table.getShowHorizontalLines();
		table.setShowHorizontalLines( false );
	}
	if( !showVerticalLines ) {
		oldShowVerticalLines = table.getShowVerticalLines();
		table.setShowVerticalLines( false );
	}

	if( intercellSpacing != null ) {
		oldIntercellSpacing = table.getIntercellSpacing();
		table.setIntercellSpacing( intercellSpacing );
	}

	// checkbox is non-opaque in FlatLaf and therefore would not paint selection
	// --> make checkbox renderer opaque (but opaque in Metal or Windows LaF)
	TableCellRenderer booleanRenderer = table.getDefaultRenderer( Boolean.class );
	if( booleanRenderer instanceof JCheckBox )
		((JCheckBox)booleanRenderer).setOpaque( true );
}
 
Example 7
Source File: FlatScrollPaneUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
public void installUI( JComponent c ) {
	super.installUI( c );

	int focusWidth = UIManager.getInt( "Component.focusWidth" );
	LookAndFeel.installProperty( c, "opaque", focusWidth == 0 );

	MigLayoutVisualPadding.install( scrollpane );
}
 
Example 8
Source File: FlatUIUtils.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
public static boolean hasOpaqueBeenExplicitlySet( JComponent c ) {
	boolean oldOpaque = c.isOpaque();
	LookAndFeel.installProperty( c, "opaque", !oldOpaque );
	boolean explicitlySet = c.isOpaque() == oldOpaque;
	LookAndFeel.installProperty( c, "opaque", oldOpaque );
	return explicitlySet;
}
 
Example 9
Source File: FlatSlidingButtonUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults(AbstractButton b) {
    super.installDefaults(b);

    if(!defaults_initialized) {
        hoverBackground = UIManager.getColor("SlidingButton.hoverBackground");
        selectedBackground = UIManager.getColor("SlidingButton.selectedBackground");
        attentionBackground = UIManager.getColor("SlidingButton.attentionBackground");
        attentionForeground = UIManager.getColor("SlidingButton.attentionForeground");
        defaults_initialized = true;
    }

    LookAndFeel.installProperty(b, "opaque", false);
}
 
Example 10
Source File: LuckInternalFrameUI.java    From littleluck with Apache License 2.0 5 votes vote down vote up
@Override
public void installUI(JComponent c)
{
    super.installUI(c);

    LookAndFeel.installProperty(frame, "opaque", Boolean.FALSE);
}
 
Example 11
Source File: LuckViewportUI.java    From littleluck with Apache License 2.0 5 votes vote down vote up
protected void installDefaults(JComponent c)
{
    LookAndFeel.installColorsAndFont(c, "Viewport.background",
            "Viewport.foreground", "Viewport.font");

    LookAndFeel.installProperty(c, "opaque", Boolean.FALSE);
}
 
Example 12
Source File: LuckMenuBarUI.java    From littleluck with Apache License 2.0 4 votes vote down vote up
public void installUI(JComponent c)
{
    super.installUI(c);

    LookAndFeel.installProperty(menuBar, "opaque", Boolean.FALSE);
}
 
Example 13
Source File: SeaGlassTreeUI.java    From seaglass with Apache License 2.0 4 votes vote down vote up
private void updateStyle(JTree tree) {
    SeaGlassContext context = getContext(tree, ENABLED);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);
    if (style != oldStyle) {
        Object value;

        setExpandedIcon(style.getIcon(context, "Tree.expandedIcon"));
        setCollapsedIcon(style.getIcon(context, "Tree.collapsedIcon"));

        setLeftChildIndent(style.getInt(context, "Tree.leftChildIndent", 0));
        setRightChildIndent(style.getInt(context, "Tree.rightChildIndent", 0));

        drawHorizontalLines = style.getBoolean(context, "Tree.drawHorizontalLines", true);
        drawVerticalLines = style.getBoolean(context, "Tree.drawVerticalLines", true);
        linesStyle = style.get(context, "Tree.linesStyle");

        value = style.get(context, "Tree.rowHeight");
        if (value != null) {
            LookAndFeel.installProperty(tree, "rowHeight", value);
        }

        value = style.get(context, "Tree.scrollsOnExpand");
        LookAndFeel.installProperty(tree, "scrollsOnExpand", value != null ? value : Boolean.TRUE);

        padding = style.getInt(context, "Tree.padding", 0);

        largeModel = (tree.isLargeModel() && tree.getRowHeight() > 0);

        useTreeColors = style.getBoolean(context, "Tree.rendererUseTreeColors", true);

        Boolean showsRootHandles = style.getBoolean(context, "Tree.showsRootHandles", Boolean.TRUE);
        LookAndFeel.installProperty(tree, JTree.SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles);

        if (oldStyle != null) {
            uninstallKeyboardActions();
            installKeyboardActions();
        }
    }
    context.dispose();

    context = getContext(tree, Region.TREE_CELL, ENABLED);
    cellStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.dispose();
}
 
Example 14
Source File: SynthTreeUI.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private void updateStyle(JTree tree) {
    SynthContext context = getContext(tree, ENABLED);
    SynthStyle oldStyle = style;

    style = SynthLookAndFeel.updateStyle(context, this);
    if (style != oldStyle) {
        Object value;

        setExpandedIcon(style.getIcon(context, "Tree.expandedIcon"));
        setCollapsedIcon(style.getIcon(context, "Tree.collapsedIcon"));

        setLeftChildIndent(style.getInt(context, "Tree.leftChildIndent",
                                        0));
        setRightChildIndent(style.getInt(context, "Tree.rightChildIndent",
                                         0));

        drawHorizontalLines = style.getBoolean(
                      context, "Tree.drawHorizontalLines",true);
        drawVerticalLines = style.getBoolean(
                    context, "Tree.drawVerticalLines", true);
        linesStyle = style.get(context, "Tree.linesStyle");

            value = style.get(context, "Tree.rowHeight");
            if (value != null) {
                LookAndFeel.installProperty(tree, "rowHeight", value);
            }

            value = style.get(context, "Tree.scrollsOnExpand");
            LookAndFeel.installProperty(tree, "scrollsOnExpand",
                                                value != null? value : Boolean.TRUE);

        padding = style.getInt(context, "Tree.padding", 0);

        largeModel = (tree.isLargeModel() && tree.getRowHeight() > 0);

        useTreeColors = style.getBoolean(context,
                              "Tree.rendererUseTreeColors", true);

        Boolean showsRootHandles = style.getBoolean(
                context, "Tree.showsRootHandles", Boolean.TRUE);
        LookAndFeel.installProperty(
                tree, JTree.SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles);

        if (oldStyle != null) {
            uninstallKeyboardActions();
            installKeyboardActions();
        }
    }
    context.dispose();

    context = getContext(tree, Region.TREE_CELL, ENABLED);
    cellStyle = SynthLookAndFeel.updateStyle(context, this);
    context.dispose();
}
 
Example 15
Source File: LuckOptionPaneUI.java    From littleluck with Apache License 2.0 4 votes vote down vote up
protected void installDefaults()
{
    super.installDefaults();

    LookAndFeel.installProperty(optionPane, "opaque", Boolean.FALSE);
}
 
Example 16
Source File: SynthTreeUI.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void updateStyle(JTree tree) {
    SynthContext context = getContext(tree, ENABLED);
    SynthStyle oldStyle = style;

    style = SynthLookAndFeel.updateStyle(context, this);
    if (style != oldStyle) {
        Object value;

        setExpandedIcon(style.getIcon(context, "Tree.expandedIcon"));
        setCollapsedIcon(style.getIcon(context, "Tree.collapsedIcon"));

        setLeftChildIndent(style.getInt(context, "Tree.leftChildIndent",
                                        0));
        setRightChildIndent(style.getInt(context, "Tree.rightChildIndent",
                                         0));

        drawHorizontalLines = style.getBoolean(
                      context, "Tree.drawHorizontalLines",true);
        drawVerticalLines = style.getBoolean(
                    context, "Tree.drawVerticalLines", true);
        linesStyle = style.get(context, "Tree.linesStyle");

            value = style.get(context, "Tree.rowHeight");
            if (value != null) {
                LookAndFeel.installProperty(tree, "rowHeight", value);
            }

            value = style.get(context, "Tree.scrollsOnExpand");
            LookAndFeel.installProperty(tree, "scrollsOnExpand",
                                                value != null? value : Boolean.TRUE);

        padding = style.getInt(context, "Tree.padding", 0);

        largeModel = (tree.isLargeModel() && tree.getRowHeight() > 0);

        useTreeColors = style.getBoolean(context,
                              "Tree.rendererUseTreeColors", true);

        Boolean showsRootHandles = style.getBoolean(
                context, "Tree.showsRootHandles", Boolean.TRUE);
        LookAndFeel.installProperty(
                tree, JTree.SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles);

        if (oldStyle != null) {
            uninstallKeyboardActions();
            installKeyboardActions();
        }
    }
    context.dispose();

    context = getContext(tree, Region.TREE_CELL, ENABLED);
    cellStyle = SynthLookAndFeel.updateStyle(context, this);
    context.dispose();
}
 
Example 17
Source File: SynthTreeUI.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void updateStyle(JTree tree) {
    SynthContext context = getContext(tree, ENABLED);
    SynthStyle oldStyle = style;

    style = SynthLookAndFeel.updateStyle(context, this);
    if (style != oldStyle) {
        Object value;

        setExpandedIcon(style.getIcon(context, "Tree.expandedIcon"));
        setCollapsedIcon(style.getIcon(context, "Tree.collapsedIcon"));

        setLeftChildIndent(style.getInt(context, "Tree.leftChildIndent",
                                        0));
        setRightChildIndent(style.getInt(context, "Tree.rightChildIndent",
                                         0));

        drawHorizontalLines = style.getBoolean(
                      context, "Tree.drawHorizontalLines",true);
        drawVerticalLines = style.getBoolean(
                    context, "Tree.drawVerticalLines", true);
        linesStyle = style.get(context, "Tree.linesStyle");

            value = style.get(context, "Tree.rowHeight");
            if (value != null) {
                LookAndFeel.installProperty(tree, "rowHeight", value);
            }

            value = style.get(context, "Tree.scrollsOnExpand");
            LookAndFeel.installProperty(tree, "scrollsOnExpand",
                                                value != null? value : Boolean.TRUE);

        padding = style.getInt(context, "Tree.padding", 0);

        largeModel = (tree.isLargeModel() && tree.getRowHeight() > 0);

        useTreeColors = style.getBoolean(context,
                              "Tree.rendererUseTreeColors", true);

        Boolean showsRootHandles = style.getBoolean(
                context, "Tree.showsRootHandles", Boolean.TRUE);
        LookAndFeel.installProperty(
                tree, JTree.SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles);

        if (oldStyle != null) {
            uninstallKeyboardActions();
            installKeyboardActions();
        }
    }

    context = getContext(tree, Region.TREE_CELL, ENABLED);
    cellStyle = SynthLookAndFeel.updateStyle(context, this);
}
 
Example 18
Source File: SeaGlassSplitPaneUI.java    From seaglass with Apache License 2.0 4 votes vote down vote up
private void updateStyle(JSplitPane splitPane) {
    SeaGlassContext context = getContext(splitPane, Region.SPLIT_PANE_DIVIDER, ENABLED);
    SynthStyle oldDividerStyle = dividerStyle;
    dividerStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.dispose();

    context = getContext(splitPane, ENABLED);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);

    if (style != oldStyle) {
        Object value = style.get(context, "SplitPane.size");
        if (value == null) {
            value = new Integer(6);
        }
        LookAndFeel.installProperty(splitPane, "dividerSize", value);

        value = style.get(context, "SplitPane.oneTouchExpandable");
        if (value != null) {
            LookAndFeel.installProperty(splitPane, "oneTouchExpandable", value);
        }

        if (divider != null) {
            splitPane.remove(divider);
            divider.setDividerSize(splitPane.getDividerSize());
        }
        if (oldStyle != null) {
            uninstallKeyboardActions();
            installKeyboardActions();
        }
    }
    if (style != oldStyle || dividerStyle != oldDividerStyle) {
        // Only way to force BasicSplitPaneDivider to reread the
        // necessary properties.
        if (divider != null) {
            splitPane.remove(divider);
        }
        divider = createDefaultDivider();
        divider.setBasicSplitPaneUI(this);
        splitPane.add(divider, JSplitPane.DIVIDER);
    }
    context.dispose();
}
 
Example 19
Source File: LuckScrollBarUI.java    From littleluck with Apache License 2.0 4 votes vote down vote up
protected void installDefaults()
{
    super.installDefaults();

    LookAndFeel.installProperty(scrollbar, "opaque", Boolean.FALSE);
}
 
Example 20
Source File: BEToggleButtonUI.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
protected void installDefaults(AbstractButton b) {
	super.installDefaults(b);
	LookAndFeel.installProperty(b, "opaque", Boolean.FALSE);
}