Example usage for javax.swing JLabel setForeground

List of usage examples for javax.swing JLabel setForeground

Introduction

In this page you can find the example usage for javax.swing JLabel setForeground.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The foreground color of the component.")
public void setForeground(Color fg) 

Source Link

Document

Sets the foreground color of this component.

Usage

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JLabel getFieldLabel(String text, Color clr) {
    JLabel label = new JLabel(text);
    label.setForeground(clr);
    label.setFont(UIConstants.H5_FONT.deriveFont(Font.BOLD));
    return label;
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JLabel getFieldContent(String text) {
    JLabel label = new JLabel(text);
    label.setForeground(UIConstants.INTEL_DARK_GRAY);
    label.setFont(UIConstants.H3_FONT);//from   www .j av a  2  s. co  m
    return label;
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JLabel getFieldContent(String text, Color clr) {
    JLabel label = new JLabel(text);
    label.setForeground(clr);
    label.setFont(UIConstants.H3_FONT);// ww  w . j a va2  s  .  com
    return label;
}

From source file:com.diversityarrays.kdxplore.field.CollectionPathPanel.java

public CollectionPathPanel(boolean wantPlotsPerGroup, BiConsumer<VisitOrder2D, PlotsPerGroup> onChoiceChanged,
        List<? extends OrOrTr> onlyThese) {
    super(new BorderLayout());

    plotsPerGroupChoice.setSelectedItem(plotsPerGroup);
    odtChoicePanel.setOrOrTr(visitOrder);

    this.onChoiceChanged = onChoiceChanged;

    if (wantPlotsPerGroup) {
        plotsPerGroupChoice.addItemListener(new ItemListener() {
            @Override//from   w  w  w . j  av  a 2  s .co  m
            public void itemStateChanged(ItemEvent e) {
                plotsPerGroup = (PlotsPerGroup) plotsPerGroupChoice.getSelectedItem();
                onChoiceChanged.accept(visitOrder, plotsPerGroup);
            }
        });

        Box top = Box.createHorizontalBox();
        top.add(new JLabel("Plots Per Group:"));
        top.add(plotsPerGroupChoice);
        top.add(Box.createHorizontalGlue());

        add(top, BorderLayout.NORTH);
    }

    if (!Check.isEmpty(onlyThese)) {
        OrOrTr first = onlyThese.get(0);

        odtChoicePanel.setOnlyAllow(onlyThese.toArray(new OrOrTr[onlyThese.size()]));

        String msg;
        if (onlyThese.size() == 1) {
            msg = "<HTML>For now, only supporting:<BR>" + onlyThese.get(0).toString();
        } else {
            msg = onlyThese.stream().map(oot -> oot.toString())
                    .collect(Collectors.joining("<BR>", "<HTML>For now, only supporting:<BR>", ""));
        }

        JLabel label = new JLabel(msg, JLabel.CENTER);
        label.setForeground(Color.RED);
        add(label, BorderLayout.SOUTH);
    }

    add(odtChoicePanel, BorderLayout.CENTER);
}

From source file:MyStatsPanel.java

JPanel setFields() {
    getDatabaseInfo();//from   w  ww .j a  va 2  s  . c  om
    GroupLayout layout;
    JPanel p;

    numGuestsIn = new JLabel("Total guests in house .............................");
    numGuestsIn.setFont(new Font("Courier New", Font.PLAIN, 20));
    numGuestsIn.setForeground(Color.WHITE);
    checkIns = new JLabel("Todays guest check ins ............................");
    checkIns.setForeground(Color.WHITE);
    checkIns.setFont(new Font("Courier New", Font.PLAIN, 20));
    numGuestsOut = new JLabel("Todays guest check outs ...........................");
    numGuestsOut.setFont(new Font("Courier New", Font.PLAIN, 20));
    numGuestsOut.setForeground(Color.WHITE);
    overnights = new JLabel("Total overnight guests ............................");
    overnights.setForeground(Color.WHITE);
    overnights.setFont(new Font("Courier New", Font.PLAIN, 20));

    JLabel n1 = new JLabel(totalGuestsIn);
    n1.setForeground(Color.WHITE);
    n1.setFont(new Font("Courier New", Font.PLAIN, 20));
    JLabel n2 = new JLabel(todaysCheckIns);
    n2.setForeground(Color.WHITE);
    n2.setFont(new Font("Courier New", Font.PLAIN, 20));
    JLabel n3 = new JLabel(todaysCheckOuts);
    n3.setForeground(Color.WHITE);
    n3.setFont(new Font("Courier New", Font.PLAIN, 20));
    JLabel n4 = new JLabel(totalOvernights);
    n4.setForeground(Color.WHITE);
    n4.setFont(new Font("Courier New", Font.PLAIN, 20));

    p = new JPanel();
    p.setBackground(Color.GRAY);

    layout = new GroupLayout(p);
    p.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();
    hGroup.addGroup(layout.createParallelGroup().addComponent(numGuestsIn).addComponent(checkIns)
            .addComponent(numGuestsOut).addComponent(overnights));
    hGroup.addGroup(
            layout.createParallelGroup().addComponent(n1).addComponent(n2).addComponent(n3).addComponent(n4));
    layout.setHorizontalGroup(hGroup);

    GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();
    vGroup.addGroup(layout.createParallelGroup(BASELINE).addComponent(numGuestsIn).addComponent(n1));
    vGroup.addGroup(layout.createParallelGroup(BASELINE).addComponent(checkIns).addComponent(n2));
    vGroup.addGroup(layout.createParallelGroup(BASELINE).addComponent(numGuestsOut).addComponent(n3));
    vGroup.addGroup(layout.createParallelGroup(BASELINE).addComponent(overnights).addComponent(n4));

    layout.setVerticalGroup(vGroup);

    return (p);
}

From source file:com.diversityarrays.kdxplore.field.CollectionPathSetupDialog.java

public void setOnlyAllow(PlotsPerGroup ppg, OrOrTr... orts) {
    OrOrTr first = orts[0];//  w  w w .j  a v a 2 s.co  m
    odtChoicePanel.setOnlyAllow(orts);
    setOrOrTr(first, ppg);

    String msg;
    if (orts.length == 1) {
        msg = "<HTML>For now, only supporting:<BR>" + orts[0].toString();
    } else {
        msg = Arrays.asList(orts).stream().map(oot -> oot.toString())
                .collect(Collectors.joining("<BR>", "<HTML>For now, only supporting:<BR>", ""));
    }

    JLabel label = new JLabel(msg, JLabel.CENTER);
    label.setForeground(Color.RED);
    getContentPane().add(label, BorderLayout.NORTH);
    //        setGlassPane(label);
    //        label.setVisible(true);
}

From source file:es.emergya.ui.base.Message.java

private void inicializar(final String texto) {
    log.trace("inicializar(" + texto + ")");
    final Message message_ = this;

    SwingUtilities.invokeLater(new Runnable() {

        @Override//ww  w . j  ava 2 s.  co m
        public void run() {
            log.trace("Sacamos un nuevo mensaje: " + texto);
            JDialog frame = new JDialog(window.getFrame(), true);
            frame.setUndecorated(true);
            frame.getContentPane().setBackground(Color.WHITE);
            frame.setLocation(150, window.getHeight() - 140);
            frame.setSize(new Dimension(window.getWidth() - 160, 130));
            frame.setName("Incoming Message");
            frame.setBackground(Color.WHITE);
            frame.getRootPane().setBorder(new MatteBorder(4, 4, 4, 4, color));

            frame.setLayout(new BorderLayout());
            if (font != null)
                frame.setFont(font);

            JLabel icon = new JLabel(new ImageIcon(this.getClass().getResource("/images/button-ok.png")));
            icon.setToolTipText("Cerrar");

            icon.removeMouseListener(null);
            icon.addMouseListener(new Cerrar(frame, message_));

            JLabel text = new JLabel(texto);
            text.setBackground(Color.WHITE);
            text.setForeground(Color.BLACK);
            frame.add(text, BorderLayout.WEST);
            frame.add(icon, BorderLayout.EAST);

            frame.setVisible(true);
        }
    });
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JLabel getH1Label(String text, int style) {
    JLabel label = new JLabel(text);
    label.setFont(UIConstants.H1_FONT.deriveFont(style));
    label.setForeground(UIConstants.INTEL_DARK_GRAY);
    return label;
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JLabel getH2Label(String text, int style) {
    JLabel label = new JLabel(text);
    label.setFont(UIConstants.H2_FONT.deriveFont(style));
    label.setForeground(UIConstants.INTEL_DARK_GRAY);
    return label;
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JLabel getH3Label(String text, int style) {
    JLabel label = new JLabel(text);
    label.setFont(UIConstants.H3_FONT.deriveFont(style));
    label.setForeground(UIConstants.INTEL_DARK_GRAY);
    return label;
}