Package javax.swing.text

Examples of javax.swing.text.JTextComponent.addFocusListener()


        Font font = (new JTextField()).getFont();
        setFont(font);
        text.setFont(font);
       
        text.addFocusListener(
            new FocusListener() {
                public void focusGained(FocusEvent e) {
                    JTextComponent text = (JTextComponent) e.getSource();
                    text.selectAll();
                }
View Full Code Here


        JTextComponent txt = (JTextComponent) c;

        // repaint to correctly highlight text if FocusBehavior is
        // HIGHLIGHT_LABEL in Metal and Windows LnF
        txt.addFocusListener(focusHandler);
    }

    /**
     * Delegates, then uninstalls the focus listener.
     */
 
View Full Code Here

        super.installDefaults();

        JTextComponent c = getComponent();

        updateStyle(c);
        c.addFocusListener(this);
    }

    /**
     * @see javax.swing.plaf.basic.BasicTextUI#uninstallDefaults()
     */
 
View Full Code Here

    focusListener = createFocusHandler();
    comboBox.addMouseListener(mouseHandler);
    JTextComponent textComponent = (JTextComponent)comboBox.getEditor().
                      getEditorComponent();
    textComponent.addMouseListener(mouseHandler);
    textComponent.addFocusListener(focusListener);
    popupListener = createPopupListener();
    comboBox.addPopupMenuListener(popupListener);

  }
View Full Code Here

            public void focusGained ( final FocusEvent e )
            {
                textComponent.repaint ();
            }
        };
        textComponent.addFocusListener ( focusListener );

        marginChangeListener = new PropertyChangeListener ()
        {
            @Override
            public void propertyChange ( final PropertyChangeEvent evt )
View Full Code Here

        }
        /* workround, so that default button works */
        editor.addKeyListener(new ActivateDefaultButtonListener<Unit>(cb));

        /* removing select... keyword */
        editor.addFocusListener(new FocusListener() {
            @Override
            public void focusGained(final FocusEvent e) {
                final Value v = getValue();
                if (v.isNothingSelected()) {
                    application.invokeLater(new Runnable() {
View Full Code Here

        }
        /* workround, so that default button works */
        editor.addKeyListener(new ActivateDefaultButtonListener<Value>(cb));

        /* removing select... keyword */
        editor.addFocusListener(new FocusListener() {
            @Override
            public void focusGained(final FocusEvent e) {
                final Value v = getValue();
                if (v == null || v.isNothingSelected()) {
                    editor.setText("");
View Full Code Here

                   values.setPossibleACItems(valueList);
                   objKey=key;
               }
           };
           editor.addFocusListener(focus);
           return focus;
        }

        protected JPopupMenu popupMenu = new JPopupMenu() {
            JCheckBoxMenuItem fixTagLanguageCb = new JCheckBoxMenuItem(
View Full Code Here

    public AutoCompletingComboBox(String prototype) {
        super(new AutoCompletionListItem(prototype));
        setRenderer(new AutoCompleteListCellRenderer());
        final JTextComponent editorComponent = (JTextComponent) this.getEditor().getEditorComponent();
        editorComponent.setDocument(new AutoCompletingComboBoxDocument(this));
        editorComponent.addFocusListener(
                new FocusListener() {
                    @Override
                    public void focusLost(FocusEvent e) {
                    }
                    @Override
View Full Code Here

        JLabel label = UIFactory.makeJLabel(desc);

        hmFields.put(server.getId(), field);
        label.setLabelFor(field);
        field.addFocusListener(l);
        if (lastFocusComponent == null)
        {
          lastFocusComponent = field;
        }
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.