本文整理汇总了Java中org.eclipse.swt.SWT.MouseDown方法的典型用法代码示例。如果您正苦于以下问题:Java SWT.MouseDown方法的具体用法?Java SWT.MouseDown怎么用?Java SWT.MouseDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.MouseDown方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEvent
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
/**
* Receives an event when the registered event occurs.
* @param event the event which occurred
*/
@Override
public void handleEvent(Event event) {
boolean cursorMoved = false;
if (event.type == SWT.KeyDown) {
cursorMoved = cursorMoved(event);
} else if (event.type == SWT.MouseDown || event.type == SWT.MouseDoubleClick) {
cursorMoved = true;
}
if (cursorMoved) {
long time = Time.getCurrentTime();
String path = recorder.getPath();
String commandId = "Cursor.position.change";
TriggerMacro trigger = new TriggerMacro(time, commandId, path, TriggerMacro.Kind.CURSOR_CHANGE);
recorder.recordTriggerMacro(trigger);
recorder.setParentMacro(null);
}
}
示例2: handleEvent
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
Label label = (Label) event.widget;
Shell shell = label.getShell();
switch (event.type) {
case SWT.MouseDown:
Event e = new Event();
e.item = (TableItem) label.getData("_TABLEITEM");
// Assuming table is single select, set the selection as if
// the mouse down event went through to the table
table.setSelection(new TableItem[]{(TableItem) e.item});
table.notifyListeners(SWT.Selection, e);
shell.dispose();
break;
case SWT.MouseExit:
shell.dispose();
break;
}
}
示例3: addMouseListener
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
private void addMouseListener(SWTSkinObject tab, Control control) {
if (tabMouseListener == null) {
tabMouseListener = new Listener() {
boolean bDownPressed = false;
@Override
public void handleEvent(Event event) {
if (event.type == SWT.MouseDown) {
bDownPressed = true;
return;
} else if (!bDownPressed) {
return;
}
bDownPressed = false;
Control control = (Control) event.widget;
setActiveTab((SWTSkinObjectTab) control.getData("Tab"), true);
}
};
}
control.setData("Tab", tab);
control.addListener(SWT.MouseUp, tabMouseListener);
control.addListener(SWT.MouseDown, tabMouseListener);
if (control instanceof Composite) {
Control[] children = ((Composite) control).getChildren();
for (int i = 0; i < children.length; i++) {
addMouseListener(tab, children[i]);
}
}
}
示例4: handleEvent
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
public void handleEvent(Event event) {
switch (event.type) {
case SWT.MouseDown:
case SWT.Deactivate:
this.close();
Display.getCurrent().wake();
break;
case SWT.Dispose:
PaintShop.disposeImage(splashname);
break;
default:
break;
}
}
示例5: getListenerType
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
@Override
public int getListenerType() {
return SWT.MouseDown;
}
示例6: getListenerType
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
@Override
public int getListenerType() {
// TODO Auto-generated method stub
return SWT.MouseDown;
}
示例7: createDeviceTemplateList2
import org.eclipse.swt.SWT; //导入方法依赖的package包/类
private void createDeviceTemplateList2(SWTSkinObjectContainer soList) {
DeviceTemplate[] devices = mf.getDeviceTemplates();
if (devices.length == 0) {
noDevices();
return;
}
Arrays.sort(devices, new Comparator<DeviceTemplate>() {
@Override
public int compare(DeviceTemplate o1, DeviceTemplate o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
Composite parent = soList.getComposite();
if (parent.getChildren().length > 0) {
Utils.disposeComposite(parent, false);
}
SWTSkin skin = skinnedDialog.getSkin();
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
layout.spacing = 0;
layout.marginLeft = layout.marginRight = 0;
layout.wrap = true;
layout.justify = true;
layout.fill = true;
parent.setLayout(layout);
Listener clickListener = new Listener() {
boolean down = false;
@Override
public void handleEvent(Event event) {
if (event.type == SWT.MouseDown) {
down = true;
} else if (event.type == SWT.MouseUp && down) {
Widget widget = (event.widget instanceof Label)
? ((Label) event.widget).getParent() : event.widget;
selectedDeviceTemplate = (DeviceTemplate) widget.getData("obj");
if (selectedDeviceTemplate == null) {
Debug.out("selectedDeviceTemplate is null!");
}
skinnedDialog.close();
down = false;
}
}
};
for (DeviceTemplate deviceTemplate : devices) {
if (deviceTemplate.isAuto()) {
continue;
}
String iconURL = null; // deviceTemplate.getIconURL();
TranscodeChooser.addImageBox(parent, clickListener, null, deviceTemplate,
iconURL, deviceTemplate.getName());
}
SWTSkinObjectText soTitle = (SWTSkinObjectText) skin.getSkinObject("title");
if (soTitle != null) {
soTitle.setTextID("devices.choose.device.title");
}
SWTSkinObjectText soSubTitle = (SWTSkinObjectText) skin.getSkinObject("subtitle");
if (soSubTitle != null) {
soSubTitle.setTextID("label.clickone");
}
Shell shell = skinnedDialog.getShell();
Point computeSize = shell.computeSize(shell.getSize().x, SWT.DEFAULT, true);
shell.setSize(computeSize);
UIFunctionsSWT uiFunctionsSWT = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctionsSWT != null) {
Shell mainShell = uiFunctionsSWT.getMainShell();
Utils.centerWindowRelativeTo(shell, mainShell);
}
}