本文整理汇总了Java中org.opensourcephysics.display.InteractivePanel.MOUSE_RELEASED属性的典型用法代码示例。如果您正苦于以下问题:Java InteractivePanel.MOUSE_RELEASED属性的具体用法?Java InteractivePanel.MOUSE_RELEASED怎么用?Java InteractivePanel.MOUSE_RELEASED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.opensourcephysics.display.InteractivePanel
的用法示例。
在下文中一共展示了InteractivePanel.MOUSE_RELEASED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMouseAction
public void handleMouseAction(InteractivePanel panel, MouseEvent evt) {
int id = -1;
if(panel.getMouseAction()==InteractivePanel.MOUSE_PRESSED) {
//do nothing
}
if(panel.getMouseAction()==InteractivePanel.MOUSE_DRAGGED) {
double x = panel.getMouseX();
double y = panel.getMouseY();
id = MouseOnCurve(x, y);
System.out.println(id+"\t"+x+"\t"+y);
if((x>0)&&(y>0)) {
drawCurve(id, x, y);
}
}
if(panel.getMouseAction()==InteractivePanel.MOUSE_RELEASED) {
plotFrame.setMessage("");
}
}
示例2: handleMouseAction
public void handleMouseAction(InteractivePanel panel, MouseEvent evt) {
if(panel.getMouseAction()==InteractivePanel.MOUSE_PRESSED) {
double s = MouseOnCurve(panel.getMouseX(), panel.getMouseY());
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(3);
if(s!=Double.MIN_VALUE) {
String str = "";
switch(cid) {
case 0 :
str = "T = ";
break;
case 1 :
str = "Ta = ";
plotFrame.setMessage(str+nf.format(s));
break;
case 2 :
str = "Tb = ";
plotFrame.setMessage(str+nf.format(s));
break;
}
}
}
if(panel.getMouseAction()==InteractivePanel.MOUSE_RELEASED) {
plotFrame.setMessage("");
}
}
示例3: handleMouseAction
/**
* Handles a mouse action for a video panel.
*
* @param panel the video panel
* @param e the mouse event
*/
public void handleMouseAction(InteractivePanel panel, MouseEvent e) {
if(!(panel instanceof VideoPanel)) {
return;
}
VideoPanel vidPanel = (VideoPanel) panel;
switch(vidPanel.getMouseAction()) {
case InteractivePanel.MOUSE_PRESSED :
if((iad!=null)&&(iad instanceof TPoint)) {
p = (TPoint) iad;
bounds = p.getBounds(vidPanel);
p.setXY(vidPanel.getMouseX(), vidPanel.getMouseY());
if(bounds!=null) {
bounds.add(p.getBounds(vidPanel));
vidPanel.repaint(bounds);
} else {
vidPanel.repaint();
}
}
break;
case InteractivePanel.MOUSE_RELEASED :
iad = p = null;
break;
case InteractivePanel.MOUSE_DRAGGED :
if(p!=null) {
bounds = p.getBounds(vidPanel);
p.setXY(vidPanel.getMouseX(), vidPanel.getMouseY());
if(bounds!=null) {
bounds.add(p.getBounds(vidPanel));
vidPanel.repaint(bounds);
} else {
vidPanel.repaint();
}
}
break;
case InteractivePanel.MOUSE_MOVED :
if(vidPanel.isDrawingInImageSpace()) {
iad = vidPanel.getInteractive();
}
if((iad!=null)&&(iad instanceof TPoint)) {
vidPanel.setMouseCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
} else {
vidPanel.setMouseCursor(Cursor.getDefaultCursor());
}
break;
}
if(p==null) {
vidPanel.hideMouseBox();
} else {
p.showCoordinates(vidPanel);
}
}