本文整理匯總了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);
}
}