本文整理匯總了Java中org.eclipse.swt.events.MouseListener類的典型用法代碼示例。如果您正苦於以下問題:Java MouseListener類的具體用法?Java MouseListener怎麽用?Java MouseListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MouseListener類屬於org.eclipse.swt.events包,在下文中一共展示了MouseListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDropdownButton
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
private Button createDropdownButton(final Composite parent, int id, String label, MouseListener mouseListener) {
char textEmbedding = parent.getOrientation() == SWT.LEFT_TO_RIGHT ? '\u202a' : '\u202b';
Button button = createButton(parent, id, textEmbedding + label + '\u202c', false);
if (Util.isMac()) {
// Button#setOrientation(int) is a no-op on the Mac. Use a Unicode
// BLACK DOWN-POINTING SMALL TRIANGLE.
button.setText(button.getText() + " \u25BE"); //$NON-NLS-1$
} else {
int dropDownOrientation = parent.getOrientation() == SWT.LEFT_TO_RIGHT ? SWT.RIGHT_TO_LEFT
: SWT.LEFT_TO_RIGHT;
button.setOrientation(dropDownOrientation);
button.setText(button.getText() + " \u25BE"); //$NON-NLS-1$
button.addMouseListener(mouseListener);
}
return button;
}
示例2: addTable
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
private void addTable(){
MouseListener listener = mouseFocusListener();
this.table = new TGTable(this.context, getComposite());
this.table.getColumnNumber().getControl().addMouseListener(listener);
this.table.getColumnSoloMute().getControl().addMouseListener(listener);
this.table.getColumnName().getControl().addMouseListener(listener);
this.table.getColumnInstrument().getControl().addMouseListener(listener);
this.table.getColumnCanvas().getControl().addMouseListener(listener);
this.table.getColumnCanvas().getControl().addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
new TGActionProcessor(TuxGuitar.getInstance().getContext(), TGOpenSongInfoDialogAction.NAME).process();
}
});
this.fireUpdate(true);
this.loadProperties();
}
示例3: addServer
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
private void addServer(Composite parent, final IServerMonitor server) {
final Composite composite = new Composite(parent, SWT.NONE);
RowLayout layout = new RowLayout();
layout.marginTop = 0;
layout.marginBottom = 0;
layout.marginLeft = 2;
layout.marginRight = 2;
composite.setLayout(layout);
final Label icon = new Label(composite, SWT.CENTER);
final Label text = new Label(composite, SWT.CENTER);
text.setText(server.getShortName());
updateStatusIconAndTooltip(server, composite, icon, text);
composite.addMouseTrackListener(new CompositeMouseTrackListener(text, icon, server, composite));
composite.addMouseListener(new CompositeMouseListener(text, icon, server, composite));
server.addListener(new CompositeServerMonitorListener(text, icon, server, composite));
final String host = server.getHost();
final int port = server.getPort();
final Option<IServerStatusWidgetListenerProvider> provider = widgetListenerProviders._1().find(matches(host, port));
if (provider.isSome()) {
final MouseListener mouseListener = provider.some().getMouseListener();
composite.addMouseListener(mouseListener);
icon.addMouseListener(mouseListener);
text.addMouseListener(mouseListener);
}
}
示例4: getDeviceManagers
import org.eclipse.swt.events.MouseListener; //導入依賴的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: removeMouseListener
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
@Override
public void removeMouseListener ( final ChartMouseListener listener )
{
final MouseListener proxyListener = this.mouseListenerMap.remove ( listener );
if ( proxyListener != null )
{
this.control.removeMouseListener ( proxyListener );
}
}
示例6: addMouseListener
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
/**
* Add a mouse listener to the control and also the <code>titleLabel</code>
*/
@Override
public void addMouseListener(MouseListener listener) {
if (null != titleLabel) {
titleLabel.addMouseListener(listener);
}
super.addMouseListener(listener);
}
示例7: removeMouseListener
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
/**
* Remove the mouse listener from the control and also the <code>titleLabel</code>
*/
@Override
public void removeMouseListener(MouseListener listener) {
if (null != titleLabel) {
titleLabel.removeMouseListener(listener);
}
super.removeMouseListener(listener);
}
示例8: addMouseListener
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
@Override
public void addMouseListener(final MouseListener listener) {
composite.addMouseListener(listener);
iconComposite.addMouseListener(listener);
titleArea.addMouseListener(listener);
titleComposite.addMouseListener(listener);
colorBar.addMouseListener(listener);
iconArea.addMouseListener(listener);
}
示例9: init
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
public void init(){
MouseListener mouseListenerLabel = new MouseListenerLabel();
MouseListener mouseListenerCanvas = new MouseListenerCanvas();
this.row = new Composite(this.table.getRowControl(),SWT.NONE );
this.row.setLayoutData(new GridData(SWT.FILL,SWT.TOP,true,false));
this.number = new CLabel(this.row,SWT.LEFT);
this.number.addMouseListener(mouseListenerLabel);
this.table.addRowItem(this.table.getColumnNumber(),this.number,true);
this.soloMute = new CLabel(this.row,SWT.LEFT);
this.soloMute.addMouseListener(mouseListenerLabel);
this.table.addRowItem(this.table.getColumnSoloMute(),this.soloMute,true);
this.name = new CLabel(this.row,SWT.LEFT);
this.name.addMouseListener(mouseListenerLabel);
this.table.addRowItem(this.table.getColumnName(),this.name,true);
this.instrument = new CLabel(this.row,SWT.LEFT);
this.instrument.addMouseListener(mouseListenerLabel);
this.table.addRowItem(this.table.getColumnInstrument(),this.instrument,true);
this.painter = new Composite(this.row,SWT.DOUBLE_BUFFERED);
this.painter.addMouseListener(mouseListenerCanvas);
this.painter.addPaintListener(new TGBufferedPainterListenerLocked(this.table.getContext(), new TGTableRowPaintHandle()));
this.table.addRowItem(this.table.getColumnCanvas(),this.painter,false);
this.row.pack();
}
示例10: mouseFocusListener
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
private MouseListener mouseFocusListener(){
return new MouseAdapter() {
public void mouseUp(MouseEvent e) {
TGTable table = getTable();
if(table != null){
TGTableRow row = table.getRow( ( getSelectedTrack() - 1 ) );
if( row != null ){
row.getPainter().setFocus();
}
}
}
};
}
示例11: notifyMouseListeners
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
/**
* Notifies mouse listeners.
*
* @param type Event type
* @param event Mouse event
*/
protected void notifyMouseListeners(int type, MouseEvent event) {
Object[] listeners = mouseListeners.getListeners();
for (Object listener : listeners) {
if (type == 1) {
((MouseListener)listener).mouseDown(event);
}
else if (type == 2) {
((MouseListener)listener).mouseUp(event);
}
else if (type == 3) {
((MouseListener)listener).mouseDoubleClick(event);
}
}
}
示例12: getMouseListener
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
/**
* Returns the mouse listener
* @return
*/
private MouseListener getMouseListener() {
return new MouseAdapter(){
@Override
public void mouseDown(MouseEvent arg0) {
Tile<T> tile = getTileAt(arg0.x, arg0.y);
if (tile != null && tile.item != selectedItem) {
selectedItem = tile.item;
redraw();
fireSelectionEvent(tile);
}
}
};
}
示例13: addMouseListener
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
/**
* Add a mouse listener to the control and also the <code>titleLabel</code>
*/
public void addMouseListener(MouseListener listener) {
if (null != titleLabel) {
titleLabel.addMouseListener(listener);
}
super.addMouseListener(listener);
}
示例14: removeMouseListener
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
/**
* Remove the mouse listener from the control and also the <code>titleLabel</code>
*/
public void removeMouseListener(MouseListener listener) {
if (null != titleLabel) {
titleLabel.removeMouseListener(listener);
}
super.removeMouseListener(listener);
}
示例15: dispatchMouseReleased
import org.eclipse.swt.events.MouseListener; //導入依賴的package包/類
protected void dispatchMouseReleased(MouseEvent me) {
List<MouseListener> copy = new ArrayList<MouseListener>(mouseListeners);
for (MouseListener ml : copy) {
ml.mouseUp(me);
}
}