Java 类org.newdawn.slick.gui.AbstractComponent 实例源码

项目:Tower-Scaler    文件:OptionsMenu.java   
@Override
public void init(GameContainer gc) throws SlickException{
    super.init(gc);
    TSTextLabel label = new TSTextLabel(gc, getWidth() / 2,
            getHeight() / 8, " Options ");
    TSBoxLabel box = new TSBoxLabel(gc, label, Color.green, Color.black);
    tsftb = new TSFocusTextButton(gc, this, getWidth() * 3 / 4,
            getHeight() / 4, " Toggle Sound ", Helper.getDefaultFont(),
            Color.cyan, Color.black, Color.black);
    tsftb.addListener(new ComponentListener(){

        @Override
        public void componentActivated(AbstractComponent arg0){
            ge.setSoundOn(!ge.isSoundOn());
        }

    });
    addComponent(box);
    addComponent(tsftb);
}
项目:trashjam2017    文件:GUITest.java   
/**
 * @see org.newdawn.slick.gui.ComponentListener#componentActivated(org.newdawn.slick.gui.AbstractComponent)
 */
public void componentActivated(AbstractComponent source) {
    System.out.println("ACTIVL : "+source);
    for (int i=0;i<4;i++) {
        if (source == areas[i]) {
            message = "Option "+(i+1)+" pressed!";
        }
    }
    if (source == field2) {
    }
}
项目:Projet-PLA    文件:WindowGame.java   
@Override
    public void init(GameContainer container) throws SlickException {
        this.container = container;
        this.map = new TiledMap("/home/enzo/newmap.tmx");

        SpriteSheet spriteSheet = new SpriteSheet("/home/enzo/SpriteSheetAnim.png", 64, 64);
        this.animations[0] = loadAnimation(spriteSheet, 0, 1, 0);
        this.animations[1] = loadAnimation(spriteSheet, 0, 1, 1);
        this.animations[2] = loadAnimation(spriteSheet, 0, 1, 2);
        this.animations[3] = loadAnimation(spriteSheet, 0, 1, 3);
        this.animations[4] = loadAnimation(spriteSheet, 1, 9, 0);
        this.animations[5] = loadAnimation(spriteSheet, 1, 9, 1);
        this.animations[6] = loadAnimation(spriteSheet, 1, 9, 2);
        this.animations[7] = loadAnimation(spriteSheet, 1, 9, 3);

        Font font = new Font("Verdana", Font.BOLD, 20);
        UnicodeFont uFont = new UnicodeFont(font, font.getSize(), font.isBold(), font.isItalic());
        nameInput = new TextField(container, uFont, 150,20,500,35, new ComponentListener()
            {
             public void componentActivated(AbstractComponent source) {
                message = "Entered1: "+nameInput.getText();
                nameInput.setFocus(true);
             }

        });

//      ComponentListener listener = new ComponentListener();
//      TextField nameInput = new TextField(arg0, truetypefont, 150,20,500,35, listener);
//      
//      {
//          public void componentActivated(AbstractComponent source) {
//             System.out.println("Entered1: "+nameInput.getText());
//          }
//     });

    }
项目:Progetto-C    文件:GUITest.java   
/**
 * @see org.newdawn.slick.gui.ComponentListener#componentActivated(org.newdawn.slick.gui.AbstractComponent)
 */
public void componentActivated(AbstractComponent source) {
    System.out.println("ACTIVL : "+source);
    for (int i=0;i<4;i++) {
        if (source == areas[i]) {
            message = "Option "+(i+1)+" pressed!";
        }
    }
    if (source == field2) {
    }
}
项目:BaseClient    文件:GUITest.java   
/**
 * @see org.newdawn.slick.gui.ComponentListener#componentActivated(org.newdawn.slick.gui.AbstractComponent)
 */
