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
9a16a278
Commit
9a16a278
authored
1 year ago
by
CHEVALIER Noemy
Browse files
Options
Downloads
Patches
Plain Diff
Mise à jour et correction des bugs
parent
0951a5b3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shukan/ShukanStudent.java
+15
-70
15 additions, 70 deletions
shukan/ShukanStudent.java
with
15 additions
and
70 deletions
shukan/ShukanStudent.java
+
15
−
70
View file @
9a16a278
...
@@ -2,7 +2,6 @@ package shukan;
...
@@ -2,7 +2,6 @@ package shukan;
import
javax.swing.*
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.event.*
;
/**Graphical view for planner of student */
/**Graphical view for planner of student */
public
class
ShukanStudent
extends
JPanel
{
public
class
ShukanStudent
extends
JPanel
{
...
@@ -45,29 +44,17 @@ public class ShukanStudent extends JPanel{
...
@@ -45,29 +44,17 @@ public class ShukanStudent extends JPanel{
/** Week column actual width */
/** Week column actual width */
private
int
weekWidth
=
STD_WEEK_WIDTH
;
private
int
weekWidth
=
STD_WEEK_WIDTH
;
/** Frame borders color */
private
final
Color
ACTIVE_COLOR
=
new
Color
(
0.6f
,
0.6f
,
0.9f
);
/** Selected activity color */
private
final
Color
REACTIVE_COLOR
=
new
Color
(
0.7f
,
0.9f
,
0.5f
);
/** Grid color */
/** Grid color */
private
final
Color
GRID_COLOR
=
Color
.
BLACK
;
private
final
Color
GRID_COLOR
=
Color
.
BLACK
;
/** Text color */
/** Text color */
private
Color
TEXT_COLOR
=
Color
.
BLACK
;
private
Color
TEXT_COLOR
=
Color
.
BLACK
;
/**The vertical line with his height */
private
int
verticalLineHeight
=
60
;
private
boolean
isButtonClicked
=
false
;
/** File manager */
private
ShukanIO
myIO
=
null
;
/** Displayed data */
/** Displayed data */
private
ShukanData
data
=
null
;
private
ShukanData
data
=
null
;
/** Creates the shukan viewer */
/** Creates the shukan viewer */
public
ShukanStudent
(
ShukanData
data
,
ShukanIO
myIO
,
int
height
){
public
ShukanStudent
(
ShukanData
data
,
int
height
){
this
.
data
=
data
;
this
.
data
=
data
;
this
.
myIO
=
myIO
;
this
.
height
=
height
;
this
.
height
=
height
;
setPreferredSize
(
new
Dimension
(
STD_APPLI_WIDTH
,
height
));
setPreferredSize
(
new
Dimension
(
STD_APPLI_WIDTH
,
height
));
...
@@ -116,53 +103,25 @@ public class ShukanStudent extends JPanel{
...
@@ -116,53 +103,25 @@ public class ShukanStudent extends JPanel{
/** Displays the calendar grid background.*/
/** Displays the calendar grid background.*/
private
void
displayCalendar
(
Graphics2D
g2
)
{
private
void
displayCalendar
(
Graphics2D
g2
)
{
if
(
isButtonClicked
==
false
){
g2
.
setColor
(
GRID_COLOR
);
g2
.
setColor
(
GRID_COLOR
);
// Lines
// Lines
drawHLine
(
g2
,
0
,
40
,
appliWidth
);
drawHLine
(
g2
,
0
,
40
,
appliWidth
);
// Columns
for
(
int
i
=
2
;
i
<=
nbWeeks
+
1
;
i
++)
drawVLine
(
g2
,
i
*
weekWidth
,
0
,
appliHeight
);
drawText
(
g2
,
0
,
18
,
2
*
weekWidth
,
textHeight
,
data
.
studentName
());
for
(
int
i
=
0
;
i
<
nbWeeks
;
i
++)
{
int
[]
weekNumbers
=
data
.
weekNumbers
();
int
[]
durations
=
data
.
weekDurations
();
drawText
(
g2
,
(
i
+
2
)
*
weekWidth
,
25
,
weekWidth
,
textHeight
,
""
+
data
.
studentLoad
(
i
));
drawText
(
g2
,
(
2
+
i
)
*
weekWidth
,
0
,
weekWidth
,
20
,
"/"
+
durations
[
i
]);
}
}
else
{
height
=
95
;
g2
.
setColor
(
GRID_COLOR
);
// Lines
drawHLine
(
g2
,
0
,
40
,
appliWidth
);
// Columns
// Columns
for
(
int
i
=
2
;
i
<=
nbWeeks
+
1
;
i
++)
for
(
int
i
=
2
;
i
<=
nbWeeks
+
1
;
i
++)
drawVLine
(
g2
,
i
*
weekWidth
,
0
,
appliHeight
);
drawVLine
(
g2
,
i
*
weekWidth
,
0
,
appliHeight
);
drawText
(
g2
,
0
,
18
,
2
*
weekWidth
,
textHeight
,
data
.
studentName
());
drawText
(
g2
,
0
,
18
,
2
*
weekWidth
,
textHeight
,
data
.
studentName
());
for
(
int
i
=
0
;
i
<
nbWeeks
;
i
++)
for
(
int
i
=
0
;
i
<
nbWeeks
;
i
++)
{
{
int
[]
weekNumbers
=
data
.
weekNumbers
();
int
[]
weekNumbers
=
data
.
weekNumbers
();
int
[]
durations
=
data
.
weekDurations
();
int
[]
durations
=
data
.
weekDurations
();
drawText
(
g2
,
(
i
+
2
)
*
weekWidth
,
25
,
drawText
(
g2
,
(
i
+
2
)
*
weekWidth
,
25
,
weekWidth
,
textHeight
,
""
+
data
.
studentLoad
(
i
));
weekWidth
,
textHeight
,
""
+
data
.
studentLoad
(
i
));
drawText
(
g2
,
(
2
+
i
)
*
weekWidth
,
0
,
drawText
(
g2
,
(
2
+
i
)
*
weekWidth
,
0
,
weekWidth
,
20
,
"/"
+
durations
[
i
]);
weekWidth
,
20
,
"/"
+
durations
[
i
]);
}
}
}
}
}
/**Create a new height */
/**Create a new height */
...
@@ -187,20 +146,6 @@ public class ShukanStudent extends JPanel{
...
@@ -187,20 +146,6 @@ public class ShukanStudent extends JPanel{
appliHeight
-
(
int
)
(
posy
+
(
height
-
fontHeight
)
/
2
));
appliHeight
-
(
int
)
(
posy
+
(
height
-
fontHeight
)
/
2
));
}
}
/** Draws a centered paragraph in the given area. */
private
void
drawText
(
Graphics2D
g2
,
float
posx
,
float
posy
,
float
width
,
float
height
,
String
[]
text
)
{
if
(
text
==
null
)
return
;
posy
+=
(
height
+
(
text
.
length
-
1
)
*
fontHeight
)
/
2
;
for
(
int
i
=
0
;
i
<
text
.
length
;
i
++)
{
drawText
(
g2
,
posx
,
posy
,
width
,
fontHeight
,
text
[
i
]);
posy
-=
fontHeight
;
}
}
/** Draws a rectangular box.*/
/** Draws a rectangular box.*/
private
void
drawBox
(
Graphics2D
g2
,
int
posx
,
int
posy
,
int
width
,
int
height
)
{
private
void
drawBox
(
Graphics2D
g2
,
int
posx
,
int
posy
,
int
width
,
int
height
)
{
g2
.
fillRect
(
posx
,
appliHeight
-
posy
-
height
,
width
,
height
);
g2
.
fillRect
(
posx
,
appliHeight
-
posy
-
height
,
width
,
height
);
...
...
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