final JButton btnWarrior = new JButton("Warrior"); btnWarrior.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { hp = 30; att = 5; System.out.println(hp+" "+att); btnWarrior.setBounds(-942, 97, 89, 23); btnAssassin.setBounds(-710, 97,89,23); lblTitle.setBounds(-990, 11, 414, 43); lblHpW.setBounds(-915, 131, 46, 14); lblAttW.setBounds(-915, 168, 46, 14); lblHpA.setBounds(-687, 131, 46, 14); lblAttA.setBounds(-700, 168, 79, 14); } }); btnWarrior.setBounds(58, 97, 89, 23); frame.getContentPane().add(btnWarrior); final JButton btnAssassin = new JButton("Assassin"); btnAssassin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { hp = 25; att = 4; System.out.println(hp+" "+att); btnAssassin.setBounds(-710, 97,89,23); btnWarrior.setBounds(-942, 97, 89, 23); lblTitle.setBounds(-990, 11, 414, 43); lblHpW.setBounds(-915, 131, 46, 14); lblAttW.setBounds(-915, 168, 46, 14); lblHpA.setBounds(-687, 131, 46, 14); lblAttA.setBounds(-700, 168, 79, 14); } });