public void componentActivated(AbstractComponent source) {
    System.out.println("ACTIVL : "+source);
    for (int i=0;i<4;i++) {
        if (source == areas[i]) {
            message = "Option "+(i+1)+" pressed!";
        }
    }
    if (source == field2) {
    }
}
项目:p2_java_plateformed2d    文件:GameOver.java   
@Override
   public void init(GameContainer container, StateBasedGame game) throws SlickException {
// Background image
background = new Image("ressources/background/background.jpg");

// Music
deadMusic = new Music("ressources/audio/music/gameover.ogg");

// Sound
rollover = new Sound("ressources/audio/sound/rollover.ogg");

// Cursor image
cursor = new Image("ressources/cursor/hand_cursor.png");

// Color for button when mous is over
Color color = new Color(255, 157, 67, 180);

// Button "Quitter"
Image quitterImage = new Image("ressources/menu/quitter.png");

quitter = new SlickButton(container, quitterImage,
    WindowGame.BASE_WINDOW_WIDTH / 2 - quitterImage.getWidth() / 2, 500, quitterImage.getWidth(),
    quitterImage.getHeight(), new ComponentListener() {

        @Override
        public void componentActivated(AbstractComponent arg0) {
        game.enterState(0);
        }
    });

quitter.setMouseOverColor(color);
quitter.setMouseDownSound(rollover);
   }
项目:GPVM    文件:GUITest.java   
/**
 * @see org.newdawn.slick.gui.ComponentListener#componentActivated(org.newdawn.slick.gui.AbstractComponent)
 */
public void componentActivated(AbstractComponent source) {
    System.out.println("ACTIVL : "+source);
    for (int i=0;i<4;i++) {
        if (source == areas[i]) {
            message = "Option "+(i+1)+" pressed!";
        }
    }
    if (source == field2) {
    }
}
项目:Tower-Scaler    文件:TSSingleContainerWindowMenu.java   
@Override
public void componentActivated(AbstractComponent source){
    if(isVisible()){
        if(component != null && component.equals(listenerComponent)){
            close();
        }
    }
}
项目:Tower-Scaler    文件:TSWindowMenu.java   
@Override
public void init(GameContainer gc) throws SlickException{
    super.init(gc);
    closeButton = new TSFocusButton(gc, this, getX(), getY(), getX() + 16,
            getY() + 16, new Color(255, 0, 0, 127), Color.black);
    closeButton.addListener(new ComponentListener(){
        @Override
        public void componentActivated(AbstractComponent source){
            instance.close();
        }
    });
}
项目:SpaceStationAlpha    文件:GUITest.java   
/**
 * @see org.newdawn.slick.gui.ComponentListener#componentActivated(org.newdawn.slick.gui.AbstractComponent)
 */
public void componentActivated(AbstractComponent source) {
    System.out.println("ACTIVL : "+source);
    for (int i=0;i<4;i++) {
        if (source == areas[i]) {
            message = "Option "+(i+1)+" pressed!";
        }
    }
    if (source == field2) {
    }
}
项目:cretion    文件:GUITest.java   
/**
 * @see org.newdawn.slick.gui.ComponentListener#componentActivated(org.newdawn.slick.gui.AbstractComponent)
 */
public void componentActivated(AbstractComponent source) {
    System.out.println("ACTIVL : "+source);
    for (int i=0;i<4;i++) {
        if (source == areas[i]) {
            message = "Option "+(i+1)+" pressed!";
        }
    }
    if (source == field2) {
    }
}
项目:slick2d-maven    文件:GUITest.java   
/**
 * @see org.newdawn.slick.gui.ComponentListener#componentActivated(org.newdawn.slick.gui.AbstractComponent)
 */
