Package mdes.slick.sui.event

Examples of mdes.slick.sui.event.ActionListener


        m_itemButtons[i].setLocation(0,(m_itemButtons[i-1].getY()+51));
      else
        m_itemButtons[i].setLocation(0,0);
      m_itemButtons[i].setZIndex(0);
      m_itemButtons[i].setFont(GameClient.getFontLarge());
      m_itemButtons[i].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          itemClicked(itemChosen);
        }
      });
      getContentPane().add(m_itemButtons[i]);
      String respath = System.getProperty("res.path");
      if(respath==null)
        respath="";
      try{
        LoadingList.setDeferredLoading(true);
        m_itemPics[i] = new Label(new Image(FileLoader.loadFile(respath+"res/items/24/" + m_items.get(i).getId() + ".png"),
            respath+"res/items/24/" + m_items.get(i).getId() + ".png", false));
        LoadingList.setDeferredLoading(false);
        m_itemPics[i].setGlassPane(true);
        m_itemPics[i].setSize(32,32);
        if(i>0)
          m_itemPics[i].setLocation(0,(m_itemPics[i-1].getY()+51));
        else
          m_itemPics[i].setLocation(0,12);
        m_itemPics[i].setZIndex(1000);
        getContentPane().add(m_itemPics[i]);
      }catch(Exception e){
        e.printStackTrace();
      }
     
      try{
        LoadingList.setDeferredLoading(true);
        String stock = "empty";
        if(m_stock.get(m_items.get(i).getId()) >= 100 || m_items.size() == -1){
          stock = "full";
        } else if (m_stock.get(m_items.get(i).getId()) < 100 && m_stock.get(m_items.get(i).getId()) >= 60){
          stock = "half";
        } else if (m_stock.get(m_items.get(i).getId()) < 60 && m_stock.get(m_items.get(i).getId()) >= 30){
          stock = "halfempty";
        }
        m_itemStockPics[i] = new Label(new Image(FileLoader.loadFile(respath+"res/ui/shop/"+stock+".png"),
            respath+"res/ui/shop/"+stock+".png", false));
        LoadingList.setDeferredLoading(false);
        m_itemStockPics[i].setGlassPane(true);
        m_itemStockPics[i].setSize(32,32);
        if(i>0)
          m_itemStockPics[i].setLocation(260,(m_itemStockPics[i-1].getY()+51));
        else
          m_itemStockPics[i].setLocation(260,12);
        m_itemStockPics[i].setZIndex(1000);
        getContentPane().add(m_itemStockPics[i]);
      }catch(Exception e){
        e.printStackTrace();
      }
     
      m_itemLabels[i] = new Label(m_items.get(i).getName()+" - $"+m_items.get(i).getPrice());
      m_itemLabels[i].setSize(200,50);
      m_itemLabels[i].setFont(GameClient.getFontLarge());
      m_itemLabels[i].setZIndex(1200);
      m_itemLabels[i].setHorizontalAlignment(0);
      m_itemLabels[i].addMouseListener(new MouseListener() {
        boolean entered = false;
        public void mouseReleased(MouseEvent arg0) {
          if(entered)
            itemClicked(itemChosen);
          m_itemButtons[buttonNumber].setEnabled(true);
        }
       
        public void mousePressed(MouseEvent arg0) {
          m_itemButtons[buttonNumber].setEnabled(false);
        }
       
        public void mouseMoved(MouseEvent arg0) {}
       
        public void mouseExited(MouseEvent arg0) {
          entered = false;
        }
       
        public void mouseEntered(MouseEvent arg0) {
          entered = true;   
        }
       
        public void mouseDragged(MouseEvent arg0) {}
      });
      if(i>0)
        m_itemLabels[i].setLocation(30,(m_itemLabels[i-1].getY()+51));
      else
        m_itemLabels[i].setLocation(30,0);
      m_itemLabels[i].updateAppearance();
      getContentPane().add(m_itemLabels[i]);
    }
   
    m_cancel = new Button("Cancel");
    m_cancel.setSize(300,40);
    m_cancel.setLocation(0,336);
    m_cancel.setFont(GameClient.getFontLarge());
    m_cancel.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        for(int i=0;i<m_itemButtons.length;i++){
          getContentPane().remove(m_itemButtons[i]);
        }
        for(int i=0;i<m_itemPics.length;i++){
          getContentPane().remove(m_itemPics[i]);
        }
        for(int i=0;i<m_itemLabels.length;i++){
          getContentPane().remove(m_itemLabels[i]);
        }
        for(int i=0;i<m_itemStockPics.length;i++){
          getContentPane().remove(m_itemStockPics[i]);
        }
        getContentPane().remove(m_cancel);
        buyGUI();
      }
    });
    getContentPane().add(m_cancel);
   
    this.getResizer().setVisible(false);
    getCloseButton().addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cancelled();
          }
        });
   
