FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-projects/MyUserInteraction.java at master · singhofen/java-projects · GitHub
singhofen
/
java-projects
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
3
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-projects
/
MyUserInteraction.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
81 lines (72 loc) · 2.12 KB
Breadcrumbs
java-projects
/
MyUserInteraction.java
Copy path
File metadata and controls
81 lines (72 loc) · 2.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
java
.
awt
.
EventQueue
;
import
javax
.
swing
.
JFrame
;
import
javax
.
swing
.
JLabel
;
import
javax
.
swing
.
SwingConstants
;
import
javax
.
swing
.
JTextField
;
import
javax
.
swing
.
JButton
;
import
java
.
awt
.
event
.
ActionListener
;
import
java
.
awt
.
event
.
ActionEvent
;
import
java
.
awt
.
Color
;
import
java
.
awt
.
Font
;
public
class
MyUserInteraction
{
private
JFrame
frame
;
private
JLabel
myLabel
;
private
JTextField
textField
;
private
JButton
myButton
;
/**
* Launch the application.
*/
public
static
void
main
(
String
[]
args
) {
EventQueue
.
invokeLater
(
new
Runnable
() {
public
void
run
() {
try
{
MyUserInteraction
window
=
new
MyUserInteraction
();
window
.
frame
.
setVisible
(
true
);
}
catch
(
Exception
e
) {
e
.
printStackTrace
();
}
}
});
}
/**
* Create the application.
*/
public
MyUserInteraction
() {
initialize
();
}
/**
* Initialize the contents of the frame.
*/
private
void
initialize
() {
frame
=
new
JFrame
();
frame
.
getContentPane
().
setFont
(
new
Font
(
"Kohinoor Telugu"
,
Font
.
PLAIN
,
13
));
frame
.
getContentPane
().
setBackground
(
Color
.
YELLOW
);
frame
.
setBackground
(
Color
.
GRAY
);
frame
.
setBounds
(
100
,
100
,
863
,
377
);
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
getContentPane
().
setLayout
(
null
);
JLabel
MyLabel
=
new
JLabel
(
"Change Me"
);
MyLabel
.
setFont
(
new
Font
(
"Lucida Grande"
,
Font
.
PLAIN
,
27
));
MyLabel
.
setBackground
(
Color
.
YELLOW
);
MyLabel
.
setHorizontalAlignment
(
SwingConstants
.
CENTER
);
MyLabel
.
setBounds
(
398
,
59
,
212
,
37
);
frame
.
getContentPane
().
add
(
MyLabel
);
textField
=
new
JTextField
();
textField
.
setBackground
(
Color
.
MAGENTA
);
textField
.
setHorizontalAlignment
(
SwingConstants
.
CENTER
);
textField
.
setBounds
(
425
,
132
,
130
,
26
);
frame
.
getContentPane
().
add
(
textField
);
textField
.
setColumns
(
10
);
JButton
mybutton
=
new
JButton
(
"click me"
);
mybutton
.
setBackground
(
Color
.
CYAN
);
mybutton
.
addActionListener
(
new
ActionListener
() {
public
void
actionPerformed
(
ActionEvent
e
) {
String
text
=
textField
.
getText
();
myLabel
.
setText
(
text
);
textField
.
setText
(
""
);
}
});
mybutton
.
setBounds
(
405
,
180
,
117
,
29
);
frame
.
getContentPane
().
add
(
mybutton
);
}
}
Back
|
FazBrowse Home
|
New Git URL