當前位置: 首頁>>代碼示例>>Java>>正文


Java MouseEvent.getSource方法代碼示例

本文整理匯總了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;
			}
		}
	}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:27,代碼來源:ShipData.java

示例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();

}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:CheckNodeListener.java

示例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);
            }
        }
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:24,代碼來源:TableSorter.java

示例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;
            }
        }
    }
}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:29,代碼來源:AbstractPerspective.java

示例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);
    }
}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:11,代碼來源:ViwnGraphViewModalGraphMouse.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:SearchButton.java

示例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;
    }
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:14,代碼來源:EditorMouseMotionListener.java

示例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();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ButtonPopupSwitcher.java

示例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();
}
 
開發者ID:fesch,項目名稱:Moenagade,代碼行數:37,代碼來源:BloxsEditor.java

示例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;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:8,代碼來源:LibrariesTable.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:ButtonPopupSwitcherTestHid.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:PSheet.java

示例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();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:11,代碼來源:WindowsMenuUI.java

示例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);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:DataViewUI.java

示例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);
    }
}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:8,代碼來源:ViwnGraphViewModalGraphMouse.java


注:本文中的java.awt.event.MouseEvent.getSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。