View Full Code Here


          m_itemButtons[i].add(m_itemIcon[i]);
        } catch (Exception e1) {
//          e1.printStackTrace();
        }
        LoadingList.setDeferredLoading(false);
            m_itemButtons[i].addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                itemClicked(m_items.get(j));
              }
            });
            add(m_itemButtons[i]);
          }
          m_bag = new Button("Bag");
          m_bag.setToolTipText("Opens the Bag to see your items");
          m_bag.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              loadBag();
            }
          });
          add(m_bag);
         
          m_cancel = new Button("Cancel");
          m_cancel.setToolTipText("Closes this dialog");
          m_cancel.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              cancelled();
            }
          });
          add(m_cancel);
View Full Code Here

    m_chatWidget.setForeColor(m_foreColor);
    getContentPane().add(m_chatWidget);

    // Input box
    getContentPane().add(m_inputBox);
    m_inputBox.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        chatTypeActionPerformed(evt);
      }
    });
    m_inputBox.grabFocus();
View Full Code Here

    this.add(m_g);
   
    m_male = new Button(translated.get(16));
    m_male.setSize(64, 24);
    m_male.setLocation(170, 150);
    m_male.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        m_female.setEnabled(true);
        m_gender = 0;
        m_male.setEnabled(false);
      }
    });
    this.add(m_male);
   
    m_female = new Button(translated.get(17));
    m_female.setSize(64, 24);
    m_female.setLocation(234, 150);
    m_female.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        m_female.setEnabled(false);
        m_gender = 1;
        m_male.setEnabled(true);
      }
    });
    this.add(m_female);
   
    m_reg = new Label("Starting Region:");
    m_reg.setFont(GameClient.getFontSmall());
    m_reg.setForeground(m_white);
    m_reg.pack();
    m_reg.setLocation(170, 182);
    m_reg.setVisible(true);
    this.add(m_reg);
   
    /* Generate region selection */
    m_regions = new Button[4];
    m_regions[0] = new Button("Kanto");
    m_regions[0].setSize(64, 24);
    m_regions[0].setLocation(170, 206);
    m_regions[0].setToolTipText("A town-filled region\nconnected to the\neast of Johto");
    m_regions[0].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        m_region = 0;
        m_regions[0].setEnabled(false);
        m_regions[1].setEnabled(true);
        m_regions[2].setEnabled(false);
        m_regions[3].setEnabled(false);
      }
    });
    m_regions[0].setVisible(true);
    this.add(m_regions[0]);
   
    m_regions[1] = new Button("Johto");
    m_regions[1].setSize(64, 24);
    m_regions[1].setLocation(234, 206);
    m_regions[1].setToolTipText("A city-filled\nregion connected\nto the west\nof Kanto");
    m_regions[1].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        m_region = 1;
        m_regions[0].setEnabled(true);
        m_regions[1].setEnabled(false);
        m_regions[2].setEnabled(false);
        m_regions[3].setEnabled(false);
      }
    });
    m_regions[1].setVisible(true);
    this.add(m_regions[1]);
   
    m_regions[2] = new Button("Hoenn");
    m_regions[2].setSize(64, 24);
    m_regions[2].setLocation(170, 230);
    m_regions[2].setToolTipText("An island region\nsouth-west\nof Johto");
    m_regions[2].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        m_region = 0;
        m_regions[0].setEnabled(false);
        m_regions[1].setEnabled(false);
        m_regions[2].setEnabled(false);
        m_regions[3].setEnabled(false);
      }
    });
    m_regions[2].setVisible(true);
    m_regions[2].setEnabled(false);
    this.add(m_regions[2]);
   
    m_regions[3] = new Button("Sinnoh");
    m_regions[3].setSize(64, 24);
    m_regions[3].setLocation(234, 230);
    m_regions[3].setToolTipText("A mountainous\nregion north\nof Kanto");
    m_regions[3].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        m_region = 0;
        m_regions[0].setEnabled(false);
        m_regions[1].setEnabled(false);
        m_regions[2].setEnabled(false);
        m_regions[3].setEnabled(false);
      }
    });
    m_regions[3].setVisible(true);
    m_regions[3].setEnabled(false);
    this.add(m_regions[3]);
   
    m_tos = new Label(translated.get(18));
    m_tos.pack();
    m_tos.setLocation(172, 256);
    m_tos.setFont(GameClient.getFontSmall());
    m_tos.setForeground(m_white);
    this.add(m_tos);
   
    m_terms = new Button(translated.get(19));
    m_terms.setSize(128, 24);
    m_terms.setLocation(170, 276);
    m_terms.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        m_terms.setEnabled(false);
      }
    });
    this.add(m_terms);
   
    m_register = new Button(translated.get(8));
    m_register.setSize(64, 24);
    m_register.setLocation(96, 308);
    m_register.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        register();
      }
    });
    this.add(m_register);
   
    m_cancel = new Button(translated.get(20));
    m_cancel.setSize(64, 24);
    m_cancel.setLocation(160, 308);
    m_cancel.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        cancel();
      }
    });
    this.add(m_cancel);
