Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FaultInOurPong
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Group3
FaultInOurPong
Commits
ec733e36
Commit
ec733e36
authored
8 years ago
by
Arfa Butt
Browse files
Options
Downloads
Patches
Plain Diff
Update Pong_viewAndController.java to work with View
parent
146ebd7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Game_Code/src/Pong_viewAndController.java
+8
-20
8 additions, 20 deletions
Game_Code/src/Pong_viewAndController.java
with
8 additions
and
20 deletions
Game_Code/src/Pong_viewAndController.java
+
8
−
20
View file @
ec733e36
import
java.awt.*
;
import
javax.swing.*
;
public
class
Pong_viewAndController
extends
JFrame
{
private
JButton
start
=
new
JButton
(
"Start"
);
private
JButton
suspend
=
new
JButton
(
"Suspend"
);
private
JButton
tutorial
=
new
JButton
(
"
Tutorial
"
);
private
JButton
resume
=
new
JButton
(
"
Resume
"
);
private
JButton
save
=
new
JButton
(
"Save"
);
private
JButton
exit
=
new
JButton
(
"Exit"
);
public
Pong_viewAndController
(){
public
Pong_viewAndController
(
JFrame
frame
){
super
(
"FaultInOurPong"
);
this
.
setSize
(
700
,
500
);
this
.
setResizable
(
false
);
...
...
@@ -20,16 +16,12 @@ public class Pong_viewAndController extends JFrame{
JPanel
buttonPanel
=
new
JPanel
();
buttonPanel
.
setLayout
(
new
BoxLayout
(
buttonPanel
,
BoxLayout
.
Y_AXIS
));
start
.
setMaximumSize
(
suspend
.
getPreferredSize
());
start
.
setAlignmentX
(
Component
.
CENTER_ALIGNMENT
);
buttonPanel
.
add
(
start
);
buttonPanel
.
add
(
Box
.
createVerticalStrut
(
10
));
suspend
.
setAlignmentX
(
Component
.
CENTER_ALIGNMENT
);
buttonPanel
.
add
(
suspend
);
buttonPanel
.
add
(
Box
.
createVerticalStrut
(
10
));
tutorial
.
setMaximumSize
(
suspend
.
getPreferredSize
());
tutorial
.
setAlignmentX
(
Component
.
CENTER_ALIGNMENT
);
buttonPanel
.
add
(
tutorial
);
resume
.
setMaximumSize
(
suspend
.
getPreferredSize
());
resume
.
setAlignmentX
(
Component
.
CENTER_ALIGNMENT
);
buttonPanel
.
add
(
resume
);
buttonPanel
.
add
(
Box
.
createVerticalStrut
(
10
));
save
.
setMaximumSize
(
suspend
.
getPreferredSize
());
save
.
setAlignmentX
(
Component
.
CENTER_ALIGNMENT
);
...
...
@@ -39,14 +31,10 @@ public class Pong_viewAndController extends JFrame{
exit
.
setAlignmentX
(
Component
.
CENTER_ALIGNMENT
);
buttonPanel
.
add
(
exit
);
//JPanel west = new JPanel(new GridBagLayout());
// west.add(buttonPanel);
Game
game
=
new
Game
();
game_interface
.
add
(
buttonPanel
);
game_interface
.
add
(
game
);
//add(west,BorderLayout.WEST);
add
(
game_interface
);
setLocationRelativeTo
(
null
);
...
...
@@ -54,8 +42,8 @@ public class Pong_viewAndController extends JFrame{
this
.
setVisible
(
true
);
}
public
static
void
main
(
String
[]
args
){
/*
public static void main(String[] args){
Pong_viewAndController view_controller = new Pong_viewAndController();
}
}
*/
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment