Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SAE2.01 - Developpement application
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PIQUEREZ Corentin
SAE2.01 - Developpement application
Commits
2884c90d
Commit
2884c90d
authored
1 year ago
by
PIQUEREZ Corentin
Browse files
Options
Downloads
Patches
Plain Diff
actionlistener sur les boutons fonctionnel, mais pas complet
parent
17fcf14c
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
data/2223_S2/version.txt
+2
-2
2 additions, 2 deletions
data/2223_S2/version.txt
shukan/Shukan.java
+8
-7
8 additions, 7 deletions
shukan/Shukan.java
shukan/ShukanController.java
+9
-17
9 additions, 17 deletions
shukan/ShukanController.java
shukan/ShukanViewBar.java
+8
-9
8 additions, 9 deletions
shukan/ShukanViewBar.java
with
27 additions
and
35 deletions
data/2223_S2/version.txt
+
2
−
2
View file @
2884c90d
1
2
2
20708
2
30519
This diff is collapsed.
Click to expand it.
shukan/Shukan.java
+
8
−
7
View file @
2884c90d
...
@@ -37,7 +37,7 @@ public class Shukan
...
@@ -37,7 +37,7 @@ public class Shukan
JFrame
frame
=
new
JFrame
(
"SHUKAN 1.6"
);
JFrame
frame
=
new
JFrame
(
"SHUKAN 1.6"
);
JPanel
global
=
new
JPanel
(
new
BorderLayout
());
JPanel
global
=
new
JPanel
(
new
BorderLayout
());
ShukanView
canvas
=
new
ShukanView
(
data
,
io
);
ShukanView
canvas
=
new
ShukanView
(
data
,
io
);
ShukanViewBar
bar
re
=
new
ShukanViewBar
(
io
,
data
,
90
);
ShukanViewBar
mytool
bar
=
new
ShukanViewBar
(
90
);
// Getting the display size
// Getting the display size
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
...
@@ -45,14 +45,15 @@ public class Shukan
...
@@ -45,14 +45,15 @@ public class Shukan
GraphicsConfiguration
[]
gc
=
gd
.
getConfigurations
();
GraphicsConfiguration
[]
gc
=
gd
.
getConfigurations
();
Rectangle
gcBounds
=
gc
[
0
].
getBounds
();
Rectangle
gcBounds
=
gc
[
0
].
getBounds
();
canvas
.
restrictSize
((
int
)
(
gcBounds
.
getWidth
())
-
LEFT_MARGIN
,
canvas
.
restrictSize
((
int
)
(
gcBounds
.
getWidth
())
-
LEFT_MARGIN
,
(
int
)
(
gcBounds
.
getHeight
())
-
TOP_MARGIN
-
bar
re
.
getHeight
());
(
int
)
(
gcBounds
.
getHeight
())
-
TOP_MARGIN
-
mytool
bar
.
getHeight
());
bar
re
.
setSize
(
new
Dimension
((
int
)
(
gcBounds
.
getWidth
())
-
LEFT_MARGIN
,
bar
re
.
getHeight
()));
mytool
bar
.
setSize
(
new
Dimension
((
int
)
(
gcBounds
.
getWidth
())
-
LEFT_MARGIN
,
mytool
bar
.
getHeight
()));
// Adding a openGL input handler (controller)
// Adding a openGL input handler (controller)
ShukanController
myController
=
new
ShukanController
(
canvas
,
data
);
ShukanController
myController
=
new
ShukanController
(
canvas
,
mytoolbar
,
data
);
canvas
.
addKeyListener
(
myController
);
canvas
.
addKeyListener
(
myController
);
canvas
.
addMouseListener
(
myController
);
canvas
.
addMouseListener
(
myController
);
//canvas.addMouseMotionListener (myController);
mytoolbar
.
addActionListener
(
myController
);
// Preparing the window closing button
// Preparing the window closing button
frame
.
addWindowListener
(
frame
.
addWindowListener
(
...
@@ -67,12 +68,12 @@ public class Shukan
...
@@ -67,12 +68,12 @@ public class Shukan
// Setting the window geometry
// Setting the window geometry
global
.
add
(
bar
re
,
BorderLayout
.
NORTH
);
global
.
add
(
mytool
bar
,
BorderLayout
.
NORTH
);
global
.
add
(
canvas
,
BorderLayout
.
CENTER
);
global
.
add
(
canvas
,
BorderLayout
.
CENTER
);
frame
.
add
(
global
);
frame
.
add
(
global
);
Insets
ins
=
frame
.
getInsets
();
Insets
ins
=
frame
.
getInsets
();
frame
.
setSize
(
canvas
.
displayWidth
()
+
ins
.
left
+
ins
.
right
,
frame
.
setSize
(
canvas
.
displayWidth
()
+
ins
.
left
+
ins
.
right
,
canvas
.
displayHeight
()+
bar
re
.
getHeight
()+
ins
.
top
+
ins
.
bottom
);
canvas
.
displayHeight
()+
mytool
bar
.
getHeight
()+
ins
.
top
+
ins
.
bottom
);
frame
.
setLocation
(
LEFT_MARGIN
,
0
);
frame
.
setLocation
(
LEFT_MARGIN
,
0
);
frame
.
setBackground
(
Color
.
white
);
frame
.
setBackground
(
Color
.
white
);
frame
.
setVisible
(
true
);
frame
.
setVisible
(
true
);
...
...
This diff is collapsed.
Click to expand it.
shukan/ShukanController.java
+
9
−
17
View file @
2884c90d
...
@@ -18,9 +18,10 @@ public class ShukanController
...
@@ -18,9 +18,10 @@ public class ShukanController
* @param canvas display area.
* @param canvas display area.
* @param myView OpenGL context.
* @param myView OpenGL context.
*/
*/
public
ShukanController
(
ShukanView
canvas
,
ShukanData
data
)
public
ShukanController
(
ShukanView
canvas
,
ShukanViewBar
bar
,
ShukanData
data
)
{
{
this
.
canvas
=
canvas
;
this
.
canvas
=
canvas
;
this
.
bar
=
bar
;
this
.
data
=
data
;
this
.
data
=
data
;
}
}
...
@@ -203,29 +204,20 @@ public class ShukanController
...
@@ -203,29 +204,20 @@ public class ShukanController
public
void
actionPerformed
(
ActionEvent
e
){
public
void
actionPerformed
(
ActionEvent
e
){
if
(
e
.
getSource
()==
bar
.
buttons
[
0
])
if
(
e
.
getSource
()==
bar
.
buttons
[
0
])
System
.
out
.
println
(
"save"
);
System
.
out
.
println
(
"save"
);
else
if
(
e
.
getSource
()==
bar
.
buttons
[
1
])
/**case bar.buttons[1]:
System
.
out
.
println
(
"back"
);
System
.
out
.
println
(
"back"
);
break;
else
if
(
e
.
getSource
()==
bar
.
buttons
[
2
])
case bar.buttons[2]:
System
.
out
.
println
(
"plus"
);
System
.
out
.
println
(
"plus"
);
break;
else
if
(
e
.
getSource
()==
bar
.
buttons
[
3
])
case bar.buttons[3]:
System
.
out
.
println
(
"delete"
);
System
.
out
.
println
(
"delete"
);
break;
else
if
(
e
.
getSource
()==
bar
.
buttons
[
4
])
case bar.buttons[4]:
System
.
out
.
println
(
"left"
);
System
.
out
.
println
(
"left"
);
break;
else
if
(
e
.
getSource
()==
bar
.
buttons
[
5
])
case bar.buttons[5]:
System
.
out
.
println
(
"right"
);
System
.
out
.
println
(
"right"
);
break;
else
if
(
e
.
getSource
()==
bar
.
buttons
[
6
])
case bar.buttons[6]:
System
.
out
.
println
(
"export"
);
System
.
out
.
println
(
"export"
);
break;
else
if
(
e
.
getSource
()==
bar
.
buttons
[
7
])
case bar.buttons[7]:
System
.
out
.
println
(
"parameter"
);
System
.
out
.
println
(
"parameter"
);
break;*/
}
}
}
}
This diff is collapsed.
Click to expand it.
shukan/ShukanViewBar.java
+
8
−
9
View file @
2884c90d
...
@@ -4,10 +4,7 @@ import javax.swing.*;
...
@@ -4,10 +4,7 @@ import javax.swing.*;
import
java.awt.*
;
import
java.awt.*
;
public
class
ShukanViewBar
extends
JPanel
{
public
class
ShukanViewBar
extends
JPanel
{
/** File manager */
private
ShukanIO
myIO
=
null
;
/** Displayed data */
private
ShukanData
data
=
null
;
/** Name of the images files for the buttons of the toolbar */
/** Name of the images files for the buttons of the toolbar */
private
String
[]
imagesName
=
{
"save"
,
"back"
,
"plus"
,
"delete"
,
"left"
,
"right"
,
"export"
,
"parameter"
};
private
String
[]
imagesName
=
{
"save"
,
"back"
,
"plus"
,
"delete"
,
"left"
,
"right"
,
"export"
,
"parameter"
};
/** Buttons of the toolbar */
/** Buttons of the toolbar */
...
@@ -17,20 +14,22 @@ public class ShukanViewBar extends JPanel {
...
@@ -17,20 +14,22 @@ public class ShukanViewBar extends JPanel {
/** height in pixel of the toolbar */
/** height in pixel of the toolbar */
private
int
height
;
private
int
height
;
public
ShukanViewBar
(
ShukanIO
myIO
,
ShukanData
data
,
int
height
){
public
ShukanViewBar
(
int
height
){
this
.
myIO
=
myIO
;
this
.
data
=
data
;
this
.
height
=
height
;
this
.
height
=
height
;
for
(
int
i
=
0
;
i
<
imagesName
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
imagesName
.
length
;
i
++){
buttons
[
i
]
=
new
JButton
(
""
,
new
ImageIcon
(
"data/images/"
+
imagesName
[
i
]+
imagesExtension
));
buttons
[
i
]
=
new
JButton
(
""
,
new
ImageIcon
(
"data/images/"
+
imagesName
[
i
]+
imagesExtension
));
buttons
[
i
].
setPreferredSize
(
new
Dimension
(
80
,
80
));
buttons
[
i
].
setPreferredSize
(
new
Dimension
(
80
,
80
));
//buttons[i].addActionListener(...);
add
(
buttons
[
i
]);
add
(
buttons
[
i
]);
}
}
}
}
public
int
getHeight
(){
return
height
;}
public
int
getHeight
(){
return
height
;}
public
void
addActionListener
(
ShukanController
controller
){
for
(
int
i
=
0
;
i
<
imagesName
.
length
;
i
++){
buttons
[
i
].
addActionListener
(
controller
);
}
}
}
}
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