Skip to content
Snippets Groups Projects
Commit f06cdde9 authored by PIQUEREZ Corentin's avatar PIQUEREZ Corentin
Browse files

début fenetre double click

parent 1a5e155f
Branches
No related tags found
No related merge requests found
11
14
230520
......@@ -156,10 +156,13 @@ public class ShukanController
canvas.repaint ();
}
}
// Manage the double click to open a new window
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
System.out.println("double clicked");
canvas.SpecWeekModuleWindow();
}
if (e.getButton () == MouseEvent.BUTTON3)
{
if (e.isShiftDown ())
......
......@@ -143,6 +143,10 @@ public class ShukanData
{
return (curs[selCur]);
}
/** Returns the number of a cursus */
public int cursusNumber(){
return selCur;
}
/** Returns the name of a cursus */
public String cursusName (int num)
......
package shukan;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.*;
import java.awt.*;
/** Graphical view for Shukan planner.
......@@ -376,4 +372,22 @@ public class ShukanView extends JPanel
posy -= fontHeight;
}
}
/** creates a new Window with the specification of a selected week and module */
public void SpecWeekModuleWindow(){
int num_module = data.selectedModule();
int num_cursus = data.cursusNumber();
int num_semaine = data.selectedWeek()+data.startWeekNumber();
int debut = data.moduleStart(num_cursus, num_module);
int fin = data.moduleEnd(num_cursus, num_module);
// affiche la fenetre si il y a cours pendant cette periode
if(num_semaine>=debut && (num_semaine<=fin || fin == 0))
{
JFrame spec = new JFrame(data.cursusName(num_cursus) + " - Semaine" + (num_semaine) + " - " + data.moduleNames(num_cursus)[num_module]);
int[] a = data.scheduleInWeek(num_module, num_semaine);
for (int i = 0; i<a.length; i++)System.out.println(a[i]);
spec.setSize(new Dimension(300, 150));
spec.setVisible(true);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment