-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path49 .GUI.java
More file actions
86 lines (73 loc) · 2.25 KB
/
49 .GUI.java
File metadata and controls
86 lines (73 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package test;
import java.util.Arrays;
import java.util.Scanner;
//import javax.swing.*;
//import java.lang.Math;
//import java.util.Random;
//import java.io.IOException;
//import java.util.Arrays;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//import java.util.HashMap;
import java.io.*;
import java.util.*;
//import javax.sound.sampled.*;
import java.awt.*; // abstract window toolkit
import javax.swing.*;
public class main {
// Graphical User Interface .
// Graphical User Interface : a user-friendly visual experience builder for Java applications
//
public static void main(String[] args) {
// TODO Auto-generated method stub
// Declare the Scanner library
Scanner scanner = new Scanner(System.in);
Frame frame = new Frame();
frame.setTitle("My first app");
frame.setSize(500, 500);
frame.setLocationRelativeTo(null); // center the app in the screen
frame.setVisible(true);
ImageIcon image = new ImageIcon("sad.png");
frame.setIconImage(image.getImage()); // set image
frame.setBackground(new Color(0x12345));// change background color {with custom color}
}
}
/////// another way
package test;
import java.util.Arrays;
import java.util.Scanner;
//import javax.swing.*;
//import java.lang.Math;
//import java.util.Random;
//import java.io.IOException;
//import java.util.Arrays;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//import java.util.HashMap;
import java.io.*;
import java.util.*;
//import javax.sound.sampled.*;
import java.awt.*; // abstract window toolkit
import javax.swing.*;
public class main extends Frame {
// Graphical User Interface .
// Graphical User Interface : a user-friendly visual experience builder for Java applications
//
public main() { // as default Constructors
setTitle("My first app");
setSize(500, 500);
setLocationRelativeTo(null); // center the app in the screen
setVisible(true);
ImageIcon image = new ImageIcon("sad.png");
setIconImage(image.getImage()); // set image
setBackground(new Color(0x12345));// change background color {with custom color}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
// Declare the Scanner library
Scanner scanner = new Scanner(System.in);
new main();
}
}