public FormattedFieldListener(JFormattedTextField field) { this.field = field; field.addActionListener(this); field.addFocusListener(this); }
/** * Default constructor - instanciates the inned JFormattedTextField. */ public KeyEditorCategorized(){ numberField =new JFormattedTextField(NumberFormat.getNumberInstance()); numberField.setActionCommand(EDIT); numberField.addActionListener(this); }
textField.addActionListener(new ActionListener() {
public HourCellEditor(boolean defaultNull) { super(); editorComponent = SwingComponentFactory.createHourField(defaultNull); editorComponent.setBorder(null); editorComponent.addActionListener(new MyActionListener()); }
public DateHourCellEditor(boolean defaultNull) { super(); editorComponent = SwingComponentFactory .createDateHourField(false, true); editorComponent.setBorder(null); editorComponent.addActionListener(new MyActionListener()); }
private void setupTextField() { getComponent().addActionListener(textAction); getComponent().addFocusListener(focusListener); }
private void initComponents() { min = createFieldComponent(); max = createFieldComponent(); MyActionListener listener = new MyActionListener(); min.addActionListener(listener); max.addActionListener(listener); min.getDocument().addDocumentListener(listener); max.getDocument().addDocumentListener(listener); min.addMouseListener(listener); max.addMouseListener(listener); min.addPropertyChangeListener("value", listener); max.addPropertyChangeListener("value", listener); min.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter"); min.getActionMap().put("enter", validateAction); max.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter"); max.getActionMap().put("enter", validateAction); }
public DatePickerPanel() { super(); setLayout(new GridLayout(1 /* rows */, 3 /* cols */)); yearTextField = new JFormattedTextField(); yearTextField.setToolTipText("Year (YYYY)"); yearTextField.addActionListener(this); add(yearTextField); monthTextField = new JFormattedTextField(); monthTextField.setToolTipText("Month (MM)"); monthTextField.addActionListener(this); add(monthTextField); dayTextField = new JFormattedTextField(); dayTextField.setToolTipText("Day (DD)"); dayTextField.addActionListener(this); add(dayTextField); dateConsumers = new ArrayList<>(); }
private void addIntegerProperty(String com){ Box box=Box.createHorizontalBox(); box.add(new JLabel(ENVIRONMENT.getTranslation(com))); JFormattedTextField field=new JFormattedTextField(ENVIRONMENT.getInteger(com)); field.setToolTipText(ENVIRONMENT.getTranslation(com+"_TIPS")); field.setActionCommand(com); field.addActionListener(this); box.add(field); box.setAlignmentX(0); add(box); } private void addFloatProperty(String com){
private void addFloatProperty(String com){ Box box=Box.createHorizontalBox(); box.add(new JLabel(ENVIRONMENT.getTranslation(com))); JFormattedTextField field=new JFormattedTextField(ENVIRONMENT.getFloat(com)); field.setToolTipText(ENVIRONMENT.getTranslation(com+"_TIPS")); field.setActionCommand(com); field.addActionListener(this); box.add(field); box.setAlignmentX(0); add(box); } private void addStringProperty(String com){
public PageIcon(){ super(new BorderLayout()); content.setVerticalAlignment(SwingConstants.TOP); content.setHorizontalAlignment(SwingConstants.LEFT); content.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); content.addMouseMotionListener(this); add(content,BorderLayout.CENTER); JFormattedTextField scaler=new JFormattedTextField(DecimalFormat.getPercentInstance()); scaler.setValue(1.0); scaler.addActionListener((e)->{ setScale(((Number)scaler.getValue()).doubleValue()); }); add(scaler,BorderLayout.SOUTH); } public PageIcon(BufferedImage page,IconPaint painter){
/** * {@inheritDoc} */ @Override protected void bindJComponent() { super.bindJComponent(); getConnectedJComponent().addActionListener(new ActionListener() { /** * {@inheritDoc} */ public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { fireConnectorValueChange(); } }); getConnectedJComponent().addPropertyChangeListener("value", new PropertyChangeListener() { public void propertyChange(@SuppressWarnings("unused") PropertyChangeEvent evt) { fireConnectorValueChange(); } }); }
/** * {@inheritDoc} */ @Override protected void bindJComponent() { super.bindJComponent(); getConnectedJComponent().addActionListener(new ActionListener() { /** * {@inheritDoc} */ @Override public void actionPerformed(ActionEvent e) { fireConnectorValueChange(); } }); getConnectedJComponent().addPropertyChangeListener("value", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { fireConnectorValueChange(); } }); }
protected void initiliazeSearch(DateSearch e) { dateBox.setValue(new Date()); if (e != null) { comparaisonTypeBox.setSelectedIndex(e.getComparaisonType()); useHourBox.setSelected(e.isUseHour()); if (e.getDate() != null) { hourField.setValue(DateTimeUtils.getMinutesFromDate(e .getDate())); dateBox.setValue(e.getDate()); } } else { comparaisonTypeBox.setSelectedIndex(0); } dateBox.requestFocus(); useHourBox.addChangeListener(new UseHourChangeListener()); hourField.setEnabled(useHourBox.isSelected()); dateBox.addActionListener(new DateActionListener()); dateBox.addFocusListener(new DateFocusListener()); hourField.addActionListener(new HourActionListener()); hourField.addFocusListener(new HourFocusListener()); }
protected void initComponents() { comparaisonTypeBox = new JComboBox( new String[] { SwingMessages.getString("NumberFilterColumn.0"), //$NON-NLS-1$ SwingMessages.getString("NumberFilterColumn.1"), SwingMessages.getString("NumberFilterColumn.2"), SwingMessages.getString("NumberFilterColumn.3"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ SwingMessages.getString("NumberFilterColumn.4"), SwingMessages.getString("NumberFilterColumn.5"), SwingMessages.getString("NumberFilterColumn.6"), SwingMessages.getString("NumberFilterColumn.7") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ comparaisonTypeBox.addActionListener(new ContainsActionListener()); textField = SwingComponentFactory.createHourField(true); textField.addActionListener(new TextActionListener()); textField.addFocusListener(new TextFocusListener()); }
/** * Wires the picker's editor related listening and actions. Removes * listeners/actions from the old editor and adds them to * the new editor. <p> * * @param oldEditor the pickers editor before the change */ protected void updateEditorListeners(JFormattedTextField oldEditor) { if (oldEditor != null) { uninstallEditorListeners(oldEditor); } datePicker.getEditor().addPropertyChangeListener(editorPropertyListener); datePicker.getEditor().addActionListener(editorActionListener); datePicker.getEditor().addFocusListener(focusListener); editorCancelAction = new EditorCancelAction(datePicker.getEditor()); }
/** * Wires the picker's editor related listening and actions. Removes * listeners/actions from the old editor and adds them to * the new editor. <p> * * @param oldEditor the pickers editor before the change */ protected void updateEditorListeners(JFormattedTextField oldEditor) { if (oldEditor != null) { uninstallEditorListeners(oldEditor); } datePicker.getEditor().addPropertyChangeListener(editorPropertyListener); datePicker.getEditor().addActionListener(editorActionListener); datePicker.getEditor().addFocusListener(focusListener); editorCancelAction = new EditorCancelAction(datePicker.getEditor()); }
/** * Wires the picker's editor related listening and actions. Removes * listeners/actions from the old editor and adds them to * the new editor. <p> * * @param oldEditor the pickers editor before the change */ protected void updateEditorListeners(JFormattedTextField oldEditor) { if (oldEditor != null) { uninstallEditorListeners(oldEditor); } datePicker.getEditor().addPropertyChangeListener(editorPropertyListener); datePicker.getEditor().addActionListener(editorActionListener); datePicker.getEditor().addFocusListener(focusListener); editorCancelAction = new EditorCancelAction(datePicker.getEditor()); }
/** * Wires the picker's editor related listening and actions. Removes * listeners/actions from the old editor and adds them to * the new editor. <p> * * @param oldEditor the pickers editor before the change */ protected void updateEditorListeners(JFormattedTextField oldEditor) { if (oldEditor != null) { uninstallEditorListeners(oldEditor); } datePicker.getEditor().addPropertyChangeListener(editorPropertyListener); datePicker.getEditor().addActionListener(editorActionListener); datePicker.getEditor().addFocusListener(focusListener); editorCancelAction = new EditorCancelAction(datePicker.getEditor()); }
/** * Wires the picker's editor related listening and actions. Removes * listeners/actions from the old editor and adds them to * the new editor. <p> * * @param oldEditor the pickers editor before the change */ protected void updateEditorListeners(JFormattedTextField oldEditor) { if (oldEditor != null) { uninstallEditorListeners(oldEditor); } datePicker.getEditor().addPropertyChangeListener(editorPropertyListener); datePicker.getEditor().addActionListener(editorActionListener); datePicker.getEditor().addFocusListener(focusListener); editorCancelAction = new EditorCancelAction(datePicker.getEditor()); }