Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
JTankTrouble
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9831111
JTankTrouble
Commits
10925a5f
Commit
10925a5f
authored
Aug 08, 2020
by
nargessalehi98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update setting frame class.
parent
108ae5b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
SettingFrame.java
src/SettingFrame.java
+15
-6
No files found.
src/SettingFrame.java
View file @
10925a5f
...
@@ -16,6 +16,9 @@ public class SettingFrame extends JFrame {
...
@@ -16,6 +16,9 @@ public class SettingFrame extends JFrame {
private
JLabel
tankLabel
;
private
JLabel
tankLabel
;
private
JLabel
tankPhoto
;
private
JLabel
tankPhoto
;
private
ImageIcon
tank
;
private
ImageIcon
tank
;
private
JSlider
tankHealthSlider
;
private
JSlider
shotDamageSlider
;
private
JSlider
wallsHealthSlider
;
public
SettingFrame
()
{
public
SettingFrame
()
{
...
@@ -69,7 +72,6 @@ public class SettingFrame extends JFrame {
...
@@ -69,7 +72,6 @@ public class SettingFrame extends JFrame {
add
(
userInformationPanel
);
add
(
userInformationPanel
);
}
}
public
void
textAndLabel
(
String
pngFile
,
String
textField
)
{
public
void
textAndLabel
(
String
pngFile
,
String
textField
)
{
...
@@ -100,9 +102,12 @@ public class SettingFrame extends JFrame {
...
@@ -100,9 +102,12 @@ public class SettingFrame extends JFrame {
gameDetailsPanel
.
setLayout
(
new
GridLayout
(
3
,
2
));
gameDetailsPanel
.
setLayout
(
new
GridLayout
(
3
,
2
));
settingPanel
.
setBackground
(
Color
.
darkGray
);
settingPanel
.
setBackground
(
Color
.
darkGray
);
settingPanel
.
setLayout
(
new
BorderLayout
());
settingPanel
.
setLayout
(
new
BorderLayout
());
sliderAndIcon
(
"pictures/tankHealth.png"
,
40
);
tankHealthSlider
=
new
JSlider
(
10
,
100
,
40
);
sliderAndIcon
(
"pictures/shotDamage.png"
,
80
);
shotDamageSlider
=
new
JSlider
(
10
,
100
,
80
);
sliderAndIcon
(
"pictures/DestructibleWall.png"
,
20
);
wallsHealthSlider
=
new
JSlider
(
10
,
100
,
20
);
sliderAndIcon
(
tankHealthSlider
,
"pictures/tankHealth.png"
);
sliderAndIcon
(
shotDamageSlider
,
"pictures/shotDamage.png"
);
sliderAndIcon
(
wallsHealthSlider
,
"pictures/DestructibleWall.png"
);
initServerPanel
();
initServerPanel
();
add
(
settingPanel
);
add
(
settingPanel
);
settingPanel
.
add
(
gameDetailsPanel
,
BorderLayout
.
NORTH
);
settingPanel
.
add
(
gameDetailsPanel
,
BorderLayout
.
NORTH
);
...
@@ -118,6 +123,9 @@ public class SettingFrame extends JFrame {
...
@@ -118,6 +123,9 @@ public class SettingFrame extends JFrame {
okButton
.
addActionListener
(
new
ActionListener
()
{
okButton
.
addActionListener
(
new
ActionListener
()
{
@Override
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
public
void
actionPerformed
(
ActionEvent
e
)
{
Controller
.
bulletDamage
=
shotDamageSlider
.
getValue
();
Controller
.
tankHealth
=
tankHealthSlider
.
getValue
();
Controller
.
wallsHealth
=
wallsHealthSlider
.
getValue
();
dispose
();
dispose
();
}
}
});
});
...
@@ -125,9 +133,8 @@ public class SettingFrame extends JFrame {
...
@@ -125,9 +133,8 @@ public class SettingFrame extends JFrame {
serverPanel
.
add
(
okButton
,
BorderLayout
.
EAST
);
serverPanel
.
add
(
okButton
,
BorderLayout
.
EAST
);
}
}
public
void
sliderAndIcon
(
String
iconName
,
int
valu
e
)
{
public
void
sliderAndIcon
(
JSlider
slider
,
String
iconNam
e
)
{
JSlider
slider
=
new
JSlider
(
10
,
100
,
value
);
slider
.
setMajorTickSpacing
(
10
);
slider
.
setMajorTickSpacing
(
10
);
slider
.
setBackground
(
Color
.
darkGray
);
slider
.
setBackground
(
Color
.
darkGray
);
slider
.
setBorder
(
new
LineBorder
(
Color
.
GRAY
,
2
));
slider
.
setBorder
(
new
LineBorder
(
Color
.
GRAY
,
2
));
...
@@ -143,4 +150,6 @@ public class SettingFrame extends JFrame {
...
@@ -143,4 +150,6 @@ public class SettingFrame extends JFrame {
gameDetailsPanel
.
add
(
slider
);
gameDetailsPanel
.
add
(
slider
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment