Hi,
This is probably a stupid problem, but my gui skills have kind of faded in a year.
In the following test code I'm adding a button to a panel, which is added to a frame. The button works fine, but it won't change it's color when pressed. Thanks in advance for any help.
public class test extends JFrame{ public static void main (String[]args) { test t = new test(); } public test() { JButton knapp = new JButton("button"); JPanel panel = new JPanel(); knapp.addActionListener(new listener()); panel.add(knapp); add(panel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } private class listener implements ActionListener { public void actionPerformed(ActionEvent e) { JButton test = (JButton)e.getSource(); test.setBackground(Color.BLACK); System.out.println("why hello thar"); } } }