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");
GameClient.getInstance().getUi().stopUsingBox();
}
});
confirm.getContentPane().add(yousure);
confirm.getContentPane().add(yes);
confirm.getContentPane().add(no);
getDisplay().add(confirm);
}
});
m_release.setEnabled(false);