View Full Code Here

      }
      f = FileLoader.loadFile(respath+"res/pokemon/icons/001.gif");
      m_starters[0].setImage(new Image(f, respath+"res/pokemon/icons/001.gif", false));
      m_starters[0].setDisabledImage(new Image(f, respath+"res/pokemon/icons/001.gif", false));
      m_starters[0].setLocation(160, 24);
      m_starters[0].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 1;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[0]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/152.gif");
      m_starters[1].setImage(new Image(f, respath+"res/pokemon/icons/152.gif", false));
      m_starters[1].setDisabledImage(new Image(f, respath+"res/pokemon/icons/152.gif", false));
      m_starters[1].setLocation(192, 24);
      m_starters[1].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 152;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[1]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/252.gif");
      m_starters[2].setImage(new Image(f, respath+"res/pokemon/icons/252.gif", false));
      m_starters[2].setDisabledImage(new Image(f, respath+"res/pokemon/icons/252.gif", false));
      m_starters[2].setLocation(224, 24);
      m_starters[2].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 252;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[2]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/387.gif");
      m_starters[3].setImage(new Image(f, respath+"res/pokemon/icons/387.gif", false));
      m_starters[3].setDisabledImage(new Image(f, respath+"res/pokemon/icons/387.gif", false));
      m_starters[3].setLocation(256, 24);
      m_starters[3].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 387;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[3]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/004.gif");
      m_starters[4].setImage(new Image(f, respath+"res/pokemon/icons/004.gif", false));
      m_starters[4].setDisabledImage(new Image(f, respath+"res/pokemon/icons/004.gif", false));
      m_starters[4].setLocation(160, 56);
      m_starters[4].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 4;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[4]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/155.gif");
      m_starters[5].setImage(new Image(f, respath+"res/pokemon/icons/155.gif", false));
      m_starters[5].setDisabledImage(new Image(f, respath+"res/pokemon/icons/155.gif", false));
      m_starters[5].setLocation(192, 56);
      m_starters[5].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 155;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[5]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/255.gif");
      m_starters[6].setImage(new Image(f, respath+"res/pokemon/icons/255.gif", false));
      m_starters[6].setDisabledImage(new Image(f, respath+"res/pokemon/icons/255.gif", false));
      m_starters[6].setLocation(224, 56);
      m_starters[6].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 255;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[6]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/390.gif");
      m_starters[7].setImage(new Image(f, respath+"res/pokemon/icons/390.gif", false));
      m_starters[7].setDisabledImage(new Image(f, respath+"res/pokemon/icons/390.gif", false));
      m_starters[7].setLocation(256, 56);
      m_starters[7].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 390;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[7]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/007.gif");
      m_starters[8].setImage(new Image(f, respath+"res/pokemon/icons/007.gif", false));
      m_starters[8].setDisabledImage(new Image(f, respath+"res/pokemon/icons/007.gif", false));
      m_starters[8].setLocation(160, 88);
      m_starters[8].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 7;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[8]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/158.gif");
      m_starters[9].setImage(new Image(f, respath+"res/pokemon/icons/158.gif", false));
      m_starters[9].setDisabledImage(new Image(f, respath+"res/pokemon/icons/158.gif", false));
      m_starters[9].setLocation(192, 88);
      m_starters[9].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 158;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[9]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/258.gif");
      m_starters[10].setImage(new Image(f, respath+"res/pokemon/icons/258.gif", false));
      m_starters[10].setDisabledImage(new Image(f, respath+"res/pokemon/icons/258.gif", false));
      m_starters[10].setLocation(224, 88);
      m_starters[10].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 258;
          selectStarter(m_starter);
        }
      });
      this.add(m_starters[10]);
     
      f = FileLoader.loadFile(respath+"res/pokemon/icons/393.gif");
      m_starters[11].setImage(new Image(f, respath+"res/pokemon/icons/393.gif", false));
      m_starters[11].setDisabledImage(new Image(f, respath+"res/pokemon/icons/393.gif", false));
      m_starters[11].setLocation(256, 88);
      m_starters[11].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          m_starter = 393;
          selectStarter(m_starter);
        }
      });
