FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Uni__LibraryManagementJavaGUI/src/code/AdminForm.java at master · bestmahdi2/Uni__LibraryManagementJavaGUI · GitHub
bestmahdi2
/
Uni__LibraryManagementJavaGUI
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
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
Uni__LibraryManagementJavaGUI
/
src
/
code
/
AdminForm.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
136 lines (119 loc) · 4.67 KB
Breadcrumbs
Uni__LibraryManagementJavaGUI
/
src
/
code
/
AdminForm.java
Copy path
File metadata and controls
136 lines (119 loc) · 4.67 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package
code
;
import
javax
.
swing
.*;
import
java
.
awt
.*;
import
java
.
awt
.
event
.*;
public
class
AdminForm
extends
JFrame
{
// Ui variables
private
JLabel
labelLogo
;
private
JPanel
labelUsername
;
private
JPanel
adminFrame
;
private
JButton
buttonAddAdmin
;
private
JButton
buttonAddBook
;
private
JButton
buttonCommentSeek
;
private
JLabel
labelAbout
;
// related forms
private
final
AddAdminForm
addAdminForm
=
new
AddAdminForm
();
private
final
AddBookForm
addBookForm
=
new
AddBookForm
();
private
final
CommentSeek
commentSeekForm
=
new
CommentSeek
();
/**
* Constructor method,
*/
public
AdminForm
() {
setResizable
(
false
);
// forbidden user to resize the frame
setLocationRelativeTo
(
null
);
// to be opened in center
try
{
// change its look to Microsoft Windows
UIManager
.
setLookAndFeel
(
UIManager
.
getSystemLookAndFeelClassName
());
}
catch
(
Exception
e
) {
e
.
printStackTrace
();
}
setContentPane
(
adminFrame
);
// set main frame
// Title and size of frame
setTitle
(
"Admin Form"
);
setSize
(
500
,
600
);
// Action after closing this frame
setDefaultCloseOperation
(
WindowConstants
.
EXIT_ON_CLOSE
);
// set Icon for JFrame
setIconImage
(
new
ImageIcon
(
"src/images/mOMIDs.png"
).
getImage
());
mouseClickActions
();
// mouse click actions to object in frame
mouseMoveActions
();
// mouse move actions to object in frame
setVisible
(
true
);
// show the frame and windows
}
/**
* mouseMoveActions method for setting move actions of mouse for any object on frame
*/
private
void
mouseMoveActions
() {
buttonAddAdmin
.
addMouseMotionListener
(
new
MouseMotionAdapter
() {
@
Override
public
void
mouseMoved
(
MouseEvent
e
) {
super
.
mouseMoved
(
e
);
buttonAddAdmin
.
setCursor
(
Cursor
.
getPredefinedCursor
(
Cursor
.
HAND_CURSOR
));
buttonAddAdmin
.
setBackground
(
new
Color
(
135
,
69
,
211
));
buttonAddBook
.
setBackground
(
new
Color
(
234
,
35
,
123
));
buttonCommentSeek
.
setBackground
(
new
Color
(
234
,
35
,
123
));
}
});
buttonAddBook
.
addMouseMotionListener
(
new
MouseMotionAdapter
() {
@
Override
public
void
mouseMoved
(
MouseEvent
e
) {
super
.
mouseMoved
(
e
);
buttonAddBook
.
setCursor
(
Cursor
.
getPredefinedCursor
(
Cursor
.
HAND_CURSOR
));
buttonAddAdmin
.
setBackground
(
new
Color
(
234
,
35
,
123
));
buttonAddBook
.
setBackground
(
new
Color
(
135
,
69
,
211
));
buttonCommentSeek
.
setBackground
(
new
Color
(
234
,
35
,
123
));
}
});
buttonCommentSeek
.
addMouseMotionListener
(
new
MouseMotionAdapter
() {
@
Override
public
void
mouseMoved
(
MouseEvent
e
) {
super
.
mouseMoved
(
e
);
buttonCommentSeek
.
setCursor
(
Cursor
.
getPredefinedCursor
(
Cursor
.
HAND_CURSOR
));
buttonAddAdmin
.
setBackground
(
new
Color
(
234
,
35
,
123
));
buttonAddBook
.
setBackground
(
new
Color
(
234
,
35
,
123
));
buttonCommentSeek
.
setBackground
(
new
Color
(
135
,
69
,
211
));
}
});
labelAbout
.
addMouseMotionListener
(
new
MouseMotionAdapter
() {
@
Override
public
void
mouseMoved
(
MouseEvent
e
) {
super
.
mouseMoved
(
e
);
labelAbout
.
setCursor
(
Cursor
.
getPredefinedCursor
(
Cursor
.
HAND_CURSOR
));
}
});
}
/**
* mouseMoveActions method for setting click actions of mouse for any object on frame
*/
private
void
mouseClickActions
() {
buttonCommentSeek
.
addActionListener
(
new
ActionListener
() {
@
Override
public
void
actionPerformed
(
ActionEvent
e
) {
commentSeekForm
.
setVisible
(
true
);
}
});
buttonAddAdmin
.
addActionListener
(
new
ActionListener
() {
@
Override
public
void
actionPerformed
(
ActionEvent
e
) {
addAdminForm
.
setVisible
(
true
);
}
});
buttonAddBook
.
addActionListener
(
new
ActionListener
() {
@
Override
public
void
actionPerformed
(
ActionEvent
e
) {
addBookForm
.
setVisible
(
true
);
}
});
MouseListener
ml2
;
ml2
=
new
MouseAdapter
() {
public
void
mousePressed
(
MouseEvent
e
) {
AboutForm
aboutForm
=
new
AboutForm
();
}
};
labelAbout
.
addMouseListener
(
ml2
);
}
/**
* main method for testing the frame, it's useless in general
*/
public
static
void
main
(
String
[]
args
) {
AdminForm
com
=
new
AdminForm
();
}
}
Back
|
FazBrowse Home
|
New Git URL