java.awt.Event Java Examples
The following examples show how to use
java.awt.Event.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Tree.java From evosql with Apache License 2.0 | 6 votes |
/** * Method declaration * * * @param e */ // fredt@users 20020130 - comment by fredt // to remove this deprecated method we need to rewrite the Tree class as a // ScrollPane component public boolean handleEvent(Event e) { switch (e.id) { case Event.SCROLL_LINE_UP : case Event.SCROLL_LINE_DOWN : case Event.SCROLL_PAGE_UP : case Event.SCROLL_PAGE_DOWN : case Event.SCROLL_ABSOLUTE : iX = sbHoriz.getValue(); iY = iRowHeight * sbVert.getValue(); repaint(); return true; } return super.handleEvent(e); }
Example #2
Source File: ResultView.java From Raccoon with Apache License 2.0 | 6 votes |
public void actionPerformed(ActionEvent event) { Object src = event.getSource(); if (src == download) { DownloadView d = DownloadView.create(searchView.getArchive(), doc); searchView.doDownload(d); } if (src == details) { if ((event.getModifiers() & Event.SHIFT_MASK) == Event.SHIFT_MASK) { // This is indented for debugging! entry.setContentType("text/plain"); //$NON-NLS-1$ entry.setText(doc.toString()); } else { doToggleDetails(); } } if (src == gplay) { BrowseUtil.openUrl(doc.getShareUrl()); SwingUtilities.invokeLater(searchView); // Re - focus } if (src == permissions) { doTogglePermissions(); } }
Example #3
Source File: UI.java From netbeans with Apache License 2.0 | 6 votes |
private void processKey(char key) { //out("select: '" + key); if (((int) key) == Event.BACK_SPACE) { init(); return; } myPrefix += key; myPrefix = myPrefix.toLowerCase(); //out("prefix: " + myPrefix); for (int i = myIndex; i < getItemCount(); i++) { String item = getItemAt(i).toString().toLowerCase(); //out(" see: " + item); if (item.startsWith(myPrefix)) { myIndex = i; return; } } }
Example #4
Source File: Grid.java From evosql with Apache License 2.0 | 6 votes |
/** * Method declaration * * * @param e */ // fredt@users 20020130 - comment by fredt // to remove this deprecated method we need to rewrite the Grid class as a // ScrollPane component // sqlbob: I believe that changing to the JDK1.1 event handler // would require browsers to use the Java plugin. public boolean handleEvent(Event e) { switch (e.id) { case Event.SCROLL_LINE_UP : case Event.SCROLL_LINE_DOWN : case Event.SCROLL_PAGE_UP : case Event.SCROLL_PAGE_DOWN : case Event.SCROLL_ABSOLUTE : iX = sbHoriz.getValue(); iY = iRowHeight * sbVert.getValue(); repaint(); return true; } return super.handleEvent(e); }
Example #5
Source File: Grid.java From evosql with Apache License 2.0 | 6 votes |
/** * Method declaration * * * @param e * @param x * @param y */ public boolean mouseDrag(Event e, int x, int y) { if (bDrag && x < iWidth) { int w = x - iXDrag; if (w < 0) { w = 0; } iColWidth[iColDrag] = w; adjustScroll(); repaint(); } return true; }
Example #6
Source File: JIntellitypeDemo.java From jintellitype with Apache License 2.0 | 6 votes |
/** * Method to register a hotkey using the RegisterHotKey Windows API call. * <p> * * @param aEvent the ActionEvent fired. */ private void btnRegisterHotKey_actionPerformed(ActionEvent aEvent) { // assign the WINDOWS+A key to the unique id 88 for identification JIntellitype.getInstance().registerHotKey(WINDOWS_A, JIntellitype.MOD_WIN, 'A'); JIntellitype.getInstance().registerHotKey(ALT_SHIFT_B, JIntellitype.MOD_ALT + JIntellitype.MOD_SHIFT, 'B'); JIntellitype.getInstance().registerSwingHotKey(CTRL_SHIFT_C, Event.CTRL_MASK + Event.SHIFT_MASK, 'C'); // use a 0 for the modifier if you just want a single keystroke to be a // hotkey JIntellitype.getInstance().registerHotKey(PRINT_SCREEN, 0, 44); JIntellitype.getInstance().registerHotKey(F11, "F11"); JIntellitype.getInstance().registerHotKey(F12, JIntellitype.MOD_ALT, 123); JIntellitype.getInstance().registerHotKey(SEMICOLON, 0, 186); JIntellitype.getInstance().registerHotKey(TICK, 0, 192); // clear the text area textArea.setText(""); output("RegisterHotKey WINDOWS+A was assigned uniqueID 88"); output("RegisterHotKey ALT+SHIFT+B was assigned uniqueID 89"); output("RegisterHotKey CTRL+SHIFT+C was assigned uniqueID 90"); output("RegisterHotKey PRINT_SCREEN was assigned uniqueID 91"); output("RegisterHotKey F9 was assigned uniqueID 92"); output("RegisterHotKey F12 was assigned uniqueID 93"); output("RegisterHotKey SEMICOLON was assigned uniqueID 94"); output("Press WINDOWS+A or ALT+SHIFT+B or CTRL+SHIFT+C in another application and you will see the debug output in the textarea."); }
Example #7
Source File: CPopupMenu.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void show(Event e) { Component origin = (Component)e.target; if (origin != null) { Point loc = origin.getLocationOnScreen(); e.x += loc.x; e.y += loc.y; execute(ptr -> nativeShowPopupMenu(ptr, e.x, e.y)); } }
Example #8
Source File: PreferencesUser.java From SikuliX1 with MIT License | 5 votes |
private int defaultStopHotkeyModifiers() { int mod = Event.SHIFT_MASK + Event.META_MASK; if (!Settings.isMac()) { mod = Event.SHIFT_MASK + Event.ALT_MASK; } return mod; }
Example #9
Source File: Grid.java From evosql with Apache License 2.0 | 5 votes |
/** * Method declaration * * * @param e * @param x * @param y */ public boolean mouseMove(Event e, int x, int y) { if (y <= iRowHeight) { int xb = x; x += iX - iGridWidth; int i = iColCount - 1; for (; i >= 0; i--) { if (x > -7 && x < 7) { break; } x += iColWidth[i]; } if (i >= 0) { if (!bDrag) { setCursor(new Cursor(Cursor.E_RESIZE_CURSOR)); bDrag = true; iXDrag = xb - iColWidth[i]; iColDrag = i; } return true; } } return mouseExit(e, x, y); }
Example #10
Source File: AppletFrame.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public void processEvent(AWTEvent e) { // Window Destroy event if (e.getID() == Event.WINDOW_DESTROY) { // exit the program System.exit(0); } }
Example #11
Source File: AppletFrame.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public void processEvent(AWTEvent e) { // Window Destroy event if (e.getID() == Event.WINDOW_DESTROY) { // exit the program System.exit(0); } }
Example #12
Source File: KitchenSinkPlugin.java From ghidra with Apache License 2.0 | 5 votes |
private void setupActions() { DockingAction action = new DockingAction("Hello World", getName() ) { @Override public void actionPerformed( ActionContext context ) { Msg.info(this, "Hello World:: action"); announce("Hello World"); } }; action.setEnabled( true ); String helloGroup = "Hello"; ImageIcon prevImage = ResourceManager.loadImage(PREV_IMAGE); action.setMenuBarData( new MenuData( new String[] {"Misc", "Hello World"}, prevImage, helloGroup ) ); action.setPopupMenuData( new MenuData( new String[] {"Hello World"}, prevImage, helloGroup ) ); action.setKeyBindingData( new KeyBindingData( KeyStroke.getKeyStroke('H', Event.CTRL_MASK ) ) ); action.setToolBarData( new ToolBarData( prevImage, helloGroup ) ); action.setDescription("Hello World"); action.setHelpLocation(new HelpLocation("SampleHelpTopic", "KS_Hello_World")); tool.addAction(action); action = new DockingAction("Hello Program", getName() ) { @Override public void actionPerformed( ActionContext context ) { Msg.info(this, "Hello Program:: action"); sayHelloProgram(); } }; action.setEnabled(false); ImageIcon nextImage = ResourceManager.loadImage(NEXT_IMAGE); action.setMenuBarData( new MenuData( new String[]{"Misc", "Hello Program"}, nextImage, helloGroup ) ); action.setKeyBindingData( new KeyBindingData( KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK ) ) ); action.setToolBarData( new ToolBarData( nextImage, helloGroup ) ); action.setDescription("Hello Program"); action.setHelpLocation(new HelpLocation("SampleHelpTopic", "KS_Hello_Program")); tool.addAction(action); // remember this action so I can enable/disable it later helloProgramAction = action; }
Example #13
Source File: AppletFrame.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public void processEvent(AWTEvent e) { // Window Destroy event if (e.getID() == Event.WINDOW_DESTROY) { // exit the program System.exit(0); } }
Example #14
Source File: CPopupMenu.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public void show(Event e) { Component origin = (Component)e.target; if (origin != null) { Point loc = origin.getLocationOnScreen(); e.x += loc.x; e.y += loc.y; execute(ptr -> nativeShowPopupMenu(ptr, e.x, e.y)); } }
Example #15
Source File: CPopupMenu.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public void show(Event e) { Component origin = (Component)e.target; if (origin != null) { Point loc = origin.getLocationOnScreen(); e.x += loc.x; e.y += loc.y; execute(ptr -> nativeShowPopupMenu(ptr, e.x, e.y)); } }
Example #16
Source File: Grid.java From evosql with Apache License 2.0 | 5 votes |
/** * Method declaration * * * @param e * @param x * @param y */ public boolean mouseExit(Event e, int x, int y) { if (bDrag) { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); bDrag = false; } return true; }
Example #17
Source File: AppletFrame.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void processEvent(AWTEvent e) { // Window Destroy event if (e.getID() == Event.WINDOW_DESTROY) { // exit the program System.exit(0); } }
Example #18
Source File: InputStreamClass.java From trygve with GNU General Public License v2.0 | 5 votes |
@Override public void checkIOIntegration(final Event e) { try { queue.put(e.key); } catch (InterruptedException ex) { Logger.getLogger(Console.class.getName()). log(Level.SEVERE, null, ex); } }
Example #19
Source File: AppletFrame.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public void processEvent(AWTEvent e) { // Window Destroy event if (e.getID() == Event.WINDOW_DESTROY) { // exit the program System.exit(0); } }
Example #20
Source File: CPopupMenu.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("deprecation") public void show(Event e) { Component origin = (Component)e.target; if (origin != null) { Point loc = origin.getLocationOnScreen(); e.x += loc.x; e.y += loc.y; execute(ptr -> nativeShowPopupMenu(ptr, e.x, e.y)); } }
Example #21
Source File: CPopupMenu.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void show(Event e) { Component origin = (Component)e.target; if (origin != null) { Point loc = origin.getLocationOnScreen(); e.x += loc.x; e.y += loc.y; execute(ptr -> nativeShowPopupMenu(ptr, e.x, e.y)); } }
Example #22
Source File: AppletFrame.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public void processEvent(AWTEvent e) { // Window Destroy event if (e.getID() == Event.WINDOW_DESTROY) { // exit the program System.exit(0); } }
Example #23
Source File: AppletFrame.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void processEvent(AWTEvent e) { // Window Destroy event if (e.getID() == Event.WINDOW_DESTROY) { // exit the program System.exit(0); } }
Example #24
Source File: CloseTabPaneUI.java From iBioSim with Apache License 2.0 | 5 votes |
/** * Adds the specified mnemonic at the specified index. */ private void addMnemonic(int index, int mnemonic) { if (mnemonicToIndexMap == null) { initMnemonics(); } mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, Event.ALT_MASK), "setSelectedIndex"); mnemonicToIndexMap.put(new Integer(mnemonic), new Integer(index)); }
Example #25
Source File: RTEventObject.java From trygve with GNU General Public License v2.0 | 5 votes |
public static RTObject ctor1(final Event e) { final Type intType = StaticScope.globalScope().lookupTypeDeclaration("int"); final StaticScope intScope = intType.enclosedScope(); final RTType rTIntType = InterpretiveCodeGenerator.scopeToRTTypeDeclaration(intScope); final Type stringType = StaticScope.globalScope().lookupTypeDeclaration("String"); final StaticScope stringScope = stringType.enclosedScope(); final RTType rTStringType = InterpretiveCodeGenerator.scopeToRTTypeDeclaration(stringScope); final Type eventType = StaticScope.globalScope().lookupTypeDeclaration("Event"); final StaticScope eventScope = eventType.enclosedScope(); final RTType rTEventType = InterpretiveCodeGenerator.scopeToRTTypeDeclaration(eventScope); final RTObject theEventObject = new RTObjectCommon(rTEventType); theEventObject.addObjectDeclaration("id", rTIntType); theEventObject.addObjectDeclaration("key", rTIntType); theEventObject.addObjectDeclaration("keyString", rTStringType); theEventObject.addObjectDeclaration("x", rTIntType); theEventObject.addObjectDeclaration("y", rTIntType); theEventObject.setObject("x", new RTIntegerObject(e.x)); theEventObject.setObject("y", new RTIntegerObject(e.y)); theEventObject.setObject("id", new RTIntegerObject(e.id)); theEventObject.setObject("key", new RTIntegerObject(e.key)); final char cKey = (char)e.key; final String keyAsString = "" + cKey; theEventObject.setObject("keyString", new RTStringObject(keyAsString)); return theEventObject; }
Example #26
Source File: JavaElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 5 votes |
public String getMenuKey() { int menuShortcutKeyMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); if ((menuShortcutKeyMask & Event.CTRL_MASK) == Event.CTRL_MASK) { return "Control"; } if ((menuShortcutKeyMask & Event.META_MASK) == Event.META_MASK) { return "Meta"; } return ""; }
Example #27
Source File: OSUtils.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Keys getMenuKey() { int keyMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); if (keyMask == Event.CTRL_MASK) { return Keys.CONTROL; } if (keyMask == Event.META_MASK) { return Keys.META; } if (keyMask == Event.ALT_MASK) { return Keys.ALT; } throw new WebDriverException("Unable to find the keymask... not control or meta?"); }
Example #28
Source File: AutoclosableResourceResolver.java From AEM-Rules-for-SonarQube with Apache License 2.0 | 5 votes |
private void resourceResolverShouldBeIgnoredWhenResolverFactoryIsExecutedInMethodFromDifferentClass( Event event, List<String> attributesList) { if (attributesList.containsAll(ATTRIBUTES)) { String path = (String) event.getProperty(SlingConstants.PROPERTY_PATH); try { SlingHelper.operate(resolverFactory, resolver -> processPackage(resolver, path)); } catch (OperateException e) { System.out.println("something went wrong"); } } }
Example #29
Source File: AppletFrame.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public void processEvent(AWTEvent e) { // Window Destroy event if (e.getID() == Event.WINDOW_DESTROY) { // exit the program System.exit(0); } }
Example #30
Source File: CPopupMenu.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public void show(Event e) { Component origin = (Component)e.target; if (origin != null) { Point loc = origin.getLocationOnScreen(); e.x += loc.x; e.y += loc.y; execute(ptr -> nativeShowPopupMenu(ptr, e.x, e.y)); } }