示例#1
0
    public void focusLost(FocusEvent arg0) {
      if (arg0.getSource() == txtName && txtName.getText().equals(""))
        txtName.setText("<Enter your name here>");

      if (arg0.getSource() == txtPhone) validatePhone();
      if (arg0.getSource() == txtEmail) validateEmail();
    }
 public void focusLost(java.awt.event.FocusEvent evt) {
   if (evt.getSource() == tf_cantidad) {
     MovimientoArticuloModificarEliminar.this.tf_cantidadFocusLost(evt);
   } else if (evt.getSource() == btn_buscar) {
     MovimientoArticuloModificarEliminar.this.btn_buscarFocusLost(evt);
   }
 }
示例#3
0
 @Override
 public void focusGained(FocusEvent e) {
   if (e.getSource() instanceof JTextField) {
     JTextField tf = (JTextField) e.getSource();
     tf.selectAll();
   }
 }
 /**
  * Revalidates minimum/maximum range.
  *
  * @param event the event.
  */
 public void focusLost(FocusEvent event) {
   if (event.getSource() == this.minimumRangeValue) {
     validateMinimum();
   } else if (event.getSource() == this.maximumRangeValue) {
     validateMaximum();
   }
 }
 @Override
 public void focusGained(FocusEvent e) {
   if (!(e.getSource() instanceof JComboBox)) return;
   Object o = ((JComboBox) e.getSource()).getSelectedItem();
   if (!(o instanceof TargetSelection)) return;
   TargetSelection ts = (TargetSelection) o;
   tfAuth.setText(ts.auth);
   taDesc.setText(ts.desc);
 }
示例#6
0
 @Override
 public void focusGained(FocusEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == textArea1) {
     textArea1.setBorder(border);
   } else if (e.getSource() == textArea3) {
     textArea3.setBorder(border);
   }
 }
示例#7
0
  @Override
  public void focusGained(FocusEvent fe) {
    if (fe.getSource() == jtxt_codigo) {
      jtxt_codigo.setSelectionStart(0);

    } else if (fe.getSource() == jtxt_nombre) {
      jtxt_nombre.setSelectionStart(0);

    } else if (fe.getSource() == jtxt_cantidadCreditos) {
      jtxt_cantidadCreditos.setSelectionStart(0);
    }
  }
        public void focusGained(FocusEvent e) {

          synchronized (this) {
            if (c != null) {
              c.getDocument().removeDocumentListener(d);
              c = null;
              d = null;
            }

            if (e.getSource() instanceof JTextComponent) {

              c = (JTextComponent) e.getSource();
              /** [ 1553552 ] Not properly detecting changes to flag as changed */
              d =
                  new DocumentListener() {

                    void fire(DocumentEvent e) {
                      if (c.isFocusOwner()) {
                        markIfModified((FieldEditor) c);
                      }
                    }

                    public void changedUpdate(DocumentEvent e) {
                      fire(e);
                    }

                    public void insertUpdate(DocumentEvent e) {
                      fire(e);
                    }

                    public void removeUpdate(DocumentEvent e) {
                      fire(e);
                    }
                  };
              c.getDocument().addDocumentListener(d);

              /** Makes the vertical scroll panel view follow the focus */
              Component cScrollPane = c.getParent().getParent();
              if (cScrollPane instanceof JScrollPane) {
                JScrollPane componentPane = (JScrollPane) cScrollPane;
                Component cPane = componentPane.getParent();
                if (cPane instanceof JPanel) {
                  JPanel panel = (JPanel) cPane;
                  Rectangle bounds = componentPane.getBounds();
                  panel.scrollRectToVisible(bounds);
                }
              }
            }
          }

          setActive((FieldEditor) e.getSource());
        }
示例#9
0
 public void focusGained(FocusEvent e) {
   if (e.getSource() == Register_username) {
     if ("email address".equals(Register_username.getText())) Register_username.setText("");
   }
   if (e.getSource() == Register_password) {
     if ("password".equals(Register_password.getText())) Register_password.setText("");
     Register_password.setEchoChar('*');
   }
   if (("".equals(Register_password.getText()))
       | ("password".equals(Register_password.getText()))) {
   } else {
     Register_password.setEchoChar('*');
   }
 }
