本文整理了Java中java.awt.event.MouseEvent.translatePoint()
方法的一些代码示例,展示了MouseEvent.translatePoint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent.translatePoint()
方法的具体详情如下:
包路径:java.awt.event.MouseEvent
类名称:MouseEvent
方法名:translatePoint
[英]Translates the event's coordinates to a new position by adding specified x
(horizontal) and y
(vertical) offsets.
[中]通过添加指定的x
(水平)和y
(垂直)偏移量,将事件坐标转换到新位置。
代码示例来源:origin: org.netbeans.api/org-openide-awt
Dimension d = getSize();
Point splitterPos = splitter.getLocation();
e.translatePoint(splitterPos.x, splitterPos.y);
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
private void handleMouseMoved(MouseEvent e) {
if(currentPage == null) {
return;
}
e.translatePoint(-currentPageXOffset, -currentPageYOffset);
currentPage.handleMouseMoved(e);
e.translatePoint(currentPageXOffset, currentPageYOffset);
}
}
代码示例来源:origin: protegeproject/protege
private void handleMouseMoved(MouseEvent e) {
if(currentPage == null) {
return;
}
e.translatePoint(-currentPageXOffset, -currentPageYOffset);
currentPage.handleMouseMoved(e);
e.translatePoint(currentPageXOffset, currentPageYOffset);
}
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl
private void handleMouseMoved(MouseEvent e) {
if(currentPage == null) {
return;
}
e.translatePoint(-currentPageXOffset, -currentPageYOffset);
currentPage.handleMouseMoved(e);
e.translatePoint(currentPageXOffset, currentPageYOffset);
}
}
代码示例来源:origin: stackoverflow.com
@Override
public void mousePressed(final MouseEvent e) {
e.translatePoint(e.getComponent().getLocation().x, e.getComponent().getLocation().y);
px = e.getX();
py = e.getY();
}
代码示例来源:origin: stackoverflow.com
public void mouseReleased(MouseEvent evt) {
Point p = ((Component) evt.getSource()).getLocation();
evt.translatePoint((int) p.getX(), (int) p.getY());
Component tile = f.getContentPane().getComponentAt(evt.getX(), evt.getY());
}
代码示例来源:origin: com.threerings/nenya
/**
* We overload this to translate mouse events into the proper coordinates before they are
* dispatched to any of the mouse listeners.
*/
@Override
protected void processMouseEvent (MouseEvent event)
{
event.translatePoint(_vbounds.x, _vbounds.y);
super.processMouseEvent(event);
}
代码示例来源:origin: com.threerings/nenya
/**
* We overload this to translate mouse events into the proper coordinates before they are
* dispatched to any of the mouse listeners.
*/
@Override
protected void processMouseMotionEvent (MouseEvent event)
{
event.translatePoint(_vbounds.x, _vbounds.y);
super.processMouseMotionEvent(event);
}
代码示例来源:origin: threerings/nenya
/**
* We overload this to translate mouse events into the proper coordinates before they are
* dispatched to any of the mouse listeners.
*/
@Override
protected void processMouseEvent (MouseEvent event)
{
event.translatePoint(_vbounds.x, _vbounds.y);
super.processMouseEvent(event);
}
代码示例来源:origin: stackoverflow.com
public void handleDrag(JPanel panel){
final JPanel p = panel;
panel.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent me) {
me.translatePoint(me.getComponent().getLocation().x, me.getComponent().getLocation().y);
p.setLocation(me.getX(), me.getY());
}
});
}
代码示例来源:origin: net.sf.squirrel-sql.plugins/graph
private MouseEvent transformMouseEvent(MouseEvent e)
{
if(this == e.getComponent())
{
return e;
}
else
{
Point lp = getLocationInQueryTextArea(e.getComponent());
e.setSource(this);
e.translatePoint(lp.x, lp.y);
return e;
}
}
代码示例来源:origin: Exslims/MercuryTrade
@Override
public void mouseDragged(MouseEvent e) {
e.translatePoint(HelpIGFrame.this.getLocation().x - x, HelpIGFrame.this.getLocation().y - y);
HelpIGFrame.this.setLocation(new Point(e.getX(), e.getY()));
}
}
代码示例来源:origin: Exslims/MercuryTrade
@Override
public void mouseDragged(MouseEvent e) {
e.translatePoint(AbstractComponentFrame.this.getLocation().x - x, AbstractComponentFrame.this.getLocation().y - y);
onFrameDragged(new Point(e.getX(), e.getY()));
}
}
代码示例来源:origin: ThomasFooteDQ/DroidQuest
public void mouseClicked(MouseEvent e) {
int newX = (int) (e.getX() / at.getScaleX());
int newY = (int) (e.getY() / at.getScaleY());
int deltaX = newX - e.getX();
int deltaY = newY - e.getY();
e.translatePoint(deltaX, deltaY);
level.player.MouseClick(e);
}
});
代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit
public void mouseDragged(MouseEvent e)
{
if(drag /* && e.getX() >= getWidth() - borderWidth * 2 */)
{
e.translatePoint(-getWidth(),0);
textArea.mouseHandler.mouseDragged(e);
}
} //}}}
代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit
public void mouseReleased(MouseEvent e)
{
if(drag && e.getX() >= getWidth() - borderWidth * 2)
{
e.translatePoint(-getWidth(),0);
textArea.mouseHandler.mouseReleased(e);
}
drag = false;
} //}}}
} //}}}
代码示例来源:origin: protegeproject/protege
final public void handleMouseReleased(MouseEvent event) {
if (contains(event.getX(), event.getY())) {
doMouseReleased(event);
event.translatePoint(getX(), getY());
for (PageObject childPageObject : getChildren()) {
if (childPageObject.contains(event.getPoint())) {
childPageObject.handleMouseReleased(event);
}
}
event.translatePoint(-getX(), -getY());
}
}
代码示例来源:origin: Exslims/MercuryTrade
@Override
public void mouseDragged(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
e.translatePoint(AdrCaptureOutComponentFrame.this.getLocation().x - x, AdrCaptureOutComponentFrame.this.getLocation().y - y);
Point point = e.getPoint();
AdrCaptureOutComponentFrame.this.setLocation(point);
}
}
}
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
final public void handleMouseReleased(MouseEvent event) {
if (contains(event.getX(), event.getY())) {
doMouseReleased(event);
event.translatePoint(getX(), getY());
for (PageObject childPageObject : getChildren()) {
if (childPageObject.contains(event.getPoint())) {
childPageObject.handleMouseReleased(event);
}
}
event.translatePoint(-getX(), -getY());
}
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl
final public void handleMouseReleased(MouseEvent event) {
if (contains(event.getX(), event.getY())) {
doMouseReleased(event);
event.translatePoint(getX(), getY());
for (PageObject childPageObject : getChildren()) {
if (childPageObject.contains(event.getPoint())) {
childPageObject.handleMouseReleased(event);
}
}
event.translatePoint(-getX(), -getY());
}
}
内容来源于网络,如有侵权,请联系作者删除!