public class WelcomeGUIApp
class GUI extends JFrame
1: //WelcomeGUIApp.java
2: //Displays a welcome message and date in a window, in color.
4: import java.awt.Font;
5: import java.awt.Color;
6: import java.awt.Graphics;
7: import javax.swing.JFrame;
9: public class WelcomeGUIApp
10: {
11: public static void main(String[] args)
12: {
13: GUI app = new GUI("Welcome GUI Application");
14: app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
15: app.setSize(500, 120);
16: app.setLocation(200, 100);
17: app.setVisible(true);
18: }
19: }
22: class GUI extends JFrame
23: {
24: public GUI(String s)
25: {
26: super(s);
27: }
29: public void paint(Graphics g)
30: {
31: //Set the background color (for the JFrame itself)
32: setBackground(Color.YELLOW); //inherited from Component
34: //Declare and set the font you want to use for writing:
35: Font font = new Font("SanSerif", Font.BOLD, 24);
36: g.setFont(font);
38: //Set the color you want to use for writing
39: g.setColor(Color.BLUE);
41: //Finally, display a welcome message and date on the screen
42: g.drawString("Welcome to Mini University!", 65, 65);
43: g.drawString("July, 2005", 65, 90);
44: }
45: }