當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。