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


Java MouseEvent.getPoint方法代码示例

本文整理汇总了Java中java.awt.event.MouseEvent.getPoint方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.getPoint方法的具体用法?Java MouseEvent.getPoint怎么用?Java MouseEvent.getPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.event.MouseEvent的用法示例。


在下文中一共展示了MouseEvent.getPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDefaultTableHeader

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/** This method ensures that the correct tool tip for the current column is delivered. */
@Override
protected JTableHeader createDefaultTableHeader() {
	JTableHeader header = new JTableHeader(columnModel) {

		private static final long serialVersionUID = 1L;

		@Override
		public String getToolTipText(MouseEvent e) {
			java.awt.Point p = e.getPoint();
			int index = columnModel.getColumnIndexAtX(p.x);
			int realColumnIndex = convertColumnIndexToModel(index);
			return DataViewerTable.this.getHeaderToolTipText(realColumnIndex);
		}
	};
	header.putClientProperty(RapidLookTools.PROPERTY_TABLE_HEADER_BACKGROUND, Colors.WHITE);
	return header;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:DataViewerTable.java

示例2: mouseMoved

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
    isOverBar = false;
    if (model == null) {
        return;
    }


    Point p = e.getPoint();
    if (isOverFirstPosition(p) || isOverSecondPosition(p)) {
        setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
    } else if (isOverSelection(p)) {
        isOverBar = true;
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {
        this.setCursor(Cursor.getDefaultCursor());
    }
    repaint();
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:20,代码来源:RangeSlider.java

示例3: getToolTipText

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/** This method ensures that the correct tool tip for the current table cell is delivered. */
@Override
public String getToolTipText(MouseEvent e) {
	Point p = e.getPoint();
	int column = columnAtPoint(p);
	if (column == 0) {
		return keyToolTip;
	} else {
		return super.getToolTipText(e);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:12,代码来源:ListPropertyTable.java

示例4: mouseMoved

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
    JTable table = (JTable) e.getSource();
    Point pt = e.getPoint();
    int prev_row = this.row;
    int prev_col = this.col;
    this.row = table.rowAtPoint(pt);
    this.col = table.columnAtPoint(pt);
    if (this.row != prev_row || this.col != prev_col) {
        Rectangle r = table.getCellRect(this.row, this.col, false);
        r = r.union(table.getCellRect(prev_row, prev_col, false));
        table.repaint(r);
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:15,代码来源:ContributorsTable.java

示例5: getToolTipText

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override final public String getToolTipText(MouseEvent objPmouseEvent) {

		final Point objLpoint = objPmouseEvent.getPoint();
		final int intLrowIndex = this.rowAtPoint(objLpoint);
		final int intLcolumnIndex = this.convertColumnIndexToModel(this.columnAtPoint(objLpoint));
		return this.objGdataJFrame.getToolTipText(this, intLrowIndex, intLcolumnIndex);
	}
 
开发者ID:jugglemaster,项目名称:JuggleMasterPro,代码行数:8,代码来源:DataJTable.java

示例6: mouseReleased

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased( MouseEvent e ) {
    // close button must not be active when selection change was
    // triggered by mouse press

    Point p = e.getPoint();
    p = SwingUtilities.convertPoint( e.getComponent(), p, container );
    int i = container.indexAtLocation( p.x, p.y );
    if( e.isPopupTrigger() ) {
        if( i >= 0 )
            i = container.indexOf( container.getComponentAt( i ) );
        //Post a popup menu show request
        shouldPerformAction( TabDisplayer.COMMAND_POPUP_REQUEST, i, e );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:NBTabbedPaneController.java

示例7: changeSelection

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private void changeSelection( MouseEvent e ) {
    Point p = e.getPoint();
    // It may have occured on the button that invoked the tabtable
    if (e.getSource() != this) {
        p = SwingUtilities.convertPoint((Component) e.getSource(), p, pTable);
    }
    if (pTable.contains(p)) {
        int row = pTable.rowAtPoint(p);
        int col = pTable.columnAtPoint(p);
        pTable.changeSelection(row, col, false, false);
    } else {
        pTable.clearSelection();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ButtonPopupSwitcher.java

示例8: mouseClicked

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
	// GMA 1.6.4: Center on spot where user double-clicks (but not if Digitizer is open)
	if ( e.getClickCount() >= 2 && e.getModifiers()==16 && !((MapApp)app).digitizer.isEnabled()) {
		Point p = e.getPoint();
		doZoom( p, 1 );
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:8,代码来源:XMap.java

示例9: getToolTipText

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public String getToolTipText(MouseEvent event) {
    Point p = event.getPoint();
    HotSpot spot = getHotspotAt(p);
    if (spot == null) return null;
    Difference diff = spot.getDiff();
    if (diff.getType() == Difference.ADD) {
        return NbBundle.getMessage(LineNumbersActionsBar.class, "TT_DiffPanel_Remove"); // NOI18N
    } else if (diff.getType() == Difference.CHANGE) {
        return NbBundle.getMessage(LineNumbersActionsBar.class, "TT_DiffPanel_Replace"); // NOI18N
    } else {
        return NbBundle.getMessage(LineNumbersActionsBar.class, "TT_DiffPanel_Insert"); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:LineNumbersActionsBar.java

示例10: mouseClicked

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
    Point p = e.getPoint();
    TreePath path = cfgTree.getPathForLocation(e.getPoint().x, e.getPoint().y);
    if ( path != null ) {
        Rectangle r = cfgTree.getPathBounds(path);
        if (r != null) {
            if ( r.contains(p)) {
                toggle( path );
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:FmtSpaces.java

示例11: mouseMoved

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseMoved(MouseEvent e) {
    e.consume();
    Point p = e.getPoint();
    // It may have occured on the button that invoked the tabtable
    if (e.getSource() != this) {
        p = SwingUtilities.convertPoint((Component) e.getSource(), p, pTable);
    }
    if (pTable.contains(p)) {
        int row = pTable.rowAtPoint(p);
        int col = pTable.columnAtPoint(p);
        pTable.changeSelection(row, col, false, false);
    } else {
        pTable.clearSelection();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ButtonPopupSwitcher.java

示例12: getMouseImagePosition

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/** Returns the image position of a mouse event, translating back from OpenGL coordinates to image location.
 *
 * @param evt a  mouse event
 * @return the image location, with 0,0 at the lower left corner.
 *
 */
public Point2D.Float getMouseImagePosition(MouseEvent evt) {
	Point2D.Float p = new Point2D.Float(evt.getPoint().x, evt.getPoint().y);
	float scale = (clipArea.top - clipArea.bottom) / getHeight();  // TODO mysterious scalling of text
	p.x = (p.x * scale) + clipArea.left;
	p.y = sizeY - ((p.y * scale) + clipArea.bottom);
	return p;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:14,代码来源:ImageDisplay.java

示例13: mouseReleased

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(final MouseEvent e) {
	if (showPopopUpMenu) {
		if (e.isPopupTrigger()) {
			Point p = e.getPoint();
			int row = rowAtPoint(p);
			int c = columnAtPoint(p);

			// don't do anything when outside of table
			if (row < 0 || c < 0) {
				return;
			}
			// only set cell selection if clicked cell is outside current selection
			if (row != -1 && (row < getSelectedRow() || row > getSelectedRow() + getSelectedRowCount() - 1)
					|| c != -1 && (c < getSelectedColumn() || c > getSelectedColumn() + getSelectedColumnCount() - 1)) {
				if (row < getRowCount() && c < getColumnCount()) {
					// needed because sometimes row could be outside [0, getRowCount()-1]
					setRowSelectionInterval(row, row);
					setColumnSelectionInterval(c, c);
				}
			}

			JPopupMenu menu = createPopupMenu();

			showPopupMenu(menu, e.getPoint());
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:ExtendedJTable.java

示例14: mouseDragged

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseDragged(MouseEvent e) {
    if (e.getSource() == list) {
        return;
    }
    if ( isVisible() ) {
        MouseEvent newEvent = convertMouseEvent( e );
        Rectangle r = new Rectangle();
        list.computeVisibleRect( r );
        Point location =  newEvent.getPoint();
        int index = list.locationToIndex(location);
        if ( r.contains( location ) ) {
            list.setSelectedIndex(index);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:FileCompletionPopup.java

示例15: mouseExited

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseExited(MouseEvent e) {
	// Since we registered this listener on the child components of
	// the JWindow, not the JWindow iteself, we have to be careful.
	Component source = (Component)e.getSource();
	Point p = e.getPoint();
	SwingUtilities.convertPointToScreen(p, source);
	if (!TipWindow.this.getBounds().contains(p)) {
		ft.possiblyDisposeOfTipWindow();
	}
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:12,代码来源:TipWindow.java


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