本文整理汇总了Java中javax.swing.UIManager.getColor方法的典型用法代码示例。如果您正苦于以下问题:Java UIManager.getColor方法的具体用法?Java UIManager.getColor怎么用?Java UIManager.getColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.UIManager
的用法示例。
在下文中一共展示了UIManager.getColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDetails
import javax.swing.UIManager; //导入方法依赖的package包/类
private JComponent createDetails(String text, ActionListener action) {
try {
text = (action == null ? "<html>" : "<html><a href=\"_blank\">") + XMLUtil.toElementContent(text); //NOI18N
} catch (CharConversionException ex) {
throw new IllegalArgumentException(ex);
}
if (null == action) {
return new JLabel(text);
}
JButton btn = new JButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(action);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
if (c != null) {
btn.setForeground(c);
}
return btn;
}
示例2: installDefaults
import javax.swing.UIManager; //导入方法依赖的package包/类
@Override
public void installDefaults (AbstractButton b) {
super.installDefaults(b);
if(!defaults_initialized) {
try {
//Null checks so this can be tested on other platforms
Integer in = ((Integer)UIManager.get("Button.dashedRectGapX"));
dashedRectGapX = in == null ? 3 : in.intValue();
in = ((Integer)UIManager.get("Button.dashedRectGapY"));
dashedRectGapY = in == null ? 3 : in.intValue();
in = ((Integer)UIManager.get("Button.dashedRectGapWidth"));
dashedRectGapWidth = in == null ? 3 : in.intValue();
in = ((Integer)UIManager.get("Button.dashedRectGapHeight"));
dashedRectGapHeight = in == null ? 3 : in.intValue();
focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
defaults_initialized = true;
} catch (NullPointerException npe) {
//We're testing on a non windows platform, the defaults don't
//exist
dashedRectGapX = 2;
dashedRectGapY = 2;
dashedRectGapWidth = 2;
dashedRectGapHeight = 2;
}
}
}
示例3: paint
import javax.swing.UIManager; //导入方法依赖的package包/类
/**
* We override the paint() method to avoid drawing the box around the
* "extra space" (if height is double height)
*/
@Override
public void paint(Graphics g) {
int w = getWidth(), h = getHeight(), y = h - height;
Color background = isSelected ? UIManager.getColor("Tree.selectionBackground") : Color.WHITE;
Color border = isFocused ? UIManager.getColor("Tree.selectionBorderColor") : null;
if (background != null) {
g.setColor(background);
g.fillRect(0, y, w, h - y);
}
if (border != null && isSelected) {
g.setColor(border);
g.drawRect(0, y, w - 1, h - 1 - y);
}
super.paint(g);
}
示例4: setFullyNonEditable
import javax.swing.UIManager; //导入方法依赖的package包/类
/**
* Sets all the cells in the <code>ETable</code> to be non-editable if
* <code>fullyNonEditable</code> is true.
* If <code>fullyNonEditable</code> is false, sets the table cells into
* their default state as in <code>JTable</code>.
*
* @param fullyNonEditable true if the table is meant to be fully non-editable.
* false if the table is meant to take the defalut
* state for editing.
* @see #isFullyNonEditable
*/
public void setFullyNonEditable(boolean fullyNonEditable) {
if (fullyNonEditable) {
editing = FULLY_NONEDITABLE;
if(getShowHorizontalLines())
setShowHorizontalLines(false);
Color lineBorderColor = UIManager.getColor("Table.border");
if (lineBorderColor == null) {
lineBorderColor = Color.GRAY;
}
setBorder(BorderFactory.createLineBorder(lineBorderColor));
Color c = UIManager.getColor("Table.noneditableGrid");
if (c != null) {
setGridColor(c);
}
} else {
editing = DEFAULT;
setBorder( null );
if(!getShowHorizontalLines())
setShowHorizontalLines(true);
Color defaultGridColor = UIManager.getColor("Table.defaultGrid");
if (defaultGridColor != null) {
setGridColor(defaultGridColor);
}
}
if (isFullyNonEditable()) {
setupSearch();
}
}
示例5: getBackgroundColor
import javax.swing.UIManager; //导入方法依赖的package包/类
public Color getBackgroundColor() {
if( isGTK ) {
return GTK_BK_COLOR;
} else if( isAqua ) {
return AQUA_BK_COLOR;
} else {
return UIManager.getColor( "PropSheet.setBackground" ); //NOI18N
}
}
示例6: getDefaultSelectionBackground
import javax.swing.UIManager; //导入方法依赖的package包/类
private static Color getDefaultSelectionBackground() {
Color color = UIManager.getColor("TextArea.selectionBackground");// NOI18N
if (color == null) {
// bug #185154
// Nimbus L&F doesn't define "TextArea.selectionBackground"
color = UIManager.getColor("textHighlight");// NOI18N
}
return color;
}
示例7: paint
import javax.swing.UIManager; //导入方法依赖的package包/类
/** We override the paint() method to avoid drawing the box around the "extra space" (if height is double height) */
@Override public void paint(Graphics g) {
int w=getWidth(), h=getHeight(), y=h-height;
Color background = isSelected ? UIManager.getColor("Tree.selectionBackground") : Color.WHITE;
Color border = isFocused ? UIManager.getColor("Tree.selectionBorderColor") : null;
if (background!=null) { g.setColor(background); g.fillRect(0, y, w, h-y); }
if (border!=null && isSelected) { g.setColor(border); g.drawRect(0, y, w-1, h-1-y); }
super.paint(g);
}
示例8: JHyperlink
import javax.swing.UIManager; //导入方法依赖的package包/类
/**
* Creates a new instance of JHyperlink
*/
public JHyperlink() {
super();
normalForeground = UIManager.getColor("Hyperlink.foreground");
activeForeground = UIManager.getColor("Hyperlink.activeForeground");
visitedForeground = UIManager.getColor("Hyperlink.visitedForeground");
setBorderPainted(false);
setContentAreaFilled(false);
setForeground(normalForeground);
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
setMargin(new Insets(0, 0, 0, 0));
setAction(defaultBrowseAction);
}
示例9: getSelectedTabTitleColor
import javax.swing.UIManager; //导入方法依赖的package包/类
protected static Color getSelectedTabTitleColor(boolean enabled, boolean pressed) {
if (enabled && pressed) {
return UIManager.getColor("TabbedPane.selectedTabTitlePressedColor");
} else if (!enabled) {
return UIManager.getColor("TabbedPane.selectedTabTitleDisabledColor");
} else {
return UIManager.getColor("TabbedPane.selectedTabTitleNormalColor");
}
}
示例10: getSelectionBackground
import javax.swing.UIManager; //导入方法依赖的package包/类
private static Color getSelectionBackground() {
if( isMetal || isNimbus ) {
if( !Color.white.equals( getTabPanelBackground() ) ) {
Color res = UIManager.getColor( "Tree.selectionBackground" ); //NOI18N
if( null == res )
res = Color.blue;
return new Color( res.getRGB() );
}
}
return new Color (193, 210, 238);
}
示例11: getForeground
import javax.swing.UIManager; //导入方法依赖的package包/类
public Color getForeground() {
if (foreground == null) {
foreground = UIManager.getColor("ComboBox.foreground");
}
return foreground != null ? foreground : super.getForeground();
}
示例12: getPopupBorderColor
import javax.swing.UIManager; //导入方法依赖的package包/类
public static Color getPopupBorderColor() {
Color shadow = UIManager.getColor("controlShadow"); //NOI18N
return shadow != null ? shadow : Color.GRAY;
}
示例13: MaterialButton
import javax.swing.UIManager; //导入方法依赖的package包/类
public MaterialButton (String text) {
this (text, UIManager.getColor ("Button.background"), UIManager.getColor ("Button.foreground"), UIManager.getColor ("Button.highlight"));
}
示例14: getDefaultBackground
import javax.swing.UIManager; //导入方法依赖的package包/类
public Color getDefaultBackground() {
if (isAqua) {
return UIManager.getColor("NbExplorerView.background"); // NOI18N
}
return defaultBackground;
}
示例15: paintTabContent
import javax.swing.UIManager; //导入方法依赖的package包/类
@Override
protected void paintTabContent(Graphics g, int index, String text, int x,
int y, int width, int height) {
// substract lower border
height--;
FontMetrics fm = getTxtFontMetrics();
// setting font already here to compute string width correctly
g.setFont(getTxtFont());
int txtWidth = width;
if (isSelected(index)) {
Component buttons = getControlButtons();
if( null != buttons ) {
Dimension buttonsSize = buttons.getPreferredSize();
if( width < buttonsSize.width+2*ICON_X_PAD ) {
buttons.setVisible( false );
} else {
buttons.setVisible( true );
txtWidth = width - (buttonsSize.width + 2*ICON_X_PAD + TXT_X_PAD);
buttons.setLocation(x + txtWidth + TXT_X_PAD+ICON_X_PAD, y + (height - buttonsSize.height)/2 + (TXT_Y_PAD / 2));
}
}
} else {
txtWidth = width - 2 * TXT_X_PAD;
}
// draw bump (dragger)
drawBump(g, index, x + 4, y + 6, BUMP_WIDTH, height - 8);
boolean slidedOut = false;
WinsysInfoForTabbedContainer winsysInfo = displayer.getContainerWinsysInfo();
if( null != winsysInfo && winsysInfo.isSlidedOutContainer() )
slidedOut = false;
if( isTabBusy( index ) && !slidedOut ) {
Icon busyIcon = BusyTabsSupport.getDefault().getBusyIcon( isSelected( index ) );
txtWidth -= busyIcon.getIconWidth() - 3 - TXT_X_PAD;
busyIcon.paintIcon( displayer, g, x+TXT_X_PAD, y+(height-busyIcon.getIconHeight())/2);
x += busyIcon.getIconWidth() + 3;
}
// draw text in right color
Color txtC = UIManager.getColor("TabbedPane.foreground"); //NOI18N
HtmlRenderer.renderString(text, g, x + TXT_X_PAD, y + fm.getAscent()
+ TXT_Y_PAD,
txtWidth, height, getTxtFont(),
txtC,
HtmlRenderer.STYLE_TRUNCATE, true);
}