setar o foreground swing

Solutions on MaxInterview for setar o foreground swing by the best coders in the world

showing results for - "setar o foreground swing"
Iker
05 Mar 2018
1package com.javacodegeeks.snippets.desktop;
2 
3import java.awt.Color;
4import java.awt.FlowLayout;
5 
6import javax.swing.JFrame;
7import javax.swing.JLabel;
8 
9public class SetForegroundColorInJLabel extends JFrame {
10 
11    private static final long serialVersionUID = 1L;
12 
13    public SetForegroundColorInJLabel() {
14 
15        // set flow layout for the frame
16        this.getContentPane().setLayout(new FlowLayout());
17 
18        JLabel label = new JLabel("Java Code Geeks - Java Examples");
19 
20        // Sets the foreground color of this component.  It is up to the
21        // look and feel to honor this property, some may choose to ignore it.
22        label.setForeground(Color.BLUE);
23 
24        // add label to frame
25        add(label);
26 
27    }
28 
29    private static void createAndShowGUI() {
30 
31  //Create and set up the window.
32 
33  JFrame frame = new SetForegroundColorInJLabel();
34 
35  //Display the window.
36 
37  frame.pack();
38 
39  frame.setVisible(true);
40 
41  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
42 	}
43}
44