String respath = System.getProperty("res.path");
if(respath==null)
respath="";
try {
f = FileLoader.loadFile(respath+"res/ui/bg.png");
m_bg = new Label(new Image(f, respath+"res/ui/bg.png", false));
} catch (SlickException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
m_bg.setSize(256, 203);
m_bg.setLocation(0, 142);
getContentPane().add(m_bg);
attackPane = new Container();
attackPane.setBackground(new Color(0, 0, 0, 0));
move1 = BattleButtonFactory.getButton("");
move2 = BattleButtonFactory.getButton("");
move3 = BattleButtonFactory.getButton("");
move4 = BattleButtonFactory.getButton("");
setResizable(false);
this.getTitleBar().setVisible(false);
// start attackPane
attackPane.add(move1);
move1.setLocation(7, 10);
move1.setSize(116, 51);
move1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
useMove(0);
}
});
pp1 = new Label();
pp1.setHorizontalAlignment(Label.RIGHT_ALIGNMENT);
pp1.setBounds(0, move1.getHeight() - 20, move1.getWidth() - 5, 20);
move1.add(pp1);
attackPane.add(move2);
move2.setLocation(130, 10);
move2.setSize(116, 51);
move2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
useMove(1);
}
});
pp2 = new Label();
pp2.setHorizontalAlignment(Label.RIGHT_ALIGNMENT);
pp2.setBounds(0, move2.getHeight() - 20, move2.getWidth() - 5, 20);
move2.add(pp2);
attackPane.add(move3);
move3.setLocation(7, 65);
move3.setSize(116, 51);
move3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
useMove(2);
}
});
pp3 = new Label();
pp3.setHorizontalAlignment(Label.RIGHT_ALIGNMENT);
pp3.setBounds(0, move3.getHeight() - 20, move3.getWidth() - 5, 20);
move3.add(pp3);
attackPane.add(move4);
move4.setLocation(130, 65);
move4.setSize(116, 51);
move4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
useMove(3);
}
});
pp4 = new Label();
pp4.setHorizontalAlignment(Label.RIGHT_ALIGNMENT);
pp4.setBounds(0, move4.getHeight() - 20, move4.getWidth() - 5, 20);
move4.add(pp4);
pp1.setFont(GameClient.getFontSmall());
pp2.setFont(GameClient.getFontSmall());
pp3.setFont(GameClient.getFontSmall());
pp4.setFont(GameClient.getFontSmall());
pp1.setForeground(Color.white);
pp2.setForeground(Color.white);
pp3.setForeground(Color.white);
pp4.setForeground(Color.white);
m_moveButtons.add(move1);
m_moveButtons.add(move2);
m_moveButtons.add(move3);
m_moveButtons.add(move4);
m_ppLabels.add(pp1);
m_ppLabels.add(pp2);
m_ppLabels.add(pp3);
m_ppLabels.add(pp4);
btnRun = BattleButtonFactory.getSmallButton("Run");
btnRun.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
run();
}
});
attackPane.add(btnRun);
btnRun.setBounds(97, 148, 60, 47);
btnBag = BattleButtonFactory.getSmallButton("Bag");
attackPane.add(btnBag);
btnBag.setLocation(3, 122);
btnBag.setSize(82, 48);
btnBag.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
showBag();
}
});
btnPoke = BattleButtonFactory.getSmallButton("Pokemon");
attackPane.add(btnPoke);
btnPoke.setLocation(168, 122);
btnPoke.setSize(82, 48);
btnPoke.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
showPokePane(false);
}
});
cancel = BattleButtonFactory.getSmallButton("Cancel");
attackPane.add(cancel);
cancel.setVisible(false);
cancel.setLocation(162, 110);
cancel.setSize(82, 48);
cancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
}
});
attackPane.setBounds(2, 140, 257, 201);
getContentPane().add(attackPane);
// end attackPane
// start pokesContainer
pokesContainer = new Container();
pokesContainer.setBackground(new Color(0, 0, 0, 0));
pokesContainer.setBounds(2, 140, 257, 201);
pokeBtn1 = BattleButtonFactory.getButton(" ");
pokesContainer.add(pokeBtn1);
pokeBtn1.setBounds(8, 8, 116, 51);
pokeBtn1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
switchPoke(0);
}
});
pokeBtn2 = BattleButtonFactory.getButton(" ");
pokesContainer.add(pokeBtn2);
pokeBtn2.setBounds(128, 8, 116, 51);
pokeBtn2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
switchPoke(1);
}
});
pokeBtn3 = BattleButtonFactory.getButton(" ");
pokesContainer.add(pokeBtn3);
pokeBtn3.setBounds(8, 59, 116, 51);
pokeBtn3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
switchPoke(2);
}
});
pokeBtn4 = BattleButtonFactory.getButton(" ");
pokesContainer.add(pokeBtn4);
pokeBtn4.setBounds(128, 59, 116, 51);
pokeBtn4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
switchPoke(3);
}
});
pokeBtn5 = BattleButtonFactory.getButton(" ");
pokesContainer.add(pokeBtn5);
pokeBtn5.setBounds(8, 110, 116, 51);
pokeBtn5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
switchPoke(4);
}
});
pokeBtn6 = BattleButtonFactory.getButton(" ");
pokesContainer.add(pokeBtn6);
pokeBtn6.setBounds(128, 110, 116, 51);
pokeBtn6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
switchPoke(5);
}
});
m_pokeButtons.add(pokeBtn1);
m_pokeButtons.add(pokeBtn2);
m_pokeButtons.add(pokeBtn3);
m_pokeButtons.add(pokeBtn4);
m_pokeButtons.add(pokeBtn5);
m_pokeButtons.add(pokeBtn6);
for (int i = 0; i < 6; i++){
Label status = new Label();
status.setSize(30, 12);
status.setGlassPane(true);
m_pokeButtons.get(i).add(status);
status.setLocation(6, 5);
Label info = new Label();
m_pokeButtons.get(i).add(info);
info.setText(" ");
info.setLocation(3, 34);
info.setSize(107, 14);
info.setForeground(Color.white);
info.setGlassPane(true);
info.setFont(GameClient.getFontSmall());
m_pokeInfo.add(info);
}
pokeCancelBtn = BattleButtonFactory.getSmallButton("Cancel");
pokesContainer.add(pokeCancelBtn);