本文整理匯總了Java中java.awt.event.MouseEvent.getSource方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseEvent.getSource方法的具體用法?Java MouseEvent.getSource怎麽用?Java MouseEvent.getSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.getSource方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mouseMoved
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
public void mouseMoved(MouseEvent evt) {
if(map==null)return;
if( !(evt.getSource() instanceof XYGraph) ) {
return;
}
XYGraph graph = (XYGraph)evt.getSource();
float x0 = (float)graph.getXAt( evt.getPoint() );
for( int i=currentRange[0]+1 ; i<currentRange[1] ; i++) {
if( x[i]>x0 ) {
if( i!=0 && x0-x[i-1]<x[i]-x0) i--;
Point2D p = map.getProjection().getMapXY(
new Point2D.Double( lon[i], lat[i] ));
drawCurrentPoint();
currentPoint = (Point2D.Double)p;
//
map.setLonLat( lon[i], lat[i] );
map.setAlternateZValue(Float.NaN);
map.setAlternateUnits(units[0]);
// ***** GMA 1.6.2
drawCurrentPoint();
return;
}
}
}
示例2: mousePressed
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mousePressed(MouseEvent event) {
JTree tree = (JTree) event.getSource();
int x = event.getX();
int y = event.getY();
int row = tree.getRowForLocation(x, y);
TreePath path = tree.getPathForRow(row);
// if path exists and mouse is clicked exactly once
if (path == null) {
return;
}
CheckNode node = (CheckNode) path.getLastPathComponent();
if ( !SwingUtilities.isRightMouseButton(event)) {
return;
}
Object o = node.getUserObject();
}
示例3: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
public void mouseClicked(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) {
int status = getSortingStatus(column);
if (!e.isControlDown()) {
cancelSorting();
}
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
status = status + (e.isShiftDown() ? -1
: 1);
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
setSortingStatus(column, status);
}
}
示例4: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
/**
* dwuklik myszką w zakładke powoduje zwiniecie
*
* @param event
*/
@Override
public void mouseClicked(MouseEvent event) {
if (event.getClickCount() != 2) {
return; // czy to byl dwuklik
}
// przejście po wszystkich splitterach
for (MSplitPane splitter : splitters) {
// czy funkcja jest wspierana
if (!splitter.isOneTouchExpandable()) {
continue;
}
int count = splitter.getComponentCount();
// przejście po wszystkich komponentach należących do splitera
for (int i = 0; i < count; i++) {
// jeśli sygnał pochodzi od komponentu
// to zwinięcie widoku
if (splitter.getComponent(i) == event.getSource()) {
splitter.collapse(i);
return;
}
}
}
}
示例5: mousePressed
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mousePressed(MouseEvent e) {
// TRANSLATING PART
VisualizationViewer<ViwnNode, ViwnEdge> vv = (VisualizationViewer<ViwnNode, ViwnEdge>) e.getSource();
boolean accepted = checkModifiers(e);
down = e.getPoint();
if (accepted) {
vv.setCursor(cursor);
}
}
示例6: mouseExited
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseExited(MouseEvent evt) {
Object src = evt.getSource();
if (src instanceof AbstractButton) {
AbstractButton button = (AbstractButton) evt.getSource();
removeButtonContentAreaAndBorder(button);
}
}
示例7: mouseDragged
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseDragged(final MouseEvent e) {
if (e.getSource() == StaticEditorManager.graphComponent.getGraphControl()) {
StaticListenerManager.newCenterX =
(int) (StaticListenerManager.oldCenterX + (e.getX() - StaticListenerManager.oldMouseX));
StaticListenerManager.newCenterY =
(int) (StaticListenerManager.oldCenterY + (e.getY() - StaticListenerManager.oldMouseY));
if (SwingUtilities.isLeftMouseButton(e)) {
StaticListenerManager.tweakCell(e);
StaticListenerManager.isDragStart = true;
}
}
}
示例8: 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();
}
}
示例9: mouseReleased
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseReleased(MouseEvent me) {
// convert point in case we got triggered by a libraryPanel
Point clickPoint = me.getPoint();
if(me.getSource() instanceof LibraryPanel)
{
clickPoint = new java.awt.Point(me.getLocationOnScreen());
SwingUtilities.convertPointFromScreen(clickPoint, this);
}
// only act if we had an element
if(selected!=null)
{
// repostion element
selected.setOffset(new Point(clickPoint.x-selectedDelta.width,
clickPoint.y-selectedDelta.height));
if(selected.isElementary())
{
selected.setOffset(new Point((clickPoint.x-selectedDelta.width) -((clickPoint.x-selectedDelta.width) % 10),
(clickPoint.y-selectedDelta.height)-((clickPoint.y-selectedDelta.height)% 10)));
}
if(selected.getType()!=Type.PARAMETERS &&
selected.getType()!=Type.LIST &&
selected.getType()!=Type.ITEM)
{
putBack(selected);
}
// something changed
somethingChanged();
}
selected=null;
repaint();
}
示例10: mouseExited
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseExited(MouseEvent e) {
JTable table = (JTable) e.getSource();
table.repaint(table.getCellRect(this.row, this.col, false));
this.row = -1;
this.col = -1;
}
示例11: pButAction
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
private void pButAction(MouseEvent e) {
// create popup with our SwitcherTable
JComponent c = (JComponent) e.getSource();
Point p = new Point(c.getWidth(), c.getHeight());
SwingUtilities.convertPointToScreen(p, c);
if (!ButtonPopupSwitcher.isShown()) {
ButtonPopupSwitcher.showPopup( c, displayer, p.x, p.y);
}
}
示例12: updateSheetTableSelection
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
private void updateSheetTableSelection(MouseEvent e) {
Component comp = (Component) e.getSource();
if (comp instanceof SheetTable) {
SheetTable table = (SheetTable) comp;
table.changeSelection(table.rowAtPoint(e.getPoint()), 0, false, false);
}
}
示例13: mouseExited
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
public void mouseExited(MouseEvent evt) {
super.mouseExited(evt);
JMenu menu = (JMenu)evt.getSource();
ButtonModel model = menu.getModel();
if (menu.isRolloverEnabled()) {
model.setRollover(false);
menuItem.repaint();
}
}
示例14: mouseEntered
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseEntered(MouseEvent evt) {
Object src = evt.getSource();
if (src instanceof AbstractButton) {
AbstractButton button = (AbstractButton) evt.getSource();
if (button.isEnabled()) {
button.setContentAreaFilled(true);
button.setBorderPainted(true);
}
}
}
示例15: mouseEntered
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
public void mouseEntered(MouseEvent e) {
JComponent c = (JComponent) e.getSource();
ViWordNetService s = (ViWordNetService) vgvui.getWorkbench().getService(Service.class.getName());
if (s != null && !s.isMakeRelationModeOn()) {
c.setCursor(cursor);
}
}