public void componentActivated(AbstractComponent source) {
    System.out.println("ACTIVL : "+source);
    for (int i=0;i<4;i++) {
        if (source == areas[i]) {
            message = "Option "+(i+1)+" pressed!";
        }
    }
    if (source == field2) {
    }
}
项目:p2_java_plateformed2d    文件:PauseGameState.java   
@Override
   public void init(GameContainer container, StateBasedGame game) throws SlickException {
// Sound
rollover = new Sound("ressources/audio/sound/rollover.ogg");

// Background image
background = new Image("ressources/background/background.jpg");

// Cursor image
cursor = new Image("ressources/cursor/hand_cursor.png");

// Color for button when mous is over
Color color = new Color(255, 157, 67, 180);

// Button "Quitter"
Image quitterImage = new Image("ressources/menu/quitter.png");

quitter = new SlickButton(container, quitterImage,
    WindowGame.BASE_WINDOW_WIDTH / 2 - quitterImage.getWidth() / 2, 250, quitterImage.getWidth(),
    quitterImage.getHeight(), new ComponentListener() {

        @Override
        public void componentActivated(AbstractComponent arg0) {
        try {
            ((LevelState) game.getState(ID_Last)).initialisation();
        } catch (SlickException e) {
            System.err.println("Probl�me pour quitter le level.");
            e.printStackTrace();
        }
        game.enterState(0);
        }
    });

quitter.setMouseOverColor(color);
quitter.setMouseDownSound(rollover);

// Button "Reprendre"
Image reprendreImage = new Image("ressources/menu/reprendre.png");

reprendre = new SlickButton(container, reprendreImage,
    WindowGame.BASE_WINDOW_WIDTH / 2 - reprendreImage.getWidth() / 2, 400, reprendreImage.getWidth(),
    reprendreImage.getHeight(), new ComponentListener() {

        @Override
        public void componentActivated(AbstractComponent arg0) {
        game.enterState(ID_Last);
        }
    });

reprendre.setMouseOverColor(color);
reprendre.setMouseDownSound(rollover);

   }
项目:p2_java_plateformed2d    文件:MainScreenGameState.java   
@Override
   public void init(GameContainer container, StateBasedGame game) throws SlickException {

// Background image
background = new Image("ressources/background/background.jpg");

// Cursor image
cursor = new Image("ressources/cursor/hand_cursor.png");

// Sounds
sound = new Music("ressources/audio/music/home.ogg");
rollover = new Sound("ressources/audio/sound/rollover.ogg");

// Color for button when mous is over
Color color = new Color(255, 157, 67, 180);

// Button "jouer"
Image jouerImage = new Image("ressources/menu/jouer.png");

jouer = new SlickButton(container, jouerImage, WindowGame.BASE_WINDOW_WIDTH / 2 - jouerImage.getWidth() / 2,
    250, jouerImage.getWidth(), jouerImage.getHeight(), new ComponentListener() {

        @Override
        public void componentActivated(AbstractComponent arg0) {
        game.enterState(101, new FadeOutTransition(), new FadeInTransition());
        }
    });

jouer.setMouseDownSound(rollover);
jouer.setMouseOverColor(color);

// Button "niveaux"
Image niveauxImage = new Image("ressources/menu/niveaux.png");

niveaux = new SlickButton(container, niveauxImage,
    WindowGame.BASE_WINDOW_WIDTH / 2 - niveauxImage.getWidth() / 2, 400, niveauxImage.getWidth(),
    niveauxImage.getHeight(), new ComponentListener() {

        @Override
        public void componentActivated(AbstractComponent arg0) {
        game.enterState(11);
        }
    });

niveaux.setMouseDownSound(rollover);
niveaux.setMouseOverColor(color);

// Button "options"
Image optionsImage = new Image("ressources/menu/options.png");

options = new SlickButton(container, optionsImage,
    WindowGame.BASE_WINDOW_WIDTH / 2 - optionsImage.getWidth() / 2, 550, optionsImage.getWidth(),
    optionsImage.getHeight(), new ComponentListener() {

        @Override
        public void componentActivated(AbstractComponent arg0) {
        game.enterState(60);
        }
    });

options.setMouseDownSound(rollover);
options.setMouseOverColor(color);

// Button "quitter"
Image quitterImage = new Image("ressources/menu/quitter.png");

quitter = new SlickButton(container, quitterImage,
    WindowGame.BASE_WINDOW_WIDTH / 2 - quitterImage.getWidth() / 2, 700, quitterImage.getWidth(),
    quitterImage.getHeight(), new ComponentListener() {

        @Override
        public void componentActivated(AbstractComponent arg0) {
        System.exit(0);
        }
    });

quitter.setMouseDownSound(rollover);
quitter.setMouseOverColor(color);
   }