本文整理汇总了Java中javax.swing.JLabel.getBackground方法的典型用法代码示例。如果您正苦于以下问题:Java JLabel.getBackground方法的具体用法?Java JLabel.getBackground怎么用?Java JLabel.getBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JLabel
的用法示例。
在下文中一共展示了JLabel.getBackground方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StatusLabelManager
import javax.swing.JLabel; //导入方法依赖的package包/类
/**
* It creates a new status label manager instance.
*
* @param statusLabel The label to be managed.
*/
public StatusLabelManager(JLabel statusLabel) {
ArgumentChecking.notNull(statusLabel, "statusLabel");
this.statusLabel = statusLabel;
this.originalText = statusLabel.getText();
this.originalIsOpaque = statusLabel.isOpaque();
this.originalFGColor = statusLabel.getForeground();
this.originalBGColor = statusLabel.getBackground();
updateTimeStamp();
new Thread(new Deamon(this)).start();
}
示例2: paintDisabledText
import javax.swing.JLabel; //导入方法依赖的package包/类
protected void paintDisabledText(JLabel l, Graphics g, String s,
int textX, int textY) {
int mnemonicIndex = l.getDisplayedMnemonicIndex();
// W2K Feature: Check to see if the Underscore should be rendered.
if (WindowsLookAndFeel.isMnemonicHidden() == true) {
mnemonicIndex = -1;
}
if ( UIManager.getColor("Label.disabledForeground") instanceof Color &&
UIManager.getColor("Label.disabledShadow") instanceof Color) {
g.setColor( UIManager.getColor("Label.disabledShadow") );
SwingUtilities2.drawStringUnderlineCharAt(l, g, s,
mnemonicIndex,
textX + 1, textY + 1);
g.setColor( UIManager.getColor("Label.disabledForeground") );
SwingUtilities2.drawStringUnderlineCharAt(l, g, s,
mnemonicIndex,
textX, textY);
} else {
Color background = l.getBackground();
g.setColor(background.brighter());
SwingUtilities2.drawStringUnderlineCharAt(l,g, s, mnemonicIndex,
textX + 1, textY + 1);
g.setColor(background.darker());
SwingUtilities2.drawStringUnderlineCharAt(l,g, s, mnemonicIndex,
textX, textY);
}
}