当前位置: 首页>>代码示例>>Java>>正文


Java InteractivePanel.MOUSE_RELEASED属性代码示例

本文整理汇总了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("");
  }
}
 
开发者ID:OpenSourcePhysics,项目名称:STP,代码行数:18,代码来源:CarnotApp.java

示例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("");
  }
}
 
开发者ID:OpenSourcePhysics,项目名称:STP,代码行数:26,代码来源:EntropyApp.java

示例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);
  }
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:57,代码来源:VideoMouseHandler.java


注:本文中的org.opensourcephysics.display.InteractivePanel.MOUSE_RELEASED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。