本文整理汇总了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;
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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 );
}
}
示例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();
}
}
示例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 );
}
}
示例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
}
}
示例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 );
}
}
}
}
示例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();
}
}
示例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;
}
示例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());
}
}
}
示例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);
}
}
}
示例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();
}
}