本文整理了Java中javax.swing.JLabel.getForeground()
方法的一些代码示例,展示了JLabel.getForeground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.getForeground()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:getForeground
暂无
代码示例来源:origin: runelite/runelite
@Override
protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY)
{
if (l instanceof JShadowedLabel)
{
JShadowedLabel ll = (JShadowedLabel) l;
g.setColor(ll.getShadow());
g.drawString(s, textX + ll.getShadowSize().x, textY + ll.getShadowSize().y);
}
g.setColor(l.getForeground());
g.drawString(s, textX, textY);
}
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
/** Setter for content foreground color.
* @param color content foreground color.
*/
public void setContentForegroundColor(Color color) {
if (cellRenderer == null) {
return;
}
cellRenderer.setForegroundColor(color);
label.setForeground(color);
label.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, label.getForeground()));
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Returns the color to use for hyperlink-style components. This method
* will return <code>Color.blue</code> unless it appears that the current
* LookAndFeel uses light text on a dark background, in which case a
* brighter alternative is returned.
*
* @return The color to use for hyperlinks.
* @see #isLightForeground(Color)
*/
public static Color getHyperlinkForeground() {
// This property is defined by all standard LaFs, even Nimbus (!),
// but you never know what crazy LaFs there are...
Color fg = UIManager.getColor("Label.foreground");
if (fg==null) {
fg = new JLabel().getForeground();
}
return isLightForeground(fg) ? LIGHT_HYPERLINK_FG : Color.blue;
}
代码示例来源:origin: magefree/mage
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
// get table text cell settings
DefaultTableCellRenderer baseRenderer = (DefaultTableCellRenderer) table.getDefaultRenderer(String.class);
JLabel baseComp = (JLabel) baseRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String skillCode = baseComp.getText();
// apply settings to render panel from parent
renderPanel.setOpaque(baseComp.isOpaque());
renderPanel.setForeground(CardRendererUtils.copyColor(baseComp.getForeground()));
renderPanel.setBackground(CardRendererUtils.copyColor(baseComp.getBackground()));
renderPanel.setBorder(baseComp.getBorder());
// create each skill symbol as child label
renderPanel.removeAll();
renderPanel.setLayout(new BoxLayout(renderPanel, BoxLayout.X_AXIS));
for (char skillSymbol : skillCode.toCharArray()) {
JLabel symbolLabel = new JLabel();
symbolLabel.setBorder(new EmptyBorder(0, 3, 0, 0));
symbolLabel.setIcon(skillIcon);
renderPanel.add(symbolLabel);
}
return renderPanel;
}
};
代码示例来源:origin: magefree/mage
renderPanel.setForeground(CardRendererUtils.copyColor(baseComp.getForeground()));
renderPanel.setBackground(CardRendererUtils.copyColor(baseComp.getBackground()));
renderPanel.setBorder(baseComp.getBorder());
symbolLabel.setForeground(baseComp.getForeground());
symbolLabel.setBackground(baseComp.getBackground());
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
label.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, label.getForeground()));
label.setFont(doDeriveFont(label.getFont(), Font.BOLD));
contentLabelPanel = new JPanel(new BorderLayout());
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
panelName.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, panelName.getForeground()));
panelName.setFont(doDeriveFont(panelName.getFont(), Font.BOLD));
代码示例来源:origin: org.piccolo2d/piccolo2d-core
/**
* Return the text color for this HTML text node. This text color is used to
* render the HTML text if not otherwise specified via CSS. Defaults to
* {@link #DEFAULT_TEXT_COLOR}.
*
* @return the text color for this HTML text node
*/
public Color getTextColor() {
return label.getForeground();
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
public Color getTextColor()
{
return _label.getForeground();
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(m_controlPanel.m_totalEpochsLabel.getForeground());
g.drawString("Epoch " + m_epoch, 0, 10);
}
};
代码示例来源:origin: net.sf.taverna.t2.ui-exts/loop-ui
protected void updateFeedbackHelp() {
feedbackHelp.setEnabled(feedBackCheck.isSelected());
Color color;
if (feedBackCheck.isSelected()) {
color = valueTypeLabel.getForeground();
} else {
// Work around
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4303706
// and assume gray is the 'disabled' colour in our Look n Feel
color = Color.gray;
}
feedbackHelp.setForeground(color);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = FOREGROUND_JSDOC)
@Override
public Color getForeground() {
return super.getForeground();
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public Color getForeground()
{
if((delegate_==this)||(delegate_==null))
return super.getForeground();
return delegate_.getForeground();
}
代码示例来源:origin: com.fifesoft.rtext/fife.common
private void refreshMinimizeIcon() {
if (minimizeAction != null) {
Color c = label != null ? label.getForeground() : new JLabel().getForeground();
if (UIUtil.isLightForeground(c)) {
minimizeAction.setIcon("minimize_dark.svg");
}
else {
minimizeAction.setIcon("minimize.png");
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-support
private JTextComponent createMultilineLabel(String text) {
JTextArea textArea = new JTextArea(text);
textArea.setEditable(false);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setEnabled(false);
textArea.setOpaque(false);
textArea.setColumns(25);
textArea.setDisabledTextColor(new JLabel().getForeground());
return textArea;
}
代码示例来源:origin: stackoverflow.com
JTextArea ta = new JTextArea(text);
ta.setEditable(false);
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
JLabel lb = new JLabel();
Font f = lb.getFont();
ta.setFont(f.deriveFont(f.getSize2D() * 0.9f));
ta.setBorder(lb.getBorder());
ta.setBackground(new Color(lb.getBackground().getRGB(), true));
ta.setForeground(new Color(lb.getForeground().getRGB(), true));
ta.setOpaque(lb.isOpaque());
代码示例来源:origin: stackoverflow.com
JLabel label = ....;
Timeline timeline = new Timeline(label);
timeline.addPropertyToInterpolate("background", label.getBackground(),
new Color(label.getBackground().getRGB(), true));
timeline.addPropertyToInterpolate("foreground", label.getForeground(),
new Color(label.getForeground().getRGB(), true));
timeline.play();
代码示例来源:origin: com.fifesoft.rtext/fife.common
/**
* Constructor.
*
* @param name The name of the panel.
* @param plugin The plugin whose options we're displaying.
*/
public PluginOptionsDialogPanel(String name, Plugin plugin) {
super(name);
this.plugin = plugin;
boolean isDarkLookAndFeel = UIUtil.isLightForeground(new JLabel().getForeground());
setIcon(plugin.getPluginIcon(isDarkLookAndFeel));
}
代码示例来源:origin: JetBrains/jediterm
@Override
public Color getForeground() {
if (!isEnabled()) {
return UIUtil.getLabelDisabledForeground();
}
if (myFontColor != null) {
return UIUtil.getLabelFontColor(myFontColor);
}
return super.getForeground();
}
代码示例来源:origin: violetumleditor/violetumleditor
protected LineText(LineText lineText) throws CloneNotSupportedException
{
getLabel().setHorizontalAlignment(lineText.getLabel().getHorizontalAlignment());
getLabel().setVerticalAlignment(lineText.getLabel().getVerticalAlignment());
getLabel().setForeground(lineText.getLabel().getForeground());
getLabel().setBorder(lineText.getLabel().getBorder());
getLabel().setText(lineText.getLabel().getText());
converter = lineText.converter;
}
内容来源于网络,如有侵权,请联系作者删除!