Package java.awt.event

Examples of java.awt.event.FocusListener


        assertSame(border, b.getBorder());
    }

    public void testToolBarFocusListener() {
        toolBar.add(b);
        FocusListener l = ui.createToolBarFocusListener();
        FocusEvent e = new FocusEvent(b, FocusEvent.FOCUS_GAINED);
        l.focusGained(e);
        assertEquals(toolBar.getComponentIndex(b), ui.focusedCompIndex);
    }
View Full Code Here


        Component c = parent.getComponent(row * cols + col);
        return layout.getConstraints(c);
    }
   
    public static void addPlaceHolder(final JTextField field,final String placeHolderText){
      field.addFocusListener(new FocusListener(){
        private Color fontColor=field.getForeground();
//        private String previousText=field.getText();
       
      public void focusGained(FocusEvent arg0) {
        if (field.getText().equals(placeHolderText)){
View Full Code Here

                }
            }
        });

        // Suchfeld
        this.searchField.addFocusListener(new FocusListener() {

            @Override
            public void focusGained(FocusEvent e) {
                searchField.setSelectionStart(0);
                searchField.setSelectionEnd(searchField.toString().length());
View Full Code Here

        }
       
        super.addImpl(comp, constraints, index);

        // TF:22/8/07:Moved this here from CompoundFieldFactory
        comp.addFocusListener(new FocusListener() {
            public void focusGained(FocusEvent e) {
                EventManager.startEventChain();
                int reason = ForteKeyboardFocusManager.getTraversalReason();
                if (reason != Constants.FC_SUPRESS) {
                    Hashtable<String, Object> params = new Hashtable<String, Object>();
View Full Code Here

        }
       
        super.addImpl(comp, constraints, index);

        // TF:22/8/07:Moved this here from CompoundFieldFactory
        comp.addFocusListener(new FocusListener() {
            public void focusGained(FocusEvent e) {
                EventManager.startEventChain();
                int reason = ForteKeyboardFocusManager.getTraversalReason();
                if (reason != Constants.FC_SUPRESS) {
                    Hashtable<String, Object> params = new Hashtable<String, Object>();
View Full Code Here

    lblChkMember = new Label("Choose Member or Non-Member:");
    lblChkMember.setFont(f);

    txtMemberId = new TextField(15);
    FocusListener l = new FocusListener() {

      public void focusGained(FocusEvent e) {
        // TODO Auto-generated method stub

      }

      public void focusLost(FocusEvent e) {
        String id = txtMemberId.getText().trim();
        if (id.length() != 0) {
          try {

            member = appController.selectMember(id);
            if (member != null) {
              int point = appController.getMemberPoint(id);
              setlblDeemValue(Integer.toString(point));
            } else {
              MessageDialog m = new MessageDialog(mainForm,
                  "No Member", "This MemberID is not exist.");
              m.setResizable(false);
              m.setVisible(true);
              txtMemberId.setText("");
            }
          } catch (AppException ex) {
            MessageDialog m = new MessageDialog(mainForm,
                "Error Loading Category", ex.getMessage());
            m.setResizable(false);
            m.setVisible(true);
          }
        }
      }

    };
    txtMemberId.addFocusListener(l);

    txtBarCode = new TextField(15);
    txtQty = new TextField(3);

    txtDeemUsed = new TextField(3);
    l = new FocusListener() {

      public void focusGained(FocusEvent arg0) {
       
       
      }

      public void focusLost(FocusEvent arg0) {
        try {

          if (checkDeemPointAmt() == true)
            Calculate();
        } catch (Exception e) {
          MessageDialog m = new MessageDialog(mainForm,
              "Wrong Input Format", "Deem point must be Number.");
          m.setResizable(false);
          m.setVisible(true);
          txtDeemUsed.setText("0");
        }

      }
     
    };
    txtDeemUsed.addFocusListener(l);
   
    txtPaymentAmt = new TextField(10);
    l = new FocusListener() {

      public void focusGained(FocusEvent arg0) {
        // TODO Auto-generated method stub
       
      }

      public void focusLost(FocusEvent arg0) {
        String pay = txtPaymentAmt.getText().trim();
        if (pay.length() != 0) {
          try {
            float payment = Float.parseFloat(pay);
            float refund = 0.0f;
            if (payment > grandtotal) {
              refund = calulateRefund(payment);
            } else if (payment < grandtotal) {
              MessageDialog m = new MessageDialog(mainForm,
                  "Invalid Payment",
                  "Payment Amount must be greater than Grandtotal.");
              m.setResizable(false);
              m.setVisible(true);
              txtPaymentAmt.setText("0");
            }
            lblRefundValue.setText(Float.toString(refund));
          } catch (Exception e) {
            MessageDialog m = new MessageDialog(mainForm,
                "Wrong Input Format",
                "Payment Amount must be Number.");
            m.setResizable(false);
            m.setVisible(true);
          }
        }
       
      }
   
    };
    txtPaymentAmt.addFocusListener(l);

    lblDiscountValue = new Label();

    lblPaymentAmt = new Label("Payment Amt");
    lblPaymentAmt.setFont(f);

    lblRefund = new Label("Refund");
    lblRefund.setFont(f);
    lblRefundValue = new Label();

    txtDeemUsed.setText("0");
    txtDeemUsed.setEnabled(false);
    l = new FocusListener() {

      public void focusGained(FocusEvent arg0) {
        // TODO Auto-generated method stub
       
      }
View Full Code Here

            Dimension dimTexto = new Dimension(355,22);
            Dimension dimTexto2 = new Dimension(355,88);
            Dimension dimTipo = new Dimension(120,22);
            Dimension dimTipo2 = new Dimension(88,22);
           
            FocusListener flTextField = new FocusListener(){
                public void focusGained(FocusEvent e) {
                    ((JTextField)e.getSource()).selectAll();
                }

                public void focusLost(FocusEvent e) {
                }
            };

            FocusListener flTextArea = new FocusListener(){
                public void focusGained(FocusEvent e) {
                }

                public void focusLost(FocusEvent e) {
                    String cadena = ((JTextArea)e.getSource()).getText();
View Full Code Here

        }
       
        super.addImpl(comp, constraints, index);

        // TF:22/8/07:Moved this here from CompoundFieldFactory
        comp.addFocusListener(new FocusListener() {
            public void focusGained(FocusEvent e) {
                EventManager.startEventChain();
                int reason = ForteKeyboardFocusManager.getTraversalReason();
                if (reason != Constants.FC_SUPRESS) {
                    Hashtable<String, Object> params = new Hashtable<String, Object>();
View Full Code Here

      @Override
      public void changedUpdate(DocumentEvent e) {
      }
    });
    area.addFocusListener(new FocusListener() {
      @Override
      public void focusGained(FocusEvent e) {
        overlayTextArea.setOverlayVisible(false);
      }
View Full Code Here

      });
       room = new JTextField(Preferences.getString(
          "groupchatalerter","room"+ruleBlockNo,null));
       rule = new JTextField(Preferences.getString(
          "groupchatalerter","rule"+ruleBlockNo,null));
       rule.addFocusListener(new FocusListener()
      {
         private String ruleText;
        
        public void focusLost(FocusEvent e)
        {
View Full Code Here

TOP

Related Classes of java.awt.event.FocusListener

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.