Package javax.swing

Examples of javax.swing.JTextField$TextFieldActionPropertyChangeListener


    }

    @Override
    protected void configure() {
        super.configure();
        final JTextField filterField = getComponentFactory().createTextField();
        filterField.setToolTipText(getMessage("filter.label"));

        JButton resetButton = new JButton(getIconSource().getIcon("resetButton")) {

            @Override
            public Insets getInsets() {
                return new Insets(0, 0, 0, 0);
            }
        };
        resetButton.setToolTipText(getMessage("resetButton.label"));
        resetButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                filterField.setText("");
            }
        });

        // http://www.jgoodies.com/articles/forms.pdf
        FormLayout formLayout = new FormLayout(
View Full Code Here


    };
   
    if (controller.isPropertyEditable(FurnitureLibraryUserPreferencesController.Property.DEFAULT_CREATOR)) {
      // Create default author label and its text field bound to DEFAULT_CREATOR controller property
      this.defaultCreatorLabel = new JLabel(SwingTools.getLocalizedLabelText(preferences, FurnitureLibraryUserPreferencesPanel.class, "defaultCreatorLabel.text"));
      this.defaultCreatorTextField = new JTextField(controller.getDefaultCreator(), 10);
      if (!OperatingSystem.isMacOSXLeopardOrSuperior()) {
        SwingTools.addAutoSelectionOnFocusGain(this.defaultCreatorTextField);
      }
      final PropertyChangeListener creatorChangeListener = new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            defaultCreatorTextField.setText(controller.getDefaultCreator());
          }
        };
      controller.addPropertyChangeListener(FurnitureLibraryUserPreferencesController.Property.DEFAULT_CREATOR, creatorChangeListener);
      this.defaultCreatorTextField.getDocument().addDocumentListener(new DocumentChangeListener() {
          public void changedUpdate(DocumentEvent ev) {
            controller.removePropertyChangeListener(FurnitureLibraryUserPreferencesController.Property.DEFAULT_CREATOR, creatorChangeListener);
            String defaultCreator = defaultCreatorTextField.getText();
            if (defaultCreator == null || defaultCreator.trim().length() == 0) {
              controller.setDefaultCreator(null);
            } else {
              controller.setDefaultCreator(defaultCreator);
            }
            controller.addPropertyChangeListener(FurnitureLibraryUserPreferencesController.Property.DEFAULT_CREATOR, creatorChangeListener);
          }
        });
    }
   
    if (controller.isPropertyEditable(FurnitureLibraryUserPreferencesController.Property.OFFLINE_FURNITURE_LIBRARY)) {
      // Create offline label and check box bound to controller OFFLINE_FURNITURE_LIBRARY property
      this.offlineFurnitureLibraryLabel = new JLabel(preferences.getLocalizedString(
          FurnitureLibraryUserPreferencesPanel.class, "offlineFurnitureLibraryLabel.text"));
      this.offlineFurnitureLibraryCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
          FurnitureLibraryUserPreferencesPanel.class, "offlineFurnitureLibraryCheckBox.text"), controller.isFurnitureLibraryOffline());
      this.offlineFurnitureLibraryCheckBox.addItemListener(new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            controller.setFurnitureLibraryOffline(offlineFurnitureLibraryCheckBox.isSelected());
          }
        });
      controller.addPropertyChangeListener(FurnitureLibraryUserPreferencesController.Property.OFFLINE_FURNITURE_LIBRARY,
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent ev) {
              boolean furnitureLibraryOffline = controller.isFurnitureLibraryOffline();
              offlineFurnitureLibraryCheckBox.setSelected(furnitureLibraryOffline);
              if (furnitureResourcesLocalDirectoryTextField != null) {
                furnitureResourcesLocalDirectoryTextField.setEnabled(!furnitureLibraryOffline);
              }
              if (furnitureResourcesRemoteUrlBaseTextField != null) {
                furnitureResourcesRemoteUrlBaseTextField.setEnabled(!furnitureLibraryOffline);
              }
            }
          });
    }

    if (controller.isPropertyEditable(FurnitureLibraryUserPreferencesController.Property.FURNITURE_RESOURCES_LOCAL_DIRECTORY)) {
      // Create local directory  label and its text field bound to FURNITURE_RESOURCES_LOCAL_DIRECTORY controller property
      this.furnitureResourcesLocalDirectoryLabel = new JLabel(SwingTools.getLocalizedLabelText(preferences, FurnitureLibraryUserPreferencesPanel.class, "furnitureResourcesLocalDirectoryLabel.text"));
      this.furnitureResourcesLocalDirectoryTextField = new JTextField(controller.getFurnitureResourcesLocalDirectory(), 20);
      this.furnitureResourcesLocalDirectoryTextField.setEnabled(!controller.isFurnitureLibraryOffline());
      if (!OperatingSystem.isMacOSXLeopardOrSuperior()) {
        SwingTools.addAutoSelectionOnFocusGain(this.furnitureResourcesLocalDirectoryTextField);
      }
      final PropertyChangeListener localDirectoryChangeListener = new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            furnitureResourcesLocalDirectoryTextField.setText(controller.getFurnitureResourcesLocalDirectory());
          }
        };
      controller.addPropertyChangeListener(FurnitureLibraryUserPreferencesController.Property.FURNITURE_RESOURCES_LOCAL_DIRECTORY, localDirectoryChangeListener);
      this.furnitureResourcesLocalDirectoryTextField.getDocument().addDocumentListener(new DocumentChangeListener() {
          public void changedUpdate(DocumentEvent ev) {
            controller.removePropertyChangeListener(FurnitureLibraryUserPreferencesController.Property.FURNITURE_RESOURCES_LOCAL_DIRECTORY, localDirectoryChangeListener);
            String furnitureResourcesLocalDirectory = furnitureResourcesLocalDirectoryTextField.getText();
            if (furnitureResourcesLocalDirectory == null || furnitureResourcesLocalDirectory.trim().length() == 0) {
              controller.setFurnitureResourcesLocalDirectory(null);
            } else {
              controller.setFurnitureResourcesLocalDirectory(furnitureResourcesLocalDirectory);
            }
            controller.addPropertyChangeListener(FurnitureLibraryUserPreferencesController.Property.FURNITURE_RESOURCES_LOCAL_DIRECTORY, localDirectoryChangeListener);
          }
        });
    }

    if (controller.isPropertyEditable(FurnitureLibraryUserPreferencesController.Property.FURNITURE_RESOURCES_REMOTE_URL_BASE)) {
      // Create URL base label and its text field bound to FURNITURE_RESOURCES_REMOTE_URL_BASE controller property
      this.furnitureResourcesRemoteUrlBaseLabel = new JLabel(SwingTools.getLocalizedLabelText(preferences, FurnitureLibraryUserPreferencesPanel.class, "furnitureResourcesRemoteUrlBaseLabel.text"));
      this.furnitureResourcesRemoteUrlBaseTextField = new JTextField(controller.getFurnitureResourcesRemoteURLBase(), 20);
      this.furnitureResourcesRemoteUrlBaseTextField.setEnabled(!controller.isFurnitureLibraryOffline());
      if (!OperatingSystem.isMacOSXLeopardOrSuperior()) {
        SwingTools.addAutoSelectionOnFocusGain(this.furnitureResourcesRemoteUrlBaseTextField);
      }
      final PropertyChangeListener urlBaseChangeListener = new PropertyChangeListener() {
View Full Code Here

    protected void doOnce() {
        closeAllViews();

        // TODO move to jgoodies layout / miglayout
        JPanel panel = new JPanel(new GridLayout(0, 2));
        JTextField daysTextField = new JTextField(20);
        daysTextField.setText("" + settings.getNumberOfDays());

        JLabel daysLabel = new JLabel(tr.get(ID + ".days"));
        JTextField slotsTextField = new JTextField(20);
        slotsTextField.setText("" + settings.getTimeslotsPerDay());
        JLabel slotsLabel = new JLabel(tr.get(ID + ".slots"));

        panel.add(daysLabel);
        panel.add(daysTextField);
        panel.add(slotsLabel);
        panel.add(slotsTextField);

        JOptionPane.showMessageDialog(null, panel);
        Exception daysError = null;
        Exception slotsError = null;

        try {
            settings.setNumberOfDays(Integer.parseInt(daysTextField.getText()));
        } catch (Exception ex) {
            daysError = ex;
        }

        try {
            settings.setTimeslotsPerDay(Integer.parseInt(slotsTextField.getText()));
        } catch (Exception ex) {
            slotsError = ex;
        }

        if (slotsError != null || daysError != null) {
View Full Code Here

    mCaller = caller;
  }

  protected JPanel createContent(WizardHandler handler) {

    mNameTf = new JTextField(((Favorite)handler.getCurrentValue()).getName());


    PanelBuilder panelBuilder = new PanelBuilder(new FormLayout("5dlu, pref, 3dlu, default:grow",
        "pref"));
    panelBuilder.setBorder(Borders.DLU4_BORDER);
View Full Code Here

      // set up components
      rotateToFit = new JCheckBox();
      rotateToFit.setSelected(true);
      printerView = new JCheckBox();
      printerView.setSelected(true);
      header = new JTextField(20);
      header.setText("%n (%p of %P)");
     
      // set up panel
      gridbag = new GridBagLayout();
      gbc = new GridBagConstraints();
View Full Code Here

  }

  private static String promptForCircuitName(JFrame frame,
      Library lib, String initialValue) {
    JLabel label = new JLabel(Strings.get("circuitNamePrompt"));
    final JTextField field = new JTextField(15);
    field.setText(initialValue);
    JLabel error = new JLabel(" ");
    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints gc = new GridBagConstraints();
    JPanel strut = new JPanel(null);
    strut.setPreferredSize(new Dimension(3 * field.getPreferredSize().width / 2, 0));
    JPanel panel = new JPanel(gb);
    gc.gridx = 0;
    gc.gridy = GridBagConstraints.RELATIVE;
    gc.weightx = 1.0;
    gc.fill = GridBagConstraints.NONE;
    gc.anchor = GridBagConstraints.LINE_START;
    gb.setConstraints(label, gc); panel.add(label);
    gb.setConstraints(field, gc); panel.add(field);
    gb.setConstraints(error, gc); panel.add(error);
    gb.setConstraints(strut, gc); panel.add(strut);
    JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE,
        JOptionPane.OK_CANCEL_OPTION);
    pane.setInitialValue(field);
    JDialog dlog = pane.createDialog(frame, Strings.get("circuitNameDialogTitle"));
    dlog.addWindowFocusListener(new WindowFocusListener() {
      public void windowGainedFocus(WindowEvent arg0) {
        field.requestFocus();
      }

      public void windowLostFocus(WindowEvent arg0) { }
    });
   
    while (true) {
      field.selectAll();
      dlog.pack();
      dlog.setVisible(true);
      field.requestFocusInWindow();
      Object action = pane.getValue();
      if (action == null || !(action instanceof Integer)
          || ((Integer) action).intValue() != JOptionPane.OK_OPTION) {
        return null;
      }

      String name = field.getText().trim();
      if (name.equals("")) {
        error.setText(Strings.get("circuitNameMissingError"));
      } else {
        if (lib.getTool(name) == null) {
          return name;
View Full Code Here

    });

    mServiceUrlLabel = new JLabel(mLocalizer.msg("Url", "Url") + ':');
    mServiceUrlLabel.setEnabled(mServiceCombo.getSelectedIndex() >= 2);

    mServiceUrlField = new JTextField();
    mServiceUrlField.setEnabled(mServiceCombo.getSelectedIndex() >= 2);
    mServiceUrlField.setText(mSettings.getBlogUrl());

    CellConstraints cc = new CellConstraints();
View Full Code Here

        setLayout(new FormLayout("pref, 3dlu, fill:pref:grow", "pref, 3dlu, pref, 3dlu, pref"));
        setBorder(Borders.DLU4_BORDER);
        CellConstraints cc = new CellConstraints();

        add(new JLabel(mLocalizer.msg("user", "Username") + ":"), cc.xy(1, 3));
        mUsername = new JTextField();
        mUsername.setText(mOldUserName);
        mUsername.getDocument().addDocumentListener(new DocumentListener() {
            public void insertUpdate(DocumentEvent event) {
                updateValue();
            }
View Full Code Here

      if(!(ml[i] instanceof ToolTipManager)) {
        mSearchCloseBtn.removeMouseListener(ml[i]);
      }
    }

    final JTextField searchField = getSearchField();

    mFindNext = new JButton(mLocalizer.msg("next", "Find Next"));
    mFindNext.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    mFindNext.setIcon(TVBrowserIcons.down(TVBrowserIcons.SIZE_SMALL));
    mFindNext.setContentAreaFilled(false);
    mFindNext.setFocusable(false);
    mFindNext.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        next();
      }
    });

    mFindPrev = new JButton(mLocalizer.msg("prev", "Find Previous"));
    mFindPrev.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    mFindPrev.setIcon(TVBrowserIcons.up(TVBrowserIcons.SIZE_SMALL));
    mFindPrev.setContentAreaFilled(false);
    mFindPrev.setFocusable(false);
    mFindPrev.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        prev();
      }
    });

    addMouseAdapter(mFindNext);
    addMouseAdapter(mFindPrev);
    addMouseAdapter(mSearchCloseBtn);

    searchField.addKeyListener(new KeyAdapter() {
      public void keyReleased(KeyEvent e) {
        mFindNext.setEnabled(searchField.getText().length() > 0);
        mFindPrev.setEnabled(searchField.getText().length() > 0);
      }
    });

    b.add(mSearchCloseBtn, cc.xy(2, 1));
    b.addLabel(mLocalizer.msg("find", "Find:"), cc.xy(4, 1));
    b.add(searchField, cc.xy(6, 1));
    b.add(mFindNext, cc.xy(8, 1));
    b.add(mFindPrev, cc.xy(10, 1));
    b.add(getMessageLabel(), cc.xy(12, 1));

    /*
     * Close action for the SearchPanel.
     */
    Action close = new AbstractAction() {
      private static final long serialVersionUID = 1L;

      public void actionPerformed(ActionEvent e) {
        mSearchBar.setVisible(false);
        setBlockAutoClosing(false);
        interrupt();
      }
    };

    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    searchField.getInputMap(JComponent.WHEN_FOCUSED).put(stroke, "CLOSE_SEARCH");
    searchField.getActionMap().put("CLOSE_SEARCH", close);

    mFindNext.getInputMap(JComponent.WHEN_FOCUSED).put(stroke, "CLOSE_SEARCH");
    mFindNext.getActionMap().put("CLOSE_SEARCH", close);

    mFindPrev.getInputMap(JComponent.WHEN_FOCUSED).put(stroke, "CLOSE_SEARCH");
View Full Code Here

    proxyType.addItem("No Proxy");
    proxyType.addItem("HTTP");
    proxyType.addItem("Socks 4");
    proxyType.addItem("Socks 5");
    proxyType.setSelectedIndex(Integer.parseInt(genProp.getValue("proxyType")));
    proxyHost = new JTextField();
    proxyHost.setText(genProp.getValue("proxyHost"));
    proxyPort = new JTextField();
    proxyPort.setText(genProp.getValue("proxyPort"));

    proxyPanel.setLayout(new GridBagLayout());
    c.gridy = 0;
    proxyPanel.add(proxyType, c);
View Full Code Here

TOP

Related Classes of javax.swing.JTextField$TextFieldActionPropertyChangeListener

Copyright © 2018 www.massapicom. 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.