下面列出了javax.swing.LookAndFeel#installProperty ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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() ) );
}
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);
}
}
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);
}
protected void installDefaults(JComponent c)
{
LookAndFeel.installColorsAndFont(c, "Viewport.background",
"Viewport.foreground", "Viewport.font");
LookAndFeel.installProperty(c, "opaque", Boolean.FALSE);
}
@Override
public void installUI(JComponent c)
{
super.installUI(c);
LookAndFeel.installProperty(frame, "opaque", Boolean.FALSE);
}
@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);
}
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;
}
@Override
public void installUI( JComponent c ) {
super.installUI( c );
int focusWidth = UIManager.getInt( "Component.focusWidth" );
LookAndFeel.installProperty( c, "opaque", focusWidth == 0 );
MigLayoutVisualPadding.install( scrollpane );
}
@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 );
}
@Override
protected void installDefaults() {
super.installDefaults();
LookAndFeel.installProperty( menuItem, "iconTextGap", FlatUIUtils.getUIInt( "MenuItem.iconTextGap", 4 ) );
renderer = createRenderer();
}
@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() );
}
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();
}
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();
}
public void installUI(JComponent c)
{
super.installUI(c);
LookAndFeel.installProperty(menuBar, "opaque", Boolean.FALSE);
}
protected void installDefaults()
{
super.installDefaults();
LookAndFeel.installProperty(optionPane, "opaque", Boolean.FALSE);
}
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();
}
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);
}
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();
}
protected void installDefaults()
{
super.installDefaults();
LookAndFeel.installProperty(scrollbar, "opaque", Boolean.FALSE);
}
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
LookAndFeel.installProperty(b, "opaque", Boolean.FALSE);
}