示例#10
0
 @Override
 public void focusLost(FocusEvent e) {
   if (e.getSource() instanceof JTextComponent) {
     JTextComponent tc = (JTextComponent) e.getSource();
     switch (tc.getName()) {
       case CN_TITLE:
         scene.setTitle(tc.getText());
         break;
       case CN_TEXT:
         scene.setSummary(tc.getText());
         break;
     }
     mainFrame.getBookController().updateScene(scene);
   }
 }
示例#11
0
    @Override
    public void focusLost(FocusEvent e) {
      if (e.getSource() == diaAddRirView.this.getM_tDateRir()
          && !diaAddRirView.this.getM_bAnnuler().isSelected()) {
        // lost focus sur la date, vérification de l'intégrité de la date
        String stringDate = diaAddRirView.this.getM_tDateRir().getText();
        String[] splitDate = stringDate.trim().split("/");
        if (splitDate != null && splitDate.length == 3) {
          try {
            Calendar c = Calendar.getInstance();
            c.setLenient(false);
            int year = Integer.valueOf(splitDate[2]);
            int month = Integer.valueOf(splitDate[1]) - 1;
            int day = Integer.valueOf(splitDate[0]);
            c.set(year, month, day);
            c.getTime();
          } catch (IllegalArgumentException ee) {
            JOptionPane.showMessageDialog(null, "Date du rir incorrecte (1)");
            diaAddRirView.this.getM_tDateRir().setText("");
          }

        } else {
          JOptionPane.showMessageDialog(null, "Date du rir incorrecte (2)");
          diaAddRirView.this.getM_tDateRir().setText("");
        }
      }
    }
  @Override
  public void focusLost(FocusEvent e) {
    if (e.getSource() instanceof JFormattedTextField) {
      JFormattedTextField formattedTextField = (JFormattedTextField) e.getSource();

      if (formattedTextField == jftDateRef) {
        focusLostDate();
      }
    } else if (e.getSource() instanceof JTextField) {
      JTextField textField = (JTextField) e.getSource();

      if (textField == jtfYear) {
        focusLostYear();
      }
    }
  }
示例#13
0
 public void focusLost(FocusEvent event) {
   if ((curparam != null) && (event.getSource() == defval)) {
     guipanel.setDefaultValue(curparam, defval.getText());
     ((ComponentPanelInterface) comppanels.get(params.get(curparam)))
         .notifyDefaultValue(defval.getText());
   }
 }
  private void berechneArtikelpreis(FocusEvent e) throws Throwable {
    boolean bEventBehandelt = false;

    // Source ist wnfFixpreis oder wnfRabattsatz
    if (e.getSource() == wnfFixpreis) {
      preisSetzen();
      bEventBehandelt = true;
    }

    if (!bEventBehandelt) {
      if (e.getSource() == wnfRabattsatz) {
        preisSetzen();
        bEventBehandelt = true;
      }
    }
  }
示例#15
0
 // msg from JTextfield
 public void focusLost(FocusEvent e) {
   if (e.getSource() == textField) {
     textField.setBackground(GUIGlobals.theme.InactiveTextField);
     this.fireFocusLost(e.isTemporary());
     this.repaint();
   }
 }
  public void focusGained(FocusEvent event) {
    QuaquaUtilities.repaintBorder((JComponent) event.getComponent());

    final JTextComponent tc = (JTextComponent) event.getSource();
    if (tc.isEditable() && tc.isEnabled()) {

      String uiProperty;
      if (tc instanceof JPasswordField) {
        uiProperty = "PasswordField.autoSelect";
      } else if (tc instanceof JFormattedTextField) {
        uiProperty = "FormattedTextField.autoSelect";
      } else {
        uiProperty = "TextField.autoSelect";
      }

      if (tc.getClientProperty("Quaqua.TextComponent.autoSelect") == Boolean.TRUE
          || tc.getClientProperty("Quaqua.TextComponent.autoSelect") == null
              && UIManager.getBoolean(uiProperty)) {
        if (event instanceof CausedFocusEvent) {
          CausedFocusEvent cfEvent = (CausedFocusEvent) event;
          if (cfEvent.getCause() == Cause.TRAVERSAL_FORWARD
              || cfEvent.getCause() == Cause.TRAVERSAL_BACKWARD) {
            tc.selectAll();
          }
        }
      }
    }
    if (KeyboardFocusManager.getCurrentKeyboardFocusManager()
        instanceof QuaquaKeyboardFocusManager) {
      QuaquaKeyboardFocusManager kfm =
          (QuaquaKeyboardFocusManager) KeyboardFocusManager.getCurrentKeyboardFocusManager();
      kfm.setLastKeyboardTraversingComponent(null);
    }
  }
 @Override
 public void focusLost(FocusEvent e) {
   super.focusLost(e);
   AbstractButton b = (AbstractButton) e.getSource();
   b.getModel().setArmed(false);
   b.repaint();
 }
 /*     */ public void focusGained(FocusEvent e) {
   /*  45 */ Object object = e.getSource();
   /*  46 */ if ((object instanceof JTextComponent)) {
     /*  47 */ ((JTextComponent) object).selectAll();
     /*  48 */ Object clientProperty =
         ((JTextComponent) object).getClientProperty("SelectAll.onlyOnce");
     /*  49 */ if (Boolean.TRUE.equals(clientProperty)) {
       /*  50 */ ((JTextComponent) object).removeFocusListener(SelectAllUtils.SELECT_ALL);
       /*     */ }
     /*     */ }
   /*  53 */ else if ((object instanceof Component)) {
     /*  54 */ JideSwingUtilities.setRecursively(
         (Component) object,
         new JideSwingUtilities.Handler() {
           /*     */ public boolean condition(Component c) {
             /*  56 */ return c instanceof JTextComponent;
             /*     */ }
           /*     */
           /*     */ public void action(Component c) {
             /*  60 */ ((JTextComponent) c).selectAll();
             /*  61 */ Object clientProperty =
                 ((JTextComponent) c).getClientProperty("SelectAll.onlyOnce");
             /*  62 */ if (Boolean.TRUE.equals(clientProperty))
               /*  63 */ c.removeFocusListener(SelectAllUtils.SELECT_ALL);
             /*     */ }
           /*     */
           /*     */ public void postAction(Component c) /*     */ {
             /*     */ }
           /*     */ });
     /*     */ }
   /*     */ }
示例#19
0
 /** Handles information pane updates when component focus changes. */
 @Override
 public void focusGained(FocusEvent e) {
   Object src = e.getSource();
   String text = infoTable.get(src);
   infoPane.setText("<html>" + text);
   infoPane.setCaretPosition(0);
 }
示例#20
0
 public void focusGained(FocusEvent e) {
   for (int i = 0; i < textfield.length; i++) {
     if (e.getSource() == textfield[i]) {
       textfield[i].setText("");
     }
   }
 }
    public void focusLost(FocusEvent e) {
      Object objFocus = e.getSource();
      boolean bSaveCmd = false;
      if (objFocus instanceof DataField) {
        DataField compFocus = (DataField) objFocus;
        Component comp = e.getOppositeComponent();
        if (comp instanceof JButton) {
          String strTxt = ((JButton) comp).getText();
          if (strTxt != null && strTxt.equals(WGlobal.SAVEUSER)) bSaveCmd = true;
        }

        // if the focus is not in the panel then write the file.
        /*if ((comp == null || !m_pnlDisplay.equals(comp.getParent()))
                && !bSaveCmd)
        {
            String strPrevValue = compFocus.getValue();
            String strTxt = compFocus.getText();
            if (!strPrevValue.equals(strTxt))
            {
                // save the data by writing it to the file
                AppIF appIf = Util.getAppIF();
                if (appIf instanceof VAdminIF)
                    ((VAdminIF)appIf).getUserToolBar().doSave();
                compFocus.setValue(strTxt);
            }
        }*/
      }
    }
示例#22
0
    @Override
    public void focusLost(FocusEvent e) {
      JTextField src = (JTextField) e.getSource();
      String text = src.getText();

      if (!text.matches("([01]?[0-9]|2[0-3])")) src.setText("00");
      else if (text.matches("[0-9]")) src.setText("0" + text);
    }
  /**
   * Evento focusGained, que vai ser executado quando o usuário selecionar o campo de texto, que vai
   * fazer todo o texto (se tiver algum) ser selecionado automaticamente
   */
  public void focusGained(FocusEvent e) {
    Object o = e.getSource();

    if (o instanceof JTextComponent) {
      JTextComponent j = (JTextComponent) o;
      j.selectAll();
    }
  }
示例#24
0
 @Override
 public void focusGained(FocusEvent e) {
   Object source = e.getSource();
   if (source instanceof JTextComponent) {
     // If we can, select all the text
     ((JTextComponent) (source)).selectAll();
   }
 }
示例#25
0
  public void focusGained(FocusEvent fevt) {

    if (fevt.getSource() == txtUsuario)
      lbInstrucoes.setText("Digite sua identificação de usuário!");
    else if (fevt.getSource() == txpSenha) lbInstrucoes.setText("Digite sua senha!");
    else if (fevt.getSource() == cbEmp) {
      if (!sUsuAnt.equals(txtUsuario.getVlrString().trim().toLowerCase())) btOK.requestFocus();
      else lbInstrucoes.setText("Selecione a filial!");
    } else if (fevt.getSource() == btOK) {
      if (!sUsuAnt.equals(txtUsuario.getVlrString().trim().toLowerCase())) {
        lbInstrucoes.setText("Pressione espaço p/ conectar ao banco de dados!");
        if (tries == 0) {
          btOK.doClick();
          tries++;
        }
      } else lbInstrucoes.setText("Pressione espaço p/ entrar no sistema!");
    }
  }
示例#26
0
 public void reactOnFocusGained(FocusEvent e) {
   if (((JComponent) e.getSource()).getName().equals("suchenach")
       && patientHauptPanel.inMemo > -1) {
     Reha.thisClass.patpanel.pmemo[patientHauptPanel.inMemo].requestFocus();
   }
   if (!patientHauptPanel.getInternal().getActive()) {
     patientHauptPanel.getInternal().setSpecialActive(true);
   }
 }
示例#27
0
 /*
  * (non-Javadoc)
  *
  * @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
  */
 @Override
 public void focusGained(final FocusEvent e) {
   if (e.getSource() == renderer) {
     setRendererMode(false);
     editor.requestFocus();
   } else {
     setEditorText(renderer.getText());
     editor.selectAll();
   }
 }
示例#28
0
 public void focusGained(FocusEvent e) {
   for (int i = 0; i < textfield.length; i++) {
     if (e.getSource() == textfield[i]) {
       textfield[i].setForeground(Color.black);
       if (textfield[i].getText().equalsIgnoreCase(DEFAULT[i])) {
         textfield[i].setText("");
       }
     }
   }
 }
  /**
   * Fixpreis uebersteuert einen ev. vorhandenen Rabattsatz.
   *
   * @param e FocusEvent
   * @throws Throwable
   */
  public void fixpreis_focusLost(FocusEvent e) throws Throwable {
    if (e.getSource().equals(wnfFixpreis)) {
      // Hinweis, falls es einen Rabattsatz gab, Rabattsatz auf 0 setzen
      if (wnfRabattsatz.getDouble().doubleValue() != 0) {
        wnfRabattsatz.setDouble(new Double(0));
      }
    }

    berechneArtikelpreis(e);
  }
 public void focusLost(FocusEvent e) {
   synchronized (this) {
     if (c != null) {
       c.getDocument().removeDocumentListener(d);
       c = null;
       d = null;
     }
   }
   if (!e.isTemporary()) parent.updateField(e.getSource());
 }