Package mdes.slick.sui

Examples of mdes.slick.sui.TextField


    /*
     * Set up the components
     */
    m_white = new Color(255, 255, 255);
   
    m_username = new TextField();
    m_username.setSize(132, 24);
    m_username.setLocation(128, 8);
    m_username.setVisible(true);
    this.add(m_username);
   
    m_password = new TextField();
    m_password.setSize(132, 24);
    m_password.setLocation(128, 40);
    m_password.setVisible(true);
    m_password.setMaskCharacter('*');
    m_password.setMaskEnabled(true);
 
View Full Code Here


   */
  private void initGUI(){
    m_ourPokes = new ToggleButton[6];
    m_theirPokes = new ToggleButton[6];
    m_theirPokeInfo = new PokemonInfoDialog[6];
    m_ourMoneyOffer = new TextField();
    m_makeOfferBtn = new Button();
    m_tradeBtn = new Button();
    m_cancelBtn = new Button();
   
    //Action Listener for the offer button
    m_offerListener = new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        if (m_makeOfferBtn.getText().equalsIgnoreCase("Make Offer")){
          if(m_ourMoneyOffer.getText().equals("") || m_ourMoneyOffer.getText() == null){
            m_ourMoneyOffer.setText("0");
          }
          makeOffer();
        }
        else {
          cancelOffer();
        }
      }
    };
   
    int x = 10, y = 10;
    for (int i = 0; i < 6; i++){
      //Show Our Pokemon for Trade
      m_ourPokes[i] = new ToggleButton();
      m_ourPokes[i].setSize(32, 32);
      m_ourPokes[i].setVisible(true);
      try {
        m_ourPokes[i].setImage(GameClient.getInstance().getOurPlayer()
            .getPokemon()[i].getIcon());
      } catch (NullPointerException e){
        m_ourPokes[i].setGlassPane(true);
      }
     
      getContentPane().add(m_ourPokes[i]);
      if (i < 3)
        m_ourPokes[i].setLocation(x, y);
      else
        m_ourPokes[i].setLocation(x + 40, y);
     
      //Show the Other Character's Pokemon for Trade
      m_theirPokes[i] = new ToggleButton();
      m_theirPokes[i].setSize(32, 32);
      m_theirPokes[i].setVisible(true);
      m_theirPokes[i].setGlassPane(true);
      getContentPane().add(m_theirPokes[i]);

      //Item Location Algorithms
      if (i < 3)
        m_theirPokes[i].setLocation(x + 178, y);
      else
        m_theirPokes[i].setLocation(x + 218, y);
   
      if (i == 2)
        y = 10;
      else
        y += 40;
    }
    m_ourPokes[0].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        if (m_offerNum == 0){
          m_offerNum = 6;
          untoggleOthers(6);
        } else {
          m_offerNum = 0;
          untoggleOthers(0);
        }
        m_makeOfferBtn.setEnabled(true);

      };
    });
    m_ourPokes[1].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        if (m_offerNum == 1){
          m_offerNum = 6;
          untoggleOthers(6);
        } else {
          m_offerNum = 1;
          untoggleOthers(1);
        }
        m_makeOfferBtn.setEnabled(true);

      };
    });
    m_ourPokes[2].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        if (m_offerNum == 2){
          m_offerNum = 6;
          untoggleOthers(6);
        } else {
          m_offerNum = 2;
          untoggleOthers(2);
        }
        m_makeOfferBtn.setEnabled(true);

      };
    });
    m_ourPokes[3].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        if (m_offerNum == 3){
          m_offerNum = 6;
          untoggleOthers(6);
        } else {
          m_offerNum = 3;
          untoggleOthers(3);
        }
        m_makeOfferBtn.setEnabled(true);

      };
    });
    m_ourPokes[4].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        if (m_offerNum == 4){
          m_offerNum = 6;
          untoggleOthers(6);
        } else {
          m_offerNum = 4;
          untoggleOthers(4);
        }
       
        m_makeOfferBtn.setEnabled(true);
      };
    });
    m_ourPokes[5].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        if (m_offerNum == 5){
          m_offerNum = 6;
          untoggleOthers(6);
        } else {
          m_offerNum = 5;
          untoggleOthers(5);
        }
       
        m_makeOfferBtn.setEnabled(true);
      };
    });
   
    //UI Buttons
    m_makeOfferBtn.setText("Make Offer");
    m_makeOfferBtn.setSize(90, 30);
    m_makeOfferBtn.setLocation(90, 10);
    m_makeOfferBtn.setEnabled(false);
    m_makeOfferBtn.addActionListener(m_offerListener);
    getContentPane().add(m_makeOfferBtn);
   
    m_tradeBtn.setText("Trade");
    m_tradeBtn.setEnabled(false);
    m_tradeBtn.setSize(90, 30);
    m_tradeBtn.setLocation(90, 50);
    m_tradeBtn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent evt) {
        ActionListener yes = new ActionListener(){
          public void actionPerformed(ActionEvent evt) {
            performTrade();
             getDisplay().remove(m_confirm);
            m_confirm = null;
            setVisible(false);
          }
       
        };
        ActionListener no = new ActionListener(){
          public void actionPerformed(ActionEvent evt) {
            m_confirm.setVisible(false);
            getDisplay().remove(m_confirm);
            m_confirm = null;
            setVisible(true);
          }
       
        };
        m_confirm = new ConfirmationDialog("Are you sure you want to trade?", yes, no);
        setVisible(false);
      }
    });
    getContentPane().add(m_tradeBtn);
   
    m_cancelBtn.setText("Cancel Trade");
    m_cancelBtn.setSize(90, 30);
    m_cancelBtn.setLocation(90, 90);
    m_cancelBtn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent evt) {
        cancelTrade();
      };
    });
    getContentPane().add(m_cancelBtn);
   
    //Our money trade info
    m_ourCashLabel = new Label("$");
    m_ourCashLabel.pack();
    m_ourCashLabel.setLocation(10, 130);
    getContentPane().add(m_ourCashLabel);
    m_ourMoneyOffer = new TextField();
    m_ourMoneyOffer.setSize(60, 20);
    m_ourMoneyOffer.setLocation(20, 128);
    getContentPane().add(m_ourMoneyOffer);
    //Their money trade info
    m_theirMoneyOffer = new Label("$0");
