Skip to content
Snippets Groups Projects
Commit 9a16a278 authored by CHEVALIER Noemy's avatar CHEVALIER Noemy
Browse files

Mise à jour et correction des bugs

parent 0951a5b3
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@ package shukan;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**Graphical view for planner of student */
public class ShukanStudent extends JPanel{
......@@ -45,29 +44,17 @@ public class ShukanStudent extends JPanel{
/** Week column actual 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 */
private final Color GRID_COLOR = Color.BLACK;
/** Text color */
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 */
private ShukanData data = null;
/** Creates the shukan viewer */
public ShukanStudent(ShukanData data, ShukanIO myIO, int height){
public ShukanStudent(ShukanData data, int height){
this.data = data;
this.myIO = myIO;
this.height = height;
setPreferredSize(new Dimension(STD_APPLI_WIDTH, height));
......@@ -116,53 +103,25 @@ public class ShukanStudent extends JPanel{
/** Displays the calendar grid background.*/
private void displayCalendar (Graphics2D g2) {
if (isButtonClicked == false){
g2.setColor(GRID_COLOR);
// Lines
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);
g2.setColor(GRID_COLOR);
// Lines
drawHLine(g2, 0, 40, appliWidth);
// Columns
for (int i = 2; i <= nbWeeks + 1; i++)
drawVLine(g2, i * weekWidth, 0, appliHeight);
// 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,
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,
drawText (g2, (2 + i) * weekWidth, 0,
weekWidth, 20, "/" + durations[i]);
}
}
}
/**Create a new height */
......@@ -187,20 +146,6 @@ public class ShukanStudent extends JPanel{
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.*/
private void drawBox (Graphics2D g2, int posx, int posy,int width, int height) {
g2.fillRect (posx, appliHeight - posy - height, width, height);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment