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);
    }
  }
예제 #2
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();
    }
예제 #3
0
    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);
            }
        }*/
      }
    }
예제 #4
0
 // msg from JTextfield
 public void focusLost(FocusEvent e) {
   if (e.getSource() == textField) {
     textField.setBackground(GUIGlobals.theme.InactiveTextField);
     this.fireFocusLost(e.isTemporary());
     this.repaint();
   }
 }
예제 #5
0
 // msg from JTextfield
 public void focusGained(FocusEvent e) {
   if (e.getSource() == textField) {
     this.fireFocusGained(e.isTemporary());
   } else // if the label get's the focus then delegate it to textfield
   {
     textField.grabFocus();
     // !!! field could be not visible (scrollpane!)
     // insert mechanism to ensure visibility
   }
   textField.setBackground(GUIGlobals.theme.ActiveTextField);
 }
  public void focusLost(final FocusEvent e) {
    if (myPanel.getProject().isDisposed()) {
      myPanel.setContextComponent(null);
      myPanel.hideHint();
      return;
    }
    final DialogWrapper dialog = DialogWrapper.findInstance(e.getOppositeComponent());
    shouldFocusEditor = dialog != null;
    if (dialog != null) {
      Disposer.register(
          dialog.getDisposable(),
          new Disposable() {
            @Override
            public void dispose() {
              if (dialog.getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) {
                shouldFocusEditor = false;
              }
            }
          });
    }

    // required invokeLater since in current call sequence KeyboardFocusManager is not initialized
    // yet
    // but future focused component
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            processFocusLost(e);
          }
        });
  }
예제 #7
0
 public void focusGained(FocusEvent e) {
   for (int i = 0; i < textfield.length; i++) {
     if (e.getSource() == textfield[i]) {
       textfield[i].setText("");
     }
   }
 }
예제 #8
0
 public void focusLost(FocusEvent e) {
   // We will still paint focus even if lost temporarily
   focusLostTemporarily = e.isTemporary();
   if (!focusLostTemporarily) {
     comp.repaint();
   }
 }
예제 #9
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("");
       }
     }
   }
 }
예제 #10
0
 /*
  * diese Methode wird aufgerufen wenn das Feld den Focus verliert
  */
 @Override
 public void focusLost(final FocusEvent e) {
   if (e.isTemporary()) {
     return;
   } else {
     if (!checked()) {
       check();
     }
   }
 }
 public void focusGained(final FocusEvent e) {
   if (e.getOppositeComponent() == null && shouldFocusEditor) {
     shouldFocusEditor = false;
     ToolWindowManager.getInstance(myPanel.getProject()).activateEditorComponent();
     return;
   }
   myPanel.updateItems();
   final List<NavBarItem> items = myPanel.getItems();
   if (!myPanel.isInFloatingMode() && items.size() > 0) {
     myPanel.setContextComponent(items.get(items.size() - 1));
   } else {
     myPanel.setContextComponent(null);
   }
 }
  private void processFocusLost(FocusEvent e) {
    final Component opposite = e.getOppositeComponent();

    if (myPanel.isInFloatingMode()
        && opposite != null
        && DialogWrapper.findInstance(opposite) != null) {
      myPanel.hideHint();
      return;
    }

    final boolean nodePopupInactive = !myPanel.isNodePopupActive();
    boolean childPopupInactive = !JBPopupFactory.getInstance().isChildPopupFocused(myPanel);
    if (nodePopupInactive && childPopupInactive) {
      if (opposite != null
          && opposite != myPanel
          && !myPanel.isAncestorOf(opposite)
          && !e.isTemporary()) {
        myPanel.setContextComponent(null);
        myPanel.hideHint();
      }
    }

    myPanel.updateItems();
  }
예제 #13
0
 @Override
 public void focusGained(FocusEvent e) {
   // TODO Auto-generated method stub
   Object obj = e.getSource();
   if (obj.equals(jtf)) {
     jtf.setText("");
   } else if (obj.equals(hi)) {
     hi.setText("");
   } else if (obj.equals(pi)) {
     pi.setText("");
   } else if (obj.equals(localport)) {
     localport.setText("");
   } else if (obj.equals(lpw)) {
     lpw.setText("");
   } else if (obj.equals(lid)) {
     lid.setText("");
   }
 }
 public void focusLost(FocusEvent event) {
   QuaquaUtilities.repaintBorder((JComponent) event.getComponent());
 }
  public void focusLost(FocusEvent e) {
    int id = 0;
    boolean res = false;
    JTextField t = (JTextField) e.getSource();
    if (t == tpid) {
      try {
        id = Integer.parseInt(tpid.getText());
        res = patient.psearch(id);
      } catch (Exception e1) {
      }

      if (res) {
        int no, ag = 0, fee = 0;
        String pfn = "",
            bg = "",
            pmn = "",
            dt1 = "",
            pln = "",
            add = "",
            sym = "",
            dn = "",
            dig = "",
            cn = "",
            gender = "",
            wgt = "";
        try {
          dt1 = patient.rs.getString(1);
          no = patient.rs.getInt(2);
          pfn = patient.rs.getString(3);
          pmn = patient.rs.getString(4);
          pln = patient.rs.getString(5);
          gender = patient.rs.getString(6);
          ag = patient.rs.getInt(7);
          wgt = patient.rs.getString(8);
          add = patient.rs.getString(9);
          cn = patient.rs.getString(10);
          dn = patient.rs.getString(11);
          sym = patient.rs.getString(12);
          dig = patient.rs.getString(13);
          fee = patient.rs.getInt(14);
          bg = patient.rs.getString(15);
          dir = patient.rs.getString(17);

          s = dir;
          repaint();
          j13 = new JLabel("OLD IMAGE");
          j13.setBounds(840, 5, 300, 300);
          JLabel j12 =
              new JLabel("OLD PHOTO") {
                public void paint(Graphics g) {
                  ImageIcon ic = new ImageIcon(s);
                  Image img = ic.getImage();
                  g.drawImage(img, 0, 0, 150, 150, this);
                }
              };

          //	q.flushAll()

          /*ImageIcon ic=new ImageIcon(dir);
          JLabel j12=new JLabel("",ic,JLabel.CENTER);*/
          j12.setBounds(670, 70, 300, 300);
          //	image.setBounds(700,300,100,100);

          q.add(j12);
          q.add(j13);
          repaint();
          System.out.println("8743t32874" + dir);
        } catch (Exception e2) {
        }
        if (gender.equals("Male")) cm.setState(true);
        else cf.setState(true);
        tdt.setText(dt1);
        tpfnm.setText(pfn);
        tpmnm.setText(pmn);
        tplnm.setText(pln);
        tage.setText("" + ag);
        tfee.setText("" + fee);
        tadd.setText(add);
        tdig.setText(dig);
        tdnm.setText(dn);
        tsym.setText(sym);
        tcno.setText(cn);
        twt.setText(wgt);
        tbg.setText(bg);

        // cm.setState(set1State());
        // cf.setSelectedCheckbox(gender);
        ba.setEnabled(false);
        bm.setEnabled(true);
        bd.setEnabled(true);
      } else {
        if (id == 0) {
          bl.setEnabled(true);
          ba.setEnabled(false);
        } else ba.setEnabled(true);
        bm.setEnabled(false);
        bd.setEnabled(false);
      }
    }
  }
예제 #16
0
 public void focusGained(FocusEvent arg0) {
   if (arg0.getSource() == txtName && txtName.getText().equals("<Enter your name here>"))
     txtName.setText("");
 }
예제 #17
0
 public void focusLost(FocusEvent e) {
   if (!focusLostEvents) return;
   actionPerformed(new ActionEvent(e.getSource(), 0, "focusLost"));
 }