View Full Code Here

        m_servers[i].setForeground(m_black);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    privateIP = new TextField();
    privateIP.setLocation(16, 204);
    privateIP.setSize(128, 24);
    this.add(privateIP);
   
    privateServer = new Button();
View Full Code Here

    m_u.setLocation(4, 4);
    m_u.setFont(GameClient.getFontSmall());
    m_u.setForeground(m_white);
    this.add(m_u);
   
    m_username = new TextField();
    m_username.setSize(128, 24);
    m_username.setLocation(4, 24);
    m_username.setVisible(true);
    m_username.grabFocus();
    this.add(m_username);
   
    m_p = new Label(translated.get(6));
    m_p.pack();
    m_p.setLocation(4, 52);
    m_p.setFont(GameClient.getFontSmall());
    m_p.setForeground(m_white);
    this.add(m_p);
   
    m_password = new TextField();
    m_password.setSize(128, 24);
    m_password.setLocation(4, 72);
    m_password.setMaskCharacter('*');
    m_password.setMaskEnabled(true);
    m_password.setVisible(true);
    this.add(m_password);
   
    m_cp = new Label(translated.get(10));
    m_cp.pack();
    m_cp.setLocation(4, 100);
    m_cp.setFont(GameClient.getFontSmall());
    m_cp.setForeground(m_white);
    this.add(m_cp);
   
    m_confirmPass = new TextField();
    m_confirmPass.setSize(128, 24);
    m_confirmPass.setLocation(4, 122);
    m_confirmPass.setMaskCharacter('*');
    m_confirmPass.setMaskEnabled(true);
    m_confirmPass.setVisible(true);
    this.add(m_confirmPass);
   
    m_d = new Label(translated.get(11));
    m_d.pack();
    m_d.setLocation(4, 152);
    m_d.setFont(GameClient.getFontSmall());
    m_d.setForeground(m_white);
    this.add(m_d);
   
    m_day = new TextField();
    m_day.setSize(32, 24);
    m_day.setLocation(4, 172);
    m_day.setVisible(true);
    this.add(m_day);
   
    m_month = new TextField();
    m_month.setSize(32, 24);
    m_month.setLocation(40, 172);
    m_month.setVisible(true);
    this.add(m_month);
   
    m_year = new TextField();
    m_year.setSize(52, 24);
    m_year.setLocation(76, 172);
    m_year.setVisible(true);
    this.add(m_year);
   
    m_e = new Label(translated.get(12));
    m_e.pack();
    m_e.setLocation(4, 202);
    m_e.setFont(GameClient.getFontSmall());
    m_e.setForeground(m_white);
    this.add(m_e);
   
    m_email = new TextField();
    m_email.setSize(128, 24);
    m_email.setLocation(4, 220);
    m_email.setVisible(true);
    this.add(m_email);
   
    m_ce = new Label(translated.get(13));
    m_ce.pack();
    m_ce.setLocation(4, 248);
    m_ce.setFont(GameClient.getFontSmall());
    m_ce.setForeground(m_white);
    this.add(m_ce);
   
    m_confirmEmail = new TextField();
    m_confirmEmail.setSize(128, 24);
    m_confirmEmail.setLocation(4, 268);
    m_confirmEmail.setVisible(true);
    this.add(m_confirmEmail);
   
View Full Code Here

TOP

Related Classes of mdes.slick.sui.TextField

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.