klasscho

GuiPanel

Jun 8th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.74 KB | None | 0 0
  1. package com.gui;
  2.  
  3. import java.awt.*;
  4. import java.awt.event.MouseEvent;
  5. import java.util.ArrayList;
  6. import java.util.Iterator;
  7.  
  8. public class GuiPanel {
  9.     private ArrayList<GuiButton> buttons = new ArrayList<GuiButton>();;
  10.  
  11.     public GuiPanel(){}
  12.  
  13.     public void update(){
  14.         Iterator var2 = this.buttons.iterator();
  15.         while(var2.hasNext()) {
  16.             GuiButton b = (GuiButton)var2.next();
  17.             b.update();
  18.         }
  19.     }
  20.  
  21.     public void render(Graphics2D g){
  22.         Iterator var3 = this.buttons.iterator();
  23.         while(var3.hasNext()) {
  24.             GuiButton b = (GuiButton)var3.next();
  25.             b.render(g);
  26.         }
  27.     }
  28.  
  29.     public void add(GuiButton button){
  30.             this.buttons.add(button);
  31.     }
  32.  
  33.     public void remove(GuiButton button){
  34.         this.buttons.remove(button);
  35.     }
  36.  
  37.     public void mousePressed(MouseEvent e){
  38.         Iterator var3 = this.buttons.iterator();
  39.         while(var3.hasNext()) {
  40.             GuiButton b = (GuiButton)var3.next();
  41.             b.mousePressed(e);
  42.         }
  43.     }
  44.  
  45.     public void mouseReleased(MouseEvent e){
  46.         Iterator var3 = this.buttons.iterator();
  47.         while(var3.hasNext()) {
  48.             GuiButton b = (GuiButton)var3.next();
  49.             b.mouseReleased(e);
  50.         }
  51.     }
  52.  
  53.     public void mouseDragged(MouseEvent e){
  54.         Iterator var3 = this.buttons.iterator();
  55.         while(var3.hasNext()) {
  56.             GuiButton b = (GuiButton)var3.next();
  57.             b.mouseDragged(e);
  58.         }
  59.     }
  60.  
  61.     public void mouseMoved(MouseEvent e){
  62.         Iterator var3 = this.buttons.iterator();
  63.         while(var3.hasNext()) {
  64.             GuiButton b = (GuiButton)var3.next();
  65.             b.mouseMoved(e);
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment