Example usage for java.awt Label setForeground

List of usage examples for java.awt Label setForeground

Introduction

In this page you can find the example usage for java.awt Label setForeground.

Prototype

public void setForeground(Color c) 

Source Link

Document

Sets the foreground color of this component.

Usage

From source file:Presentation.MainWindow.java

/** Ajout  la fentre des valeurs de temprature et d'humidit en temps rel */
public void showLiveValues(float temperature, float humidite, boolean condense) {
    Panel panel = new Panel();
    Label labelTemp = new Label("Temprature du frigo : " + temperature + " C");
    Label labelOutdoorTemp = new Label(
            "Temprature extrieure : " + Singleton.getInstance().getMock().getOutdoorTemp() + " C");
    Label labelHumid = new Label("Humidit  l'intrieur du frigo : " + humidite + " %");
    Label condensation = new Label("Alerte de condensation");

    condensation.setForeground(Color.red);

    //  addCondensation();
    panel.setLayout(new FlowLayout());
    panel.add(labelTemp);/*  w  w w.  j  a v  a 2  s .  c  om*/
    panel.add(labelOutdoorTemp);
    panel.add(labelHumid);
    if (condense)
        panel.add(condensation);
    else {
        panel.add(condensation);
        condensation.hide();
    }
    //  panel.add(cLabel);

    this.tPanel = panel;
    mPanel.add(panel);

    show();
}

From source file:interpolation.InterpolantFileChooser.java

public InterpolantFileChooser() {

    final JFrame frame = new JFrame("Welcome to the Regression fits");

    Track = new JButton("Choose file");

    panelCont.add(panelIntro, "1");
    /* Instantiation */
    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints c = new GridBagConstraints();

    panelIntro.setLayout(layout);/*  w ww  .  j av  a  2  s.c  om*/

    final Label LoadtrackText = new Label("Input the .txt file of time-series");

    LoadtrackText.setBackground(new Color(1, 0, 1));
    LoadtrackText.setForeground(new Color(255, 255, 255));
    final Checkbox Simplemode = new Checkbox("Open simple time-series file", Simplefile);
    /* Location */

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.weighty = 1.5;

    ++c.gridy;
    c.insets = new Insets(10, 10, 10, 0);
    panelIntro.add(LoadtrackText, c);

    ++c.gridy;
    c.insets = new Insets(10, 10, 10, 0);
    panelIntro.add(Track, c);

    panelIntro.setVisible(true);
    Track.addActionListener(new OpenTrackListener(frame));
    Simplemode.addItemListener(new SimpleListener(frame));
    frame.addWindowListener(new FrameListener(frame));
    frame.add(panelCont, BorderLayout.CENTER);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);

}