@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); }
/** 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())); }
/** * 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; }
@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; } };
renderPanel.setForeground(CardRendererUtils.copyColor(baseComp.getForeground())); renderPanel.setBackground(CardRendererUtils.copyColor(baseComp.getBackground())); renderPanel.setBorder(baseComp.getBorder()); symbolLabel.setForeground(baseComp.getForeground()); symbolLabel.setBackground(baseComp.getBackground());
label.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, label.getForeground())); label.setFont(doDeriveFont(label.getFont(), Font.BOLD)); contentLabelPanel = new JPanel(new BorderLayout());
panelName.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, panelName.getForeground())); panelName.setFont(doDeriveFont(panelName.getFont(), Font.BOLD));
/** * 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(); }
public Color getTextColor() { return _label.getForeground(); }
@Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(m_controlPanel.m_totalEpochsLabel.getForeground()); g.drawString("Epoch " + m_epoch, 0, 10); } };
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); }
@ScriptFunction(jsDoc = FOREGROUND_JSDOC) @Override public Color getForeground() { return super.getForeground(); }
public Color getForeground() { if((delegate_==this)||(delegate_==null)) return super.getForeground(); return delegate_.getForeground(); }
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"); } } }
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; }
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());
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();
/** * 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)); }
@Override public Color getForeground() { if (!isEnabled()) { return UIUtil.getLabelDisabledForeground(); } if (myFontColor != null) { return UIUtil.getLabelFontColor(myFontColor); } return super.getForeground(); }
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; }