View Full Code Here

    getTitleBar().setVisible(false);
    setVisible(true);
    setResizable(false);
    setAlwaysOnTop(true);
   
    m_battle.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        GameClient.getInstance().getPacketGenerator().writeTcpMessage("rb" + m_name.getText());
        destroy();
      }
    });
    m_trade.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        GameClient.getInstance().getPacketGenerator().writeTcpMessage("rt" + m_name.getText());
        destroy();
      }
    });
    m_whisper.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        GameClient.getInstance().getUi().getChat().addChat(m_name.getText(), true);
        destroy();
      }
    });
    m_addFriend.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        GameClient.getInstance().getPacketGenerator().writeTcpMessage("Fa" + m_name.getText());
        GameClient.getInstance().getUi().getFriendsList().addFriend(m_name.getText());
        destroy();
      }
    });
    m_cancel.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        destroy();
      }
    });
  }
View Full Code Here

              final Label m_label = new Label(m_offerUser.get(i));
              final Button m_offerBtn = m_offers.get(m_offerUser.get(i));
              final Button m_cancel = new Button("Cancel");
              m_cancel.setHeight(25);
              m_cancel.setWidth(45);
              m_cancel.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent e) {
                  declineOffer(j);
                }
              });
              m_label.setFont(GameClient.getFontSmall());
              m_label.setForeground(Color.white);
              m_label.pack();
              m_label.setY((float)10 - m_label.getTextHeight() / 2);
              m_offerBtn.setHeight(25);
              m_offerBtn.setX(getWidth() - 92);
              m_offerBtn.setWidth(45);
              m_offerBtn.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent e) {
                  acceptOffer(j);
                }
              });
              m_containers.add(new Container());
View Full Code Here

     
      m_languages[0] = new Button("English");
      m_languages[0].setSize(280, 24);
      m_languages[0].setLocation(30, 42);
      m_languages[0].setVisible(true);
      m_languages[0].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          GameClient.setLanguage("english");
        }
      });
      this.add(m_languages[0]);
     
      m_languages[1] = new Button("Espanol");
      m_languages[1].setSize(280, 24);
      m_languages[1].setLocation(30, 70);
      m_languages[1].setVisible(true);
      m_languages[1].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          GameClient.setLanguage("spanish");
        }
      });
      this.add(m_languages[1]);
     
      m_languages[2] = new Button("Francais");
      m_languages[2].setSize(280, 24);
      m_languages[2].setLocation(30, 98);
      m_languages[2].setVisible(true);
      m_languages[2].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          GameClient.setLanguage("french");
        }
      });
      this.add(m_languages[2]);
     
      m_languages[3] = new Button("Portugues");
      m_languages[3].setSize(280, 24);
      m_languages[3].setLocation(30, 126);
      m_languages[3].setVisible(true);
      m_languages[3].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          GameClient.setLanguage("portuguese");
         
        }
      });
      this.add(m_languages[3]);
     
      m_languages[4] = new Button("Suomi");
      m_languages[4].setSize(280, 24);
      m_languages[4].setLocation(30, 154);
      m_languages[4].setVisible(true);
      m_languages[4].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          GameClient.setLanguage("finnish");
         
        }
      });
      this.add(m_languages[4]);
     
      m_languages[5] = new Button("Italiano");
      m_languages[5].setSize(280, 24);
      m_languages[5].setLocation(30, 182);
      m_languages[5].setVisible(true);
      m_languages[5].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          GameClient.setLanguage("italian");
         
        }
      });
      this.add(m_languages[5]);
     
      m_languages[6] = new Button("Nederlands");
      m_languages[6].setSize(280, 24);
      m_languages[6].setLocation(30, 210);
      m_languages[6].setVisible(true);
      m_languages[6].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          GameClient.setLanguage("dutch");
         
        }
      });
      this.add(m_languages[6]);
     
      m_languages[7] = new Button("Deutsch");
      m_languages[7].setSize(280, 24);
      m_languages[7].setLocation(30, 238);
      m_languages[7].setVisible(true);
      m_languages[7].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
          GameClient.setLanguage("german");
         
        }
      });
View Full Code Here

TOP

Related Classes of mdes.slick.sui.event.ActionListener

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.