@Override public void configVisualizationViewer(final LayerViewer<V, E> vv) { PluggableGraphMouse mouse = new PluggableGraphMouse(); mouse.add(new ScalingGraphMousePlugin( new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f, 1.1f)); mouse.add(new PickingGraphMousePlugin<V, E>()); mouse.add(new MyEditingPopupGraphMousePlugin<T, V, E, N>(vv, scenario)); vv.setGraphMouse(mouse); vv.getRenderContext().setVertexFillPaintTransformer( new NodeFillPaintTransformer<V>(vv.getPickedVertexState())); vv.setVertexToolTipTransformer(nodeTTT); vv.getRenderContext().setVertexLabelTransformer(nodeLT); vv.getRenderer().getVertexLabelRenderer() .setPosition(Position.AUTO); vv.setEdgeToolTipTransformer(linkTTT); vv.getRenderContext().setEdgeLabelTransformer(linkLT); vv.getRenderContext().getEdgeLabelRenderer() .setRotateEdgeLabels(true); vv.getRenderContext().setEdgeDrawPaintTransformer( new LinkDrawPaintTransformer<E>(vv.getPickedEdgeState())); }
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; } } }
/** * 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; }
public void keyTyped(KeyEvent eKey) { if (eKey.getKeyChar() == Event.ENTER) { if (textArea.getText().replaceAll("[\\r\\n]+", "").equals("")) { } else { // Process the message MessageControler mc = MessageControler.getInstance(); try { mc.process(textArea.getText().replaceAll("[\\r\\n]+", "")); } catch (MessageControlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } } textArea.setText(""); textArea.requestFocus(); } }
/** * Method declaration * * * @param e * @param x * @param y * * @return */ 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; }
@Override public boolean keyDown(final Event event, final int i) { if (focuson) { if (i == 42 || i == 10 || i == 56 || i == 119 || i == 87 || i == 43 || i == 61) { zoomi = true; } if (i == 47 || i == 8 || i == 50 || i == 115 || i == 83 || i == 45) { zoomo = true; } if (i == 1006) { left = true; } if (i == 1007) { right = true; } if (i == 1005) { down = true; } if (i == 1004) { up = true; } } return false; }
@Override public boolean keyUp(final Event event, final int i) { if (i == 42 || i == 10 || i == 56 || i == 119 || i == 87 || i == 43 || i == 61) { zoomi = false; } if (i == 47 || i == 8 || i == 50 || i == 115 || i == 83 || i == 45) { zoomo = false; } if (i == 1006) { left = false; } if (i == 1007) { right = false; } if (i == 1005) { down = false; } if (i == 1004) { up = false; } return false; }
public boolean keyDown(Event evt, int key) { if ( key == 's' || key == 'S' ) { if (bStop.isEnabled()) { action( new Event( bStop, Event.ACTION_EVENT, null), null); } else { action( new Event( bStart, Event.ACTION_EVENT, null), null); } return true; } else if( key == 't' || key == 'T' ) { action( new Event( bStimulate, Event.ACTION_EVENT, null), null); return true; } else if( key == 'o' || key == 'O' ) { action( new Event( bOptions, Event.ACTION_EVENT, null), null); return true; } return false; }
public boolean action (Event evt, Object arg) { for(int x = 0; x < recorder.plotSize; x++) { if(evt.target.equals(c[x])) { recorder.plot[x] = c[x].getState(); figureYaxis(); recorder.redraw(); return true; } } if (evt.target.equals(cRightAxis)) { setRightAxis(); return true; } return super.action(evt, arg); }
/** * 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."); }
/** * Adds particular key accelerators to the editor component. */ protected void addBindings(JTextPane editor) { InputMap inputMap = editor.getInputMap(); //Ctrl-c to copy current selection KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.copyAction); //Ctrl-v to paste clipboard content key = KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.pasteAction); //Ctrl-x to cut current selection key = KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK); inputMap.put(key, DefaultEditorKit.cutAction); }
/** * Return the CopyMenuItem property value. * @return javax.swing.JMenuItem */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JMenuItem getCopyMenuItem() { if (ivjCopyMenuItem == null) { try { ivjCopyMenuItem = new javax.swing.JMenuItem(); ivjCopyMenuItem.setName("CopyMenuItem"); ivjCopyMenuItem.setMnemonic('C'); ivjCopyMenuItem.setText("Copy"); ivjCopyMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C,java.awt.Event.CTRL_MASK)); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjCopyMenuItem; }
/** * Return the CopyMenuItem property value. * @return javax.swing.JMenuItem */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JMenuItem getSystemCopyMenuItem() { if (ivjSystemCopyMenuItem == null) { try { ivjSystemCopyMenuItem = new javax.swing.JMenuItem(); ivjSystemCopyMenuItem.setName("SystemCopyMenuItem"); ivjSystemCopyMenuItem.setText("Copy to System Clipboard"); ivjSystemCopyMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C,java.awt.Event.CTRL_MASK|java.awt.Event.SHIFT_MASK)); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjSystemCopyMenuItem; }
/** * Return the CutMenuItem property value. * @return javax.swing.JMenuItem */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JMenuItem getCutMenuItem() { if (ivjCutMenuItem == null) { try { ivjCutMenuItem = new javax.swing.JMenuItem(); ivjCutMenuItem.setName("CutMenuItem"); ivjCutMenuItem.setMnemonic('t'); ivjCutMenuItem.setText("Cut"); ivjCutMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X,java.awt.Event.CTRL_MASK)); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjCutMenuItem; }
/** * Return the ExitMenuItem property value. * @return javax.swing.JMenuItem */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JMenuItem getExitMenuItem() { if (ivjExitMenuItem == null) { try { ivjExitMenuItem = new javax.swing.JMenuItem(); ivjExitMenuItem.setName("ExitMenuItem"); ivjExitMenuItem.setMnemonic('x'); ivjExitMenuItem.setText("Exit"); ivjExitMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q,java.awt.Event.CTRL_MASK)); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjExitMenuItem; }
/** * Return the Level_UpMenuItem property value. * @return javax.swing.JMenuItem */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JMenuItem getLevel_UpMenuItem() { if (ivjLevel_UpMenuItem == null) { try { ivjLevel_UpMenuItem = new javax.swing.JMenuItem(); ivjLevel_UpMenuItem.setName("Level_UpMenuItem"); ivjLevel_UpMenuItem.setMnemonic('L'); ivjLevel_UpMenuItem.setText("Level Up"); ivjLevel_UpMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP, Event.SHIFT_MASK)); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjLevel_UpMenuItem; }
/** * Return the Move_RenameMenuItem property value. * @return javax.swing.JMenuItem */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JMenuItem getMove_RenameMenuItem() { if (ivjMove_RenameMenuItem == null) { try { ivjMove_RenameMenuItem = new javax.swing.JMenuItem(); ivjMove_RenameMenuItem.setName("Move_RenameMenuItem"); ivjMove_RenameMenuItem.setMnemonic('M'); ivjMove_RenameMenuItem.setText("Move/Rename"); ivjMove_RenameMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R,java.awt.Event.CTRL_MASK)); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjMove_RenameMenuItem; }
private javax.swing.JMenuItem getMorphMenuItem() { if (ivjMorphMenuItem == null) { try { ivjMorphMenuItem = new javax.swing.JMenuItem(); ivjMorphMenuItem.setName("MorphMenuItem"); ivjMorphMenuItem.setMnemonic('o'); ivjMorphMenuItem.setText("Morph"); ivjMorphMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M,java.awt.Event.CTRL_MASK)); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjMorphMenuItem; }