Package mdes.slick.sui

Examples of mdes.slick.sui.Button


     
      label.add(line);
    }
    label.setSize(maxWidth, maxHeight);
   
    Button ok = new Button();
    ok.setText("OK");
    getContentPane().add(label);
    getContentPane().add(ok);
    label.setLocation(5, 15);
    this.setResizable(false);
    this.setSize(label.getWidth() + 10, label.getHeight() + 90);
    ok.setSize(50, 25);
    ok.setLocation(this.getWidth()/2-25, this.getHeight()- 60);
    ok.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        setVisible(false);
      }
    });
    this.setLocation((container.getDisplay().getWidth()/2)-(this.getWidth()/2),
View Full Code Here


    m_pp.add(pp1);
    m_pp.add(pp2);
    m_pp.add(pp3);
    m_pp.add(pp4);

    m_cancel = new Button("Cancel");
    m_cancel.setBounds(3, 122, 246, 77);
    m_cancel.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        MoveLearningManager.getInstance().removeMoveLearning();
        GameClient.getInstance().getPacketGenerator().writeTcpMessage(
View Full Code Here

     
      m_label.add(line);
    }
    m_label.setSize(maxWidth, maxHeight);
   
    m_yesBtn = new Button();
    m_noBtn = new Button();
   
    m_yesBtn.setText("Yes");
    m_yesBtn.setSize(50, 25);
    m_yesBtn.setY(m_label.getY() + m_label.getHeight() + 20);
   
View Full Code Here

    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");
View Full Code Here

 
  /**
   * Initialises the gui when first opened
   */
  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) {
View Full Code Here

    }
   
    m_sellList = new ListBox(m_items);
   
    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){
View Full Code Here

    m_sell.setVisible(false);
    m_cancel.setVisible(false);
    m_categoryButtons = new Button[4];
    m_categoryLabels = new Label[4];
   
    m_categoryButtons[0] = new Button(" ");
    LoadingList.setDeferredLoading(true);
    String respath = System.getProperty("res.path");
    if(respath==null)
      respath="";
    try{
     
      m_categoryButtons[0].setImage(new Image(FileLoader.loadFile(respath+"res/ui/shop/pokeball.png"),
          respath+"res/ui/shop/pokeball.png", false));
    }catch(Exception e){
      e.printStackTrace();
    }
    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) {
View Full Code Here

    m_itemLabels = new Label[m_items.size()];
    m_itemStockPics = new Label[m_items.size()];
    for(int i = 0;i<m_items.size();i++){
      final int itemChosen = m_items.get(i).getId();
      final int buttonNumber = i;
      m_itemButtons[i] = new Button("");
      m_itemButtons[i].setSize(300, 50);
      if(i>0)
        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) {
View Full Code Here

          String respath = System.getProperty("res.path");
        if(respath==null)
          respath="";
          for (int i = 0; i < m_items.size(); i++) {
            final int j = i;
            m_itemButtons[i] = new Button("       x" + m_items.get(i).getQuantity());
            m_itemButtons[i].setToolTipText(m_items.get(i).getItem().getName()+"\n"+m_items.get(i).getItem().getDescription());
            LoadingList.setDeferredLoading(true);
            try {
              m_itemIcon[i] = new Label();
                m_itemIcon[i].setSize(32, 32);
                f = FileLoader.loadFile(respath+"res/items/24/" + m_items.get(i).getNumber() + ".png");
              m_itemIcon[i].setImage(new Image(f, respath+"res/items/24/" + m_items.get(i).getNumber() + ".png", false));
              m_itemIcon[i].setGlassPane(true);
              m_itemIcon[i].setToolTipText(m_items.get(i).getItem().getName()+"\n"+m_items.get(i).getItem().getDescription());
          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();
            }
View Full Code Here

    m_g.setLocation(170, 128);
    m_g.setFont(GameClient.getFontSmall());
    m_g.setForeground(m_white);
    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();
View Full Code Here

TOP

Related Classes of mdes.slick.sui.Button

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.