I'm working on a textbased simple roleplaying game for my exame, but i have ran into some problems with my gui.
When the player registers, he can spend some attribute points in 3 categories. The gui is programmed to show the Raise Strength etc. button, if the player have any attribute points.
And that works cool, but then when the player clicks on a raise button, an attributepoint is taken for him, the problem is, that the gui doesn't seem to update.
if(Controller.player.getAttributePoints() > 0) {
JLabel attriL = new JLabel("You have " + Controller.player.getAttributePoints() + " unspent Attribute points.");
attriL.setBounds(110, 30, 250, 30);
hPanel.add(attriL);
JButton setStrB = new JButton("Raise Strength");
setStrB.setBounds(125, 60, 200, 30);
setStrB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// tabbedPane.removeAll();
Controller.player.setAttributePoints(Controller.player.getAttributePoints()-1);
Controller.player.setStrength(Controller.player.getStrength()+1);
gameCtn.validate();
gameCtn.repaint();
System.out.println(Controller.player.getStrength());
}
});
hPanel.add(setStrB);
}
As you can see i have tried using repaint and validate on my container but with no luck, also i have tried on the Frame, and the panel, nothing seems to work? Am i doing something wrong?
Thx