本文整理汇总了Java中org.newdawn.slick.gui.ComponentListener类的典型用法代码示例。如果您正苦于以下问题:Java ComponentListener类的具体用法?Java ComponentListener怎么用?Java ComponentListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentListener类属于org.newdawn.slick.gui包,在下文中一共展示了ComponentListener类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
@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());
// }
// });
}
开发者ID:EnzoMolion,项目名称:Projet-PLA,代码行数:37,代码来源:WindowGame.java
示例2: init
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
@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);
}
开发者ID:assisstion,项目名称:Tower-Scaler,代码行数:21,代码来源:OptionsMenu.java
示例3: init
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
@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);
}
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:34,代码来源:GameOver.java
示例4: close
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
@Override
public void close(){
setVisible(false);
for(ComponentListener listener : closeListeners){
listener.componentActivated(this);
}
}
开发者ID:assisstion,项目名称:Tower-Scaler,代码行数:8,代码来源:TSAbstractMenu.java
示例5: init
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
@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();
}
});
}
开发者ID:assisstion,项目名称:Tower-Scaler,代码行数:13,代码来源:TSWindowMenu.java
示例6: init
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
@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);
}
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:54,代码来源:PauseGameState.java
示例7: SlickButton
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
public SlickButton(GUIContext container, Image image, int x, int y, int width, int height,
ComponentListener listener) {
super(container, image, x, y, width, height, listener);
}
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:5,代码来源:SlickButton.java
示例8: init
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
@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);
}
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:80,代码来源:MainScreenGameState.java
示例9: TextButton
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
public TextButton(GUIContext container, String text, int x, int y, Font font, ComponentListener listener) {
this(container, text, x, y, font);
addListener(listener);
}
开发者ID:langurmonkey,项目名称:celestial-pole-motion,代码行数:5,代码来源:TextButton.java
示例10: addCloseListener
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
@Override
public void addCloseListener(ComponentListener listener){
closeListeners.add(listener);
}
开发者ID:assisstion,项目名称:Tower-Scaler,代码行数:5,代码来源:TSAbstractMenu.java
示例11: removeCloseListener
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
protected void removeCloseListener(ComponentListener listener){
closeListeners.remove(listener);
}
开发者ID:assisstion,项目名称:Tower-Scaler,代码行数:4,代码来源:TSAbstractMenu.java
示例12: getCloseListeners
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
protected Set<ComponentListener> getCloseListeners(){
return closeListeners;
}
开发者ID:assisstion,项目名称:Tower-Scaler,代码行数:4,代码来源:TSAbstractMenu.java
示例13: addCloseListener
import org.newdawn.slick.gui.ComponentListener; //导入依赖的package包/类
void addCloseListener(ComponentListener listener);
开发者ID:assisstion,项目名称:Tower-Scaler,代码行数:2,代码来源:TSCloseable.java
注:本文中的org.newdawn.slick.gui.ComponentListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论