Examples of KeyStroke


Examples of javax.swing.KeyStroke

   */
  private void addToMainTableKeyBindings(Action action) {
    if (action != null) {
      Object keyStroke = action.getValue(Action.ACCELERATOR_KEY);
      if (keyStroke != null) {
        KeyStroke stroke = (KeyStroke) keyStroke;
        mainTable.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(stroke, action.getValue(Action.NAME));
        mainTable.getActionMap().put(action.getValue(Action.NAME), action);
      }
    }
  }
View Full Code Here

Examples of javax.swing.KeyStroke

        buttonPanel = new JPanel();
        buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
        updateOptions();
        getContentPane().add(buttonPanel, BorderLayout.SOUTH, 1);

        KeyStroke k = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
        Object actionKey = "cancel"; // NOI18N
        getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(k, actionKey);

        Action cancelAction = new AbstractAction() {
View Full Code Here

Examples of javax.swing.KeyStroke

        System.out.println("got a go...");
        GoButtonPressed();
      }
    };

    KeyStroke keystroke =
      KeyStroke.getKeyStroke('g');//, java.awt.event.InputEvent.CTRL_MASK);
    mainGuiPanel.getInputMap().put(keystroke, "go");
    mainGuiPanel.getActionMap().put("go", goAction);

    Color c = new Color((int)(Math.random() * 127 + 127),
View Full Code Here

Examples of javax.swing.KeyStroke

       
        frame = f;
    }

    protected JRootPane createRootPane() {
        KeyStroke escapeStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
        KeyStroke enterStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
       
        JRootPane rootPane = new JRootPane();
        rootPane.registerKeyboardAction(this, escapeStroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
        rootPane.registerKeyboardAction(this, enterStroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
       
View Full Code Here

Examples of javax.swing.KeyStroke

      final Object    idObj;
      final String    type;
      final int      typeIdx;
      final String[]    hierarchy;
      final String    text;
      final KeyStroke    stroke;
      final OSCMenuNode  n;
      MenuGroup      mg, parent;
      int          argIdx    = 1;
     
      try {
View Full Code Here

Examples of javax.swing.KeyStroke

   */
  public static final KeyStroke prefsToStroke( String prefsValue )
  {
    if( prefsValue == null ) return null;
    int i = prefsValue.indexOf( ' ' );
    KeyStroke prefsStroke = null;
    try {
      if( i < 0 ) return null;
      prefsStroke = KeyStroke.getKeyStroke( Integer.parseInt( prefsValue.substring( i+1 )),
                          Integer.parseInt( prefsValue.substring( 0, i )));
    }
View Full Code Here

Examples of org.eclipse.jface.bindings.keys.KeyStroke

      controlDeco.setDescriptionText(Messages.OwlUI_CONTENT_ASSIST);
      controlDeco.setShowOnlyOnFocus(true);
    }

    /* Auto-Activate on Key-Down */
    KeyStroke activationKey = KeyStroke.getInstance(SWT.ARROW_DOWN);

    /* Create Content Proposal Adapter */
    SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(new String[0]) {
      @Override
      public IContentProposal[] getProposals(String contents, int position) {
View Full Code Here

Examples of org.eclipse.jface.bindings.keys.KeyStroke

  }

  private Pair<SimpleContentProposalProvider, ContentProposalAdapter> hookAutoComplete(final Text text, Collection<String> values) {

    /* Auto-Activate on Key-Down */
    KeyStroke activationKey = KeyStroke.getInstance(SWT.ARROW_DOWN);

    /* Create Content Proposal Adapter */
    SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(new String[0]);
    proposalProvider.setFiltering(true);
    final ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(), proposalProvider, activationKey, null);
View Full Code Here

Examples of org.eclipse.jface.bindings.keys.KeyStroke

  }

  private Pair<SimpleContentProposalProvider, ContentProposalAdapter> hookAutoComplete(final Text text, Collection<String> values) {

    /* Auto-Activate on Key-Down */
    KeyStroke activationKey = KeyStroke.getInstance(SWT.ARROW_DOWN);

    /* Create Content Proposal Adapter */
    SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(new String[0]);
    proposalProvider.setFiltering(true);
    final ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(), proposalProvider, activationKey, null);
View Full Code Here

Examples of org.eclipse.jface.bindings.keys.KeyStroke

    public void createContents(Composite parent) {
        FormToolkit toolkit = getManagedForm().getToolkit();

        FieldDecoration assistDecor = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
        KeyStroke assistKeyStroke = null;
        try {
            assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
        } catch (ParseException x) {
            // Ignore
        }

        Section mainSection = toolkit.createSection(parent, Section.TITLE_BAR);
        mainSection.setText(title);

        mainComposite = toolkit.createComposite(mainSection);
        mainSection.setClient(mainComposite);

        toolkit.createLabel(mainComposite, "Pattern:");
        txtName = toolkit.createText(mainComposite, "", SWT.BORDER);
        ControlDecoration decPattern = new ControlDecoration(txtName, SWT.LEFT | SWT.TOP, mainComposite);
        decPattern.setImage(assistDecor.getImage());
        if (assistKeyStroke == null) {
            decPattern.setDescriptionText("Content assist is available. Start typing to activate");
        } else {
            decPattern.setDescriptionText(MessageFormat.format("Content assist is available. Press {0} or start typing to activate", assistKeyStroke.format()));
        }
        decPattern.setShowHover(true);
        decPattern.setShowOnlyOnFocus(true);

        PkgPatternsProposalProvider proposalProvider = new PkgPatternsProposalProvider(new FormPartJavaSearchContext(this));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.