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


Java MouseMoveListener类代码示例

本文整理汇总了Java中org.eclipse.swt.events.MouseMoveListener的典型用法代码示例。如果您正苦于以下问题:Java MouseMoveListener类的具体用法?Java MouseMoveListener怎么用?Java MouseMoveListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addMouseMoveListener

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
@Override
public void addMouseMoveListener ( final ChartMouseMoveListener listener )
{
    removeMouseMoveListener ( listener );
    final MouseMoveListener proxyListener = new MouseMoveListener () {

        @Override
        public void mouseMove ( final MouseEvent e )
        {
            listener.onMouseMove ( convertState ( e ) );
        }

    };
    final MouseMoveListener oldListener = this.mouseMoveListenerMap.put ( listener, proxyListener );
    if ( oldListener != null )
    {
        this.control.removeMouseMoveListener ( oldListener );
    }
    this.control.addMouseMoveListener ( proxyListener );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:ChartAreaRenderer.java

示例2: getMouseMoveListener

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
/**
 * Returns the mouse motion listener
 * @return
 */
   private MouseMoveListener getMouseMoveListener() {
	return new MouseMoveListener(){
		@Override
		public void mouseMove(MouseEvent arg0) {
			
			// Check
	        Tile<T> tile = getTileAt(arg0.x, arg0.y);
	        T item = tile == null ? null : tile.item;
	        
	        // Break
	        if (item == activeItem)return;
	        
	        // Set
	        activeItem = item;
	        redraw();
	        String tooltip = activeItem != null ? tooltipDecorator.decorate(activeItem) : null;
	        Tiles.this.setToolTipText(tooltip);
		}
       };
}
 
开发者ID:prasser,项目名称:swttiles,代码行数:25,代码来源:Tiles.java

示例3: Model

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
/** Ctor */
public Model(Rev rev, String modelName, Composite parent) {
	super(parent, SWT.NONE);

	this.rev = rev;
	this.modelName = modelName;

	addMouseMoveListener(new MouseMoveListener() {
		@Override
		public void mouseMove(MouseEvent e) {
			lastMouseX = e.x;
			lastMouseY = e.y;
			enablePopupMenu();
		}
	});
}
 
开发者ID:DaveVoorhis,项目名称:Rel,代码行数:17,代码来源:Model.java

示例4: getDeviceManagers

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
/**
 * Return the array of DeviceManagers that are available per the
 * constructor parameters. The InputDevices instantiated will be
 * initialized with SWT UI toolkit event listeners.
 *
 * @return the array of DeviceManagers. If no DeviceManagers are
 * available, an empty (size 0) array is returned.
 */
public DeviceManager[] getDeviceManagers( ) {
    List managerList = createDevices( );
    DeviceManager[] manager =
        (DeviceManager[])managerList.toArray( new DeviceManager[managerList.size( )] );
    Control control = (Control)canvas;
    for ( int i = 0; i < manager.length; i++ ) {
        InputDevice[] device = manager[i].getDevices( );
        for ( int j = 0; j < device.length; j++ ) {
            InputDevice dev = device[j];
            if ( dev instanceof MouseListener ) {
                control.addMouseListener( (MouseListener)dev );
            }
            if ( dev instanceof MouseMoveListener ) {
                control.addMouseMoveListener( (MouseMoveListener)dev );
            }
            if ( dev instanceof Listener ) {
                control.addListener( SWT.MouseWheel, (Listener)dev );
            }
            if ( dev instanceof KeyListener ) {
                control.addKeyListener( (KeyListener)dev );
            }
        }
    }
    return( manager );
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:34,代码来源:SWTDeviceFactory.java

示例5: removeMouseMoveListener

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
@Override
public void removeMouseMoveListener ( final ChartMouseMoveListener listener )
{
    final MouseMoveListener proxyListener = this.mouseMoveListenerMap.remove ( listener );
    if ( proxyListener != null )
    {
        if ( !this.control.isDisposed () )
        {
            this.control.removeMouseMoveListener ( proxyListener );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:13,代码来源:ChartAreaRenderer.java

示例6: getMouseListner

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
private MouseMoveListener getMouseListner(final Text extSchemaPathText){
	final MouseMoveListener listner = new MouseMoveListener() {
		
		@Override
		public void mouseMove(MouseEvent e) {
			String paramValue = Utils.INSTANCE.getParamValue(extSchemaPathText.getText());
		    finalParamPath = Utils.INSTANCE.getParamFilePath(extSchemaPathText.getText(), paramValue, extSchemaPathText);
		    while(ParameterUtil.containsParameter(finalParamPath, '/')){
		    	paramValue = Utils.INSTANCE.getParamValue(extSchemaPathText.getToolTipText());
		    	finalParamPath = Utils.INSTANCE.getParamFilePath(extSchemaPathText.getToolTipText(), paramValue, extSchemaPathText);
	    		}
			}
		};
	return listner;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:16,代码来源:Utils.java

示例7: createGenericTooltip

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
/**
 * Creates a generic tooltip for the table
 * @param table
 */
public static void createGenericTooltip(final Table table) {
    table.addMouseMoveListener(new MouseMoveListener() {
        private TableItem current = null;

     
        public void mouseMove(MouseEvent arg0) {
            TableItem item = table.getItem(new Point(arg0.x, arg0.y));
            if (item != null && item != current) {
                current = item;
                StringBuilder builder = new StringBuilder();
                builder.append("("); //$NON-NLS-1$
                int columns = item.getParent().getColumnCount();
                for (int i = 0; i < columns; i++) {
                    String value = item.getText(i);
                    if (value != null && !value.equals("")) { //$NON-NLS-1$
                        builder.append(value);
                        if (i < columns - 1) {
                            builder.append(", "); //$NON-NLS-1$
                        }
                    } else if (item.getData(String.valueOf(i)) != null && 
                               item.getData(String.valueOf(i)) instanceof Double) {
                        builder.append(getPrettyString(((Double) item.getData(String.valueOf(i))).doubleValue() * 100d) + "%"); //$NON-NLS-1$
                        if (i < columns - 1) {
                            builder.append(", "); //$NON-NLS-1$
                        }
                    }
                }
                builder.append(")"); //$NON-NLS-1$
                table.setToolTipText(builder.toString());
            }
        }
    });
}
 
开发者ID:WiednerF,项目名称:ARXPlugin,代码行数:38,代码来源:SWTUtil.java

示例8: init

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
public void init(){
	b.setVisible(false);
	//windowLocation.reMoveWindow(this);
	addMouseMoveListener(new MouseMoveListener() {
		
		@Override
		public void mouseMove(MouseEvent e) {
			// TODO Auto-generated method stub
			if(slider != null && !slider.isDisposed()){
				if(e.x >= getClientArea().width-slider.getSize().x-30){
					slider.setVisible(true);
				}else slider.setVisible(false);
			}
		}
	});
	
	setImage(b.getImage());
	setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	setStyledTextWidth(Integer.valueOf(b.appProperties.getProperty("WritingView_TextX", String.valueOf(windowLocation.returnScreenWidth()-
			windowLocation.returnScreenWidth()/4))));
	createContents();
	//setMaximized(true);
	if(b.tv != null){
		b.tv.getTextWidget().setParent(this);
		
		//b.tv.getTextWidget().setMargins(130, 10, 110, 0);
		b.blackTextArea.writingView();
		setStyledTextLayout(x);
	}
	addSlider();

}
 
开发者ID:piiiiq,项目名称:Black,代码行数:34,代码来源:writingView.java

示例9: addTooltipText

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
public static void addTooltipText(final NButton btn, final String text, final TextTask t) {
    btn.addMouseMoveListener(new MouseMoveListener() {
        @Override
        public void mouseMove(MouseEvent e) {
            btn.setToolTipText(text + " (" + textTaskKeyMap.get(t) +")"); //$NON-NLS-1$ //$NON-NLS-2$
        }
    });
}
 
开发者ID:nilsschmidt1337,项目名称:ldparteditor,代码行数:9,代码来源:KeyStateManager.java

示例10: GroupScaleTimelineMarkerTooltip

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
protected GroupScaleTimelineMarkerTooltip(Display display, int style,
		ScaleTimelineMarkerEditPart scaleTimelineMarkerEditPart) {
	super(display, style, scaleTimelineMarkerEditPart, null);
	// passing in null as the violationTracker
	
	// add a mouse move listener, to clear out a child violation when applicable
	mouseMoveListener = new MouseMoveListener() {
		@Override
		public void mouseMove(MouseEvent e) {
			if (solitaryScaleTimelineMarkerTooltip != null
					&& !solitaryScaleTimelineMarkerTooltip.shell.isDisposed()) {
				Composite localComposite = GroupScaleTimelineMarkerTooltip.this.getMainComposite();
				Point displayPoint = localComposite.toDisplay(e.x, e.y);
				displayPoint = solitaryScaleTimelineMarkerTooltip.shell.toControl(displayPoint);
				if (!solitaryScaleTimelineMarkerTooltip.shell.getBounds().contains(displayPoint)) {
					// navigated off a child, onto the parent
					solitaryScaleTimelineMarkerTooltip.shell.dispose();
				}
			}
		}
	};

	this.mainComposite.addMouseMoveListener(mouseMoveListener);
	Control[] controls = violationsComposite.getChildren();
	for(Control control : controls) {
		control.addMouseMoveListener(mouseMoveListener);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:29,代码来源:GroupScaleTimelineMarkerTooltip.java

示例11: dispatchMouseMoved

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
protected void dispatchMouseMoved(MouseEvent me) {
	List<MouseMoveListener> copy = new ArrayList<MouseMoveListener>(
			mouseMoveListeners);
	for (MouseMoveListener ml : copy) {
		ml.mouseMove(me);
	}

}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:9,代码来源:Widget.java

示例12: createMouseMoveHandler

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
/**
 * Handle mouse moves
 * 
 * @return
 */
private MouseMoveListener createMouseMoveHandler() {
    return new MouseMoveListener() {
        @Override
        public void mouseMove(MouseEvent me) {
            if (drag) {
                dragOffset += me.y - dragY;

                double newValue = dragValue - dragOffset / sensitivity;
                if (newValue < 0d) {
                    dragOffset = (int) (dragValue * sensitivity);
                    newValue = 0d;
                } else if (newValue > 1d) {
                    dragOffset = (int) (dragValue * sensitivity - sensitivity);
                    newValue = 1d;
                }

                if (value != newValue) {
                    value = newValue;
                    fireSelectionEvent();
                    redraw();
                }

                getDisplay().setCursorLocation(screenX, screenY);
            }
        }
    };
}
 
开发者ID:prasser,项目名称:swtknob,代码行数:33,代码来源:Knob.java

示例13: createGenericTooltip

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
/**
 * Creates a generic tooltip for the table
 * @param table
 */
public static void createGenericTooltip(final Table table) {
    table.addMouseMoveListener(new MouseMoveListener() {
        private TableItem current = null;

        @Override
        public void mouseMove(MouseEvent arg0) {
            TableItem item = table.getItem(new Point(arg0.x, arg0.y));
            if (item != null && item != current) {
                current = item;
                StringBuilder builder = new StringBuilder();
                builder.append("("); //$NON-NLS-1$
                int columns = item.getParent().getColumnCount();
                for (int i = 0; i < columns; i++) {
                    String value = item.getText(i);
                    if (value != null && !value.equals("")) { //$NON-NLS-1$
                        builder.append(value);
                        if (i < columns - 1) {
                            builder.append(", "); //$NON-NLS-1$
                        }
                    } else if (item.getData(String.valueOf(i)) != null && 
                               item.getData(String.valueOf(i)) instanceof Double) {
                        builder.append(getPrettyString(((Double) item.getData(String.valueOf(i))).doubleValue() * 100d) + "%"); //$NON-NLS-1$
                        if (i < columns - 1) {
                            builder.append(", "); //$NON-NLS-1$
                        }
                    }
                }
                builder.append(")"); //$NON-NLS-1$
                table.setToolTipText(builder.toString());
            }
        }
    });
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:38,代码来源:SWTUtil.java

示例14: addMouseHandler

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
/**
 * Add a mouse handler for mouse move and click events
 *
 * @param mouseState
 */
public void addMouseHandler(MenuListener mouseState,
                            MouseMoveListener moveListener)
{
    if (mouseState != null) {
        addMouseListener(mouseState);
    }

    if (moveListener != null) {
        addMouseMoveListener(moveListener);
    }
}
 
开发者ID:cogtool,项目名称:cogtool,代码行数:17,代码来源:PERTPanel.java

示例15: addSWTListener

import org.eclipse.swt.events.MouseMoveListener; //导入依赖的package包/类
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:47,代码来源:ChartComposite.java


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