List of usage examples for javax.swing JLabel setForeground
@BeanProperty(preferred = true, visualUpdate = true, description = "The foreground color of the component.") public void setForeground(Color fg)
From source file:FramewithComponents.java
public FramewithComponents() { super("JLayeredPane Demo"); setSize(256, 256);//from ww w. jav a 2 s. co m JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); content.setOpaque(false); JLabel label1 = new JLabel("Username:"); label1.setForeground(Color.white); content.add(label1); JTextField field = new JTextField(15); content.add(field); JLabel label2 = new JLabel("Password:"); label2.setForeground(Color.white); content.add(label2); JPasswordField fieldPass = new JPasswordField(15); content.add(fieldPass); getContentPane().setLayout(new FlowLayout()); getContentPane().add(content); ((JPanel) getContentPane()).setOpaque(false); ImageIcon earth = new ImageIcon("largeJava2sLogo.png"); JLabel backlabel = new JLabel(earth); getLayeredPane().add(backlabel, new Integer(Integer.MIN_VALUE)); backlabel.setBounds(0, 0, earth.getIconWidth(), earth.getIconHeight()); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(l); setVisible(true); }
From source file:com.tdclighthouse.prototype.servlets.JLatexServlet.java
private synchronized BufferedImage generateImage(String latex) { TeXFormula formula = new TeXFormula(latex); TeXIcon icon = formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20); icon.setInsets(new Insets(5, 5, 5, 5)); BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); g2.setColor(Color.white);//from ww w. j av a 2 s.c o m g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight()); JLabel jl = new JLabel(); jl.setForeground(new Color(0, 0, 0)); icon.paintIcon(jl, g2, 0, 0); return image; }
From source file:MonthPanel.java
protected JPanel createTitleGUI() { JPanel titlePanel = new JPanel(true); titlePanel.setLayout(new FlowLayout()); titlePanel.setBackground(Color.WHITE); JLabel label = new JLabel(monthNames[month] + " " + year); label.setForeground(SystemColor.activeCaption); titlePanel.add(label, BorderLayout.CENTER); return titlePanel; }
From source file:lu.lippmann.cdb.common.gui.MultiPanel.java
/** * Constructor./* ww w . ja v a 2s. c om*/ */ public MultiPanel(final ListOrderedMap<JComponent, Integer> mapPanels, final int w, final int h, final boolean withWeight) { final int total = mapPanels.keySet().size(); if (!withWeight) setLayout(new GridLayout(0, 1)); final int w2 = w - 10 * total; final int h2 = h - 75; final Map<JComponent, Color> choosedColor = new HashMap<JComponent, Color>(); int i = 0; for (final JComponent p : mapPanels.keySet()) { final Dimension size = new Dimension((int) (w2 * (mapPanels.get(p) / 100.0)), h2); p.setPreferredSize(size); choosedColor.put(p, COLORS[i]); p.setBackground(COLORS[i]); p.setBorder(BorderFactory.createLineBorder(Color.BLACK)); add(p); i++; } if (withWeight) { /** add percents **/ for (final JComponent p : mapPanels.keySet()) { final int perc = mapPanels.get(p); final int percent = (int) (w2 * (mapPanels.get(p) / 100.0)); final Dimension size = new Dimension(percent, 20); final JPanel arrow = new JPanel(); arrow.setPreferredSize(size); final JLabel label = new JLabel(perc + "%"); label.setForeground(choosedColor.get(p).darker()); arrow.add(label); add(arrow); } } }
From source file:com.igormaznitsa.sciareto.notifications.NotificationManager.java
public void showNotification(@Nullable final Image icon, @Nullable final String title, @Nonnull final Type type, @Nonnull final String message) { final JLabel label = new JLabel(String.format("<html>%s</html>", StringEscapeUtils.escapeHtml(message))); label.setForeground(Color.black); this.showNotification(icon, title, type, label); }
From source file:eu.europa.ec.markt.tlmanager.view.pages.TreeDataPublisher.java
/** * Convenience method that helps collecting all the mandatory <code>JLabel</code>'s and set a common attribute: red * as foreground color.//from w ww. ja va 2 s . com * * @param label the label to add */ protected void setMandatoryLabel(JLabel label) { label.setForeground(Color.red); mandatoryLabels.add(label); }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JLabel getIntelH1Label(String text, int style) { JLabel label = new JLabel(text); label.setForeground(UIConstants.INTEL_BLUE); label.setFont(UIConstants.H1_FONT.deriveFont(style)); return label; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JLabel getIntelH2Label(String text, int style) { JLabel label = new JLabel(text); label.setForeground(UIConstants.INTEL_BLUE); label.setFont(UIConstants.H2_FONT.deriveFont(style)); return label; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JLabel getIntelH3Label(String text, int style) { JLabel label = new JLabel(text); label.setForeground(UIConstants.INTEL_BLUE); label.setFont(UIConstants.H3_FONT.deriveFont(style)); return label; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JLabel getFieldLabel(String text) { JLabel label = new JLabel(text); label.setForeground(UIConstants.INTEL_DARK_GRAY); label.setFont(UIConstants.H5_FONT.deriveFont(Font.BOLD)); return label; }