Package mdes.slick.sui.event

Examples of mdes.slick.sui.event.ActionListener


   */
  public void startButtons(){
    m_buttons = new ImageButton[8];
   
    m_buttons[0] = HUDButtonFactory.getButton("stats");
        m_buttons[0].addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            toggleStats();
          }
        });
        m_buttons[0].setToolTipText("Stats");
   
        m_buttons[1] = HUDButtonFactory.getButton("pokemon");
        m_buttons[1].addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            togglePokemon();
          }
        });
        m_buttons[1].setToolTipText("Pokemon");

    m_buttons[2] = HUDButtonFactory.getButton("bag");
        m_buttons[2].addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            toggleBag();
          }
        });
        m_buttons[2].setToolTipText("Bag");

    m_buttons[3] = HUDButtonFactory.getButton("map");
        m_buttons[3].addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            toggleMap();
          }
        });
        m_buttons[3].setToolTipText("Map");

        m_buttons[4] = HUDButtonFactory.getButton("friends");
    m_buttons[4].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        toggleFriends();
      }
    });
    m_buttons[4].setToolTipText("Friends");
       
        m_buttons[5] = HUDButtonFactory.getButton("requests");
    m_buttons[5].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        toggleRequests();
      }
    });
    m_buttons[5].setToolTipText("Requests");

    m_buttons[6] = HUDButtonFactory.getButton("options");
    m_buttons[6].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        toggleOptions();
      }
    });
    m_buttons[6].setToolTipText("Options");
   
        m_buttons[7] = HUDButtonFactory.getButton("help");
        m_buttons[7].addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            toggleHelp();
          }
        });
        m_buttons[7].setToolTipText("Help");
View Full Code Here


     * A pokemon wants to evolve
     * @param pokeIndex
     */
    public void tryEvolve(int pokeIndex) {
      final int index = pokeIndex;
      ActionListener yes = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          GameClient.getInstance().getPacketGenerator().writeTcpMessage("Pe1" + index);
          GameClient.getInstance().getDisplay().remove(m_evolveDialog);
        }
      };
      ActionListener no = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          GameClient.getInstance().getPacketGenerator().writeTcpMessage("Pe0" + index);
          GameClient.getInstance().getDisplay().remove(m_evolveDialog);
        }
      };
View Full Code Here

   */
  public ComboBox(){
    m_this = this;
    m_elements = new ArrayList<String>();
    m_arrow = new SimpleArrowButton(SimpleArrowButton.DOWN);
    m_arrow.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        if (m_itemSelector == null) {
          m_itemSelector = new ItemSelector(m_this, 6, m_elements.toArray(new String
              [m_elements.size()]), (int)getWidth(), (int)m_arrow.getWidth());
          m_itemSelector.setLocation(getAbsoluteX(), getAbsoluteY() - 5);
View Full Code Here

    for (int i = 0; i < m_amountShown; i++){
      m_shownItems[i] = new Label();
    }

    m_up = new SimpleArrowButton(SimpleArrowButton.FACE_UP);
    m_up.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        scroll(-1);
      }
    });
    m_up.setEnabled(false);
    m_up.setSize(buttonWidth, buttonWidth);
    m_up.setLocation(width - buttonWidth, 0);
   
    m_down = new SimpleArrowButton(SimpleArrowButton.FACE_DOWN);
    if (m_items.length <= m_amountShown)
      m_down.setEnabled(false);
    m_down.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        scroll(1);
      }
    });
    m_down.setSize(buttonWidth, buttonWidth);
View Full Code Here

    int buttonCount = 0;

    for (int i = 0; i <= 29; i++) {
      m_buttons[i] = new ToggleButton();
      final int j = i;
      m_buttons[i].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
          setChoice(j);
        }
      });
      m_buttons[i].setSize(32, 32);
    }

    for (int row = 0; row < 5; row++) {
      for (int column = 0; column < 6; column++) {
        m_buttons[buttonCount].setLocation(buttonX, buttonY);
        buttonX += 37;
        buttonCount += 1;
      }
      buttonX = 7;
      buttonY += 37;
    }

    for (int i = 0; i <= 29; i++) {
      add(m_buttons[i]);
    }

    m_switchPoke = new Button();
    m_close = new Button();
    m_changeBox = new ComboBox();
    m_release = new Button();

    m_switchPoke.setText("Switch");
    m_switchPoke.pack();
    m_switchPoke.setLocation(5, 192);
    m_switchPoke.setEnabled(false);
    m_switchPoke.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        setVisible(false);
        TeamForBox teamPanel = new TeamForBox(m_boxNum, m_buttonChosen);
        getDisplay().add(teamPanel);
        teamPanel.setLocation(getDisplay().getWidth() / 2
            - teamPanel.getWidth() / 2, getDisplay().getHeight()
            / 2 - teamPanel.getHeight() / 2);
      }
    });

    m_changeBox.addElement("Box 1");
    m_changeBox.addElement("Box 2");
    m_changeBox.addElement("Box 3");
    m_changeBox.addElement("Box 4");
    m_changeBox.addElement("Box 5");
    m_changeBox.addElement("Box 6");
    m_changeBox.addElement("Box 7");
    m_changeBox.addElement("Box 8");
    m_changeBox.addElement("Box 9");
   
    m_changeBox.setSize(55, 15);
    m_changeBox.setLocation(m_switchPoke.getX() + m_switchPoke.getWidth(),
        197);

    m_release.setText("Release");
    m_release.pack();
    m_release.setLocation(m_changeBox.getX() + m_changeBox.getWidth(), 192);
    m_release.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        setVisible(false);

        final Frame confirm = new Frame("Release");
        confirm.getCloseButton().setVisible(false);

        confirm.setResizable(false);
        confirm.setSize(370, 70);
        confirm.setLocationRelativeTo(null);
        Label yousure = new Label(
            "Are you sure you want to release your Pokemon?");
        yousure.pack();
        Button yes = new Button("Release");
        yes.pack();
        yes.setLocation(0, confirm.getHeight()
            - confirm.getTitleBar().getHeight() - yes.getHeight());
        yes.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            confirm.setVisible(false);
            getDisplay().remove(confirm);

            GameClient.getInstance().getPacketGenerator().writeTcpMessage(
                "BR" + m_boxIndex + "," + m_buttonChosen);

            GameClient.getInstance().getPacketGenerator().writeTcpMessage("Bf");
            GameClient.getInstance().getUi().stopUsingBox();
          }
        });
        Button no = new Button("Keep");
        no.pack();
        no.setLocation(yes.getWidth(), confirm.getHeight()
            - confirm.getTitleBar().getHeight() - no.getHeight());
        no.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            confirm.setVisible(false);
            getDisplay().remove(confirm);

            GameClient.getInstance().getPacketGenerator().writeTcpMessage("Bf");
            GameClient.getInstance().getUi().stopUsingBox();

          }
        });
        confirm.getContentPane().add(yousure);
        confirm.getContentPane().add(yes);
        confirm.getContentPane().add(no);

        getDisplay().add(confirm);
      }
    });
    m_release.setEnabled(false);

    m_close.setText("Bye");
    m_close.pack();
    m_close.setLocation(m_release.getX() + m_release.getWidth(), 192);
    m_close.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        setVisible(false);
        GameClient.getInstance().getPacketGenerator().writeTcpMessage("Bf");
        GameClient.getInstance().getUi().stopUsingBox();
      }
View Full Code Here

    }
    m_accept.setSize(80, 30);
    m_accept.setLocation(3, 245);
    m_accept.setText("Accept");
    m_accept.setEnabled(false);
    m_accept.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        switchPokes(m_boxNumber, m_boxIndex, m_teamIndex);
        GameClient.getInstance().getPacketGenerator().writeTcpMessage("Bf");
        GameClient.getInstance().getUi().stopUsingBox();
        setVisible(false);
      }
    });
    add(m_accept);
    m_cancel.setSize(80, 30);
    m_cancel.setLocation(86, 245);
    m_cancel.setText("Cancel");
    m_cancel.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        GameClient.getInstance().getPacketGenerator().writeTcpMessage("Bf");
        GameClient.getInstance().getUi().stopUsingBox();
        setVisible(false);
      }
View Full Code Here

      m_level[i] = new Label();
      m_hp[i] = new ProgressBar(0, 0);
      m_hp[i].setForeground(Color.green);

      final int j = i;
      m_pokeIcon[i].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
          setChoice(j);
        }
      });
View Full Code Here

  public void initGUI(){
    m_buy = new Button("Buy");
    m_buy.setLocation(0,0);
    m_buy.setSize(150,320);
    m_buy.setFont(GameClient.getFontLarge());
    m_buy.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        buyGUI();
      }
    });
    getContentPane().add(m_buy);
   
    m_sell = new Button("Sell");
    m_sell.setLocation(151,0);
    m_sell.setSize(150,320);
    m_sell.setFont(GameClient.getFontLarge());
    m_sell.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        sellGUI();
      }
    });
    getContentPane().add(m_sell);
   
    m_cancel = new Button("Cancel");
    m_cancel.setSize(300,56);
    m_cancel.setLocation(0,321);
    m_cancel.setFont(GameClient.getFontLarge());
    m_cancel.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        cancelled();
      }
    });
    getContentPane().add(m_cancel);
    this.getResizer().setVisible(false);
    getCloseButton().addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cancelled();
          }
        }
    );
View Full Code Here

    m_sellButton = new Button[1];
    m_sellButton[0] = new Button("Sell");
    m_sellButton[0].setFont(GameClient.getFontLarge());
    m_sellButton[0].setSize(getWidth(), 35);
    m_sellButton[0].setLocation(0, m_cancel.getY() - 35);
    m_sellButton[0].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e){
        try{
        final ConfirmationDialog m_confirm = new ConfirmationDialog("Are you sure you want to sell "
            + m_sellList.getSelectedName() + " for $" + (ItemDatabase.getInstance().getItem(
                m_sellList.getSelectedName()).getPrice() / 2) + "?");
        m_confirm.addYesListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){
            GameClient.getInstance().getPacketGenerator().writeTcpMessage("Ss" + ItemDatabase.getInstance()
                .getItem(m_sellList.getSelectedName()).getId() + ",");
            GameClient.getInstance().getDisplay().remove(m_confirm);
          }
        });
        m_confirm.addNoListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){
            GameClient.getInstance().getDisplay().remove(m_confirm);
          }
        });
        } catch (Exception e2) {e2.printStackTrace();}
View Full Code Here

    }
    LoadingList.setDeferredLoading(false);
    m_categoryButtons[0].setSize(150, 160);
    m_categoryButtons[0].setLocation(0,0);
    m_categoryButtons[0].setFont(GameClient.getFontLarge());
    m_categoryButtons[0].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        categoryClicked(0);
      }
    });
    getContentPane().add(m_categoryButtons[0]);
   
    m_categoryLabels[0] = new Label("Pokeballs");
    m_categoryLabels[0].setLocation(0,0);
    m_categoryLabels[0].setGlassPane(true);
    m_categoryLabels[0].setZIndex(1000);
    m_categoryLabels[0].setSize(150,10);
    m_categoryLabels[0].setFont(GameClient.getFontLarge());
    getContentPane().add(m_categoryLabels[0]);
   
    m_categoryButtons[1] = new Button(" ");
    LoadingList.setDeferredLoading(true);
    try{
      m_categoryButtons[1].setImage(new Image(FileLoader.loadFile(respath+"res/ui/shop/potion.png"),
          respath+"res/ui/shop/potion.png", false));
    }catch(Exception e){
      e.printStackTrace();
    }
    LoadingList.setDeferredLoading(false);
    m_categoryButtons[1].setSize(150, 160);
    m_categoryButtons[1].setLocation(151, 0);
    m_categoryButtons[1].setFont(GameClient.getFontLarge());
    m_categoryButtons[1].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        categoryClicked(1);
      }
    });
    getContentPane().add(m_categoryButtons[1]);
   
    m_categoryLabels[1] = new Label("Potions");
    m_categoryLabels[1].setLocation(151,0);
    m_categoryLabels[1].setGlassPane(true);
    m_categoryLabels[1].setFont(GameClient.getFontLarge());
    m_categoryLabels[1].setZIndex(1000);
    m_categoryLabels[1].setSize(150,10);
    getContentPane().add(m_categoryLabels[1]);
   
    m_categoryButtons[2] = new Button(" ");
    LoadingList.setDeferredLoading(true);
    try{
      m_categoryButtons[2].setImage(new Image(FileLoader.loadFile(respath+"res/ui/shop/status.png"),
          respath+"res/ui/shop/status.png", false));
    }catch(Exception e){
      e.printStackTrace();
    }
    LoadingList.setDeferredLoading(false);
    m_categoryButtons[2].setSize(150, 160);
    m_categoryButtons[2].setLocation(0,161);
    m_categoryButtons[2].setFont(GameClient.getFontLarge());
    m_categoryButtons[2].setEnabled(true);
    m_categoryButtons[2].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        categoryClicked(2);
      }
    });
    getContentPane().add(m_categoryButtons[2]);
   
    m_categoryLabels[2] = new Label("Status Heals");
    m_categoryLabels[2].setLocation(0,161);
    m_categoryLabels[2].setGlassPane(true);
    m_categoryLabels[2].setFont(GameClient.getFontLarge());
    m_categoryLabels[2].setZIndex(1000);
    m_categoryLabels[2].setSize(150,10);
    getContentPane().add(m_categoryLabels[2]);
   
    m_categoryButtons[3] = new Button(" ");
    LoadingList.setDeferredLoading(true);
    try{
      m_categoryButtons[3].setImage(new Image(FileLoader.loadFile(respath+"res/ui/shop/field.png"),
          respath+"res/ui/shop/field.png", false));
    }catch(Exception e){
      e.printStackTrace();
    }
    LoadingList.setDeferredLoading(false);
    m_categoryButtons[3].setSize(150, 160);
    m_categoryButtons[3].setLocation(151,161);
    m_categoryButtons[3].setFont(GameClient.getFontLarge());
    m_categoryButtons[3].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        categoryClicked(3);
      }
    });
    getContentPane().add(m_categoryButtons[3]);
   
    m_categoryLabels[3] = new Label("Field Tools");
    m_categoryLabels[3].setLocation(151,161);
    m_categoryLabels[3].setGlassPane(true);
    m_categoryLabels[3].setFont(GameClient.getFontLarge());
    m_categoryLabels[3].setZIndex(1000);
    m_categoryLabels[3].setSize(150,10);
    getContentPane().add(m_categoryLabels[3]);

   
    m_cancel = new Button("Cancel");
    m_cancel.setSize(300,56);
    m_cancel.setLocation(0,321);
    m_cancel.setFont(GameClient.getFontLarge());
    m_cancel.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        for(int i=0;i<m_categoryLabels.length;i++){
          getContentPane().remove(m_categoryLabels[i]);
        }
        for(int i=0;i<m_categoryButtons.length;i++){
          getContentPane().remove(m_categoryButtons[i]);
        }
        getContentPane().remove(m_cancel);
        initGUI();
      }
    });
    getContentPane().add(m_cancel);
   
    this.getResizer().setVisible(false);
    getCloseButton().addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cancelled();
          }
        });
    setTitle("PokeMart");
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.