Java Reference
In-Depth Information
int
posY
#
(
int
) e.getPoint().getY();
// verify if the mouse is over a task of Resource 1
for
(
int
i
#
0; i<2; i
!!
) {
Resource resource
#
manager.problem.getResource(i);
if
(posY >
#
30
!
i*120
&&
posY < 120*(i
!
1)) {
Iterator iterActivity
#
resource.getActivities();
Activity activity
#
null
;
int
release, activation, termination, due;
while
(iterActivity.hasNext()) {
activity
#
(Activity) iterActivity.next();
if
(posY >
#
30
!
i*120
!
activity.getID()*10
&&
posY < 40
!
i*120
!
activity.getID()*10) {
release
#
(
int
) Math.round
(activity.getRelease());
activation
#
(
int
) Math.round
(activity.getActivation());
termination
#
(
int
) Math.round
(activity.getTermination());
due
#
(
int
) Math.round(activity.getDueTime());
manager.scheduleCommand.showParameters
(resource.getName(),
activity.getName(), release, activation,
termination, due);
return
;
}
}
}
}
}
public void
mouseDragged(MouseEvent e) {
if
(manager.problem
##
null
)
return
;
int
posX
#
(
int
) e.getPoint().getX();
posX
#
(posX-30)/10;
if
(selectedActivity !
#
null
) {
if(dueDateSelected
##
true
)
selectedActivity.setDueTime(posX);
else
selectedActivity.setReleaseTime(posX);
repaint();
}
}
}
}
The graphical user interface can be implemented on top of the Swing
library (see Sidebar 3.3).