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