FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-code-example/!temp/src/JFrame_main.java at master · cherkavi/java-code-example · GitHub
cherkavi
/
java-code-example
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
0
Code
Issues
0
Pull requests
42
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-code-example
/
!temp
/
src
/
JFrame_main.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
83 lines (75 loc) · 3.18 KB
Breadcrumbs
java-code-example
/
!temp
/
src
/
JFrame_main.java
Copy path
File metadata and controls
executable file
·
83 lines (75 loc) · 3.18 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
82
83
/*
* JFrame_main.java
*
* Created on 8 òðàâíÿ 2008, 17:01
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
import
java
.
awt
.
event
.
ActionEvent
;
import
java
.
awt
.
event
.
ActionListener
;
import
java
.
awt
.
event
.
KeyEvent
;
import
java
.
awt
.
event
.
KeyListener
;
import
java
.
beans
.
PropertyChangeEvent
;
import
java
.
beans
.
PropertyChangeListener
;
import
javax
.
swing
.*;
import
com
.
toedter
.
calendar
.*;
import
javax
.
swing
.
event
.
ChangeEvent
;
import
javax
.
swing
.
event
.
ChangeListener
;
/**
*
* @author Technik
*/
public
class
JFrame_main
extends
JFrame
{
/** Creates a new instance of JFrame_main */
public
JFrame_main
() {
super
(
"JCalendar listener demo"
);
this
.
setBounds
(
100
,
100
,
200
,
100
);
JDateChooser
field_calendar
=
new
JDateChooser
(
new
java
.
util
.
Date
(),
"dd.MM.yyyy"
);
field_calendar
.
addPropertyChangeListener
(
new
PropertyChangeListener
(){
public
void
propertyChange
(
PropertyChangeEvent
evt
) {
System
.
out
.
println
(
"Property:"
+
evt
.
getPropertyName
()+
" Old Value:"
+
evt
.
getOldValue
()+
" New Value:"
+
evt
.
getNewValue
());
}
});
field_calendar
.
addPropertyChangeListener
(
"date"
,
new
PropertyChangeListener
(){
public
void
propertyChange
(
PropertyChangeEvent
evt
) {
System
.
out
.
println
(
"date is new:"
+
evt
.
getNewValue
());
}
});
JTextField
field_textfield
=
new
JTextField
();
field_textfield
.
addPropertyChangeListener
(
new
PropertyChangeListener
(){
public
void
propertyChange
(
PropertyChangeEvent
evt
){
System
.
out
.
println
(
"Property:"
+
evt
.
getPropertyName
()+
" Old Value:"
+
evt
.
getOldValue
()+
" New Value:"
+
evt
.
getNewValue
());
}
});
field_textfield
.
addActionListener
(
new
ActionListener
(){
public
void
actionPerformed
(
ActionEvent
evt
){
System
.
out
.
println
(
"JTextField actionevent"
);
}
});
field_textfield
.
addKeyListener
(
new
KeyListener
(){
public
void
keyTyped
(
KeyEvent
e
) {
System
.
out
.
println
(
"Key typed:"
+
e
.
getKeyChar
());
}
public
void
keyPressed
(
KeyEvent
e
) {
}
public
void
keyReleased
(
KeyEvent
e
) {
if
(
e
.
getSource
()
instanceof
JTextField
){
System
.
out
.
println
(
"Text for read:"
+((
JTextField
)
e
.
getSource
()).
getText
());
}
}
});
JButton
field_jbutton
=
new
JButton
();
field_jbutton
.
addPropertyChangeListener
(
new
PropertyChangeListener
(){
public
void
propertyChange
(
PropertyChangeEvent
evt
) {
System
.
out
.
println
(
"PropertyName:"
+
evt
.
getPropertyName
()+
" OldValue:"
+
evt
.
getOldValue
()+
" NewValue:"
+
evt
.
getNewValue
());
}
});
this
.
getContentPane
().
setLayout
(
new
java
.
awt
.
GridLayout
(
3
,
1
));
this
.
getContentPane
().
add
(
field_calendar
);
this
.
getContentPane
().
add
(
field_textfield
);
this
.
getContentPane
().
add
(
field_jbutton
);
this
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
this
.
setVisible
(
true
);
}
}
Back
|
FazBrowse Home
|
New Git URL