Exemplo n.º 1
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);
            }
        }*/
      }
    }
Exemplo n.º 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();
    }
Exemplo n.º 3
0
 // msg from JTextfield
 public void focusLost(FocusEvent e) {
   if (e.getSource() == textField) {
     textField.setBackground(GUIGlobals.theme.InactiveTextField);
     this.fireFocusLost(e.isTemporary());
     this.repaint();
   }
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
0
 void canvasFocusLost(FocusEvent e) {
   if (isXEmbedActive() && !e.isTemporary()) {
     xembedLog.fine("Forwarding FOCUS_LOST");
     int num = 0;
     if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.xembed.testing"))) {
       Component opp = e.getOppositeComponent();
       try {
         num = Integer.parseInt(opp.getName());
       } catch (NumberFormatException nfe) {
       }
     }
     xembed.sendMessage(xembed.handle, XEMBED_FOCUS_OUT, num, 0, 0);
   }
 }
Exemplo n.º 6
0
 public void focusGained(FocusEvent e) {
   for (int i = 0; i < textfield.length; i++) {
     if (e.getSource() == textfield[i]) {
       textfield[i].setText("");
     }
   }
 }
Exemplo n.º 7
0
 public void focusLost(FocusEvent e) {
   // We will still paint focus even if lost temporarily
   focusLostTemporarily = e.isTemporary();
   if (!focusLostTemporarily) {
     comp.repaint();
   }
 }
  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);
          }
        });
  }
Exemplo n.º 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("");
       }
     }
   }
 }
 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();
  }
Exemplo n.º 12
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("");
   }
 }
Exemplo n.º 13
0
  protected void processFocusEvent(FocusEvent e) {
    boolean lbContinuar = true;
    int id = e.getID();
    switch (id) {
      case FocusEvent.FOCUS_GAINED:
        super.setText(moTipo.getText());
        moBackColor = getBackground();
        setBackgroundP(moBackColorConFoco);
        setSelectionStart(0);
        setSelectionEnd(moTipo.getText().length());
        break;
      case FocusEvent.FOCUS_LOST:
        setBackgroundP(moBackColor);
        String lsTexto = super.getText();
        if (moTipo.isTipoCorrecto(lsTexto)) {
          moTipo.lostFocus(lsTexto);
          super.setText(moTipo.getTextFormateado());
        } else {
          lbContinuar = !moTipo.isTipoCorrectoObligatorio();
          if (lbContinuar) {
            moTipo.lostFocus(lsTexto);
            super.setText(moTipo.getTextFormateado());
          }

          utilesGUI.msgbox.JDialogo.showDialog(null, moTipo.getTextoError(lsTexto));
        }

        // anulamos la seleccion para que solo haya un campo con todo seleccionado
        if (lbContinuar) {
          setSelectionStart(0);
          setSelectionEnd(0);
          ponerColorSiCambio();
        }
        break;
      default:
    }
    super.processFocusEvent(e);
    // no se hace esto pq en windows se mete en un bucle infinito
    //        if(lbContinuar)
    //            super.processFocusEvent(e);
    //        else
    //            this.requestFocus();
  }
Exemplo n.º 14
0
 public void focusLost(FocusEvent e) {
   Component c = e.getComponent();
   if (c instanceof TextField) ((TextField) c).select(0, 0);
 }
Exemplo n.º 15
0
 public void focusGained(FocusEvent arg0) {
   if (arg0.getSource() == txtName && txtName.getText().equals("<Enter your name here>"))
     txtName.setText("");
 }
Exemplo n.º 16
0
 public void focusGained(FocusEvent e) {
   fieldWithFocus = e.getSource();
   if (fieldWithFocus == widthField) constainAspectRatio = true;
   else if (fieldWithFocus == yField) constainAspectRatio = false;
 }
Exemplo n.º 17
0
 public void focusGained(FocusEvent e) {
   Component c = e.getComponent();
   if (c instanceof TextField) ((TextField) c).selectAll();
 }
  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);
      }
    }
  }
Exemplo n.º 19
0
 public void focusLost(FocusEvent e) {
   if (!focusLostEvents) return;
   actionPerformed(new ActionEvent(e.getSource(), 0, "focusLost"));
 }