Reputation: 1374
I have a very simple example. A button on the bottom of the screen that says "hi" and when its clicked it prints "hello" to the console. However, When I press the button, it doesn't change visually. Its the same with the other JSwing interactors, but for a SSCCE, here you go.
import acm.program.*;
import javax.swing.*;
import java.awt.event.*;
public class SimpleGUI extends ConsoleProgram {
public void init() {
JButton hi = new JButton("Hi");
add(hi, SOUTH);
addActionListeners();
}
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if (cmd.equals("Hi")) println("Hello there sexy");
}
}
Upvotes: 1
Views: 256
Reputation: 29139
Appearance of Swing controls (including buttons) is controlled by the look-n-feel. This includes whether or not buttons look depressed when clicked.
This may help:
http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
Upvotes: 2