Answers for "setar o foreground swing"

0

setar o foreground swing

package com.javacodegeeks.snippets.desktop;
 
import java.awt.Color;
import java.awt.FlowLayout;
 
import javax.swing.JFrame;
import javax.swing.JLabel;
 
public class SetForegroundColorInJLabel extends JFrame {
 
    private static final long serialVersionUID = 1L;
 
    public SetForegroundColorInJLabel() {
 
        // set flow layout for the frame
        this.getContentPane().setLayout(new FlowLayout());
 
        JLabel label = new JLabel("Java Code Geeks - Java Examples");
 
        // Sets the foreground color of this component.  It is up to the
        // look and feel to honor this property, some may choose to ignore it.
        label.setForeground(Color.BLUE);
 
        // add label to frame
        add(label);
 
    }
 
    private static void createAndShowGUI() {
 
  //Create and set up the window.
 
  JFrame frame = new SetForegroundColorInJLabel();
 
  //Display the window.
 
  frame.pack();
 
  frame.setVisible(true);
 
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 	}
}
Posted by: Guest on September-27-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language