Madcap (zimdanen) wrote,
Madcap
zimdanen

Ha! That's so cheap.

public class Stuff {

        public static void main(String[] args) {

                JFrame f = new JFrame("Clickity.");

                f.setSize(200,200);

                f.setVisible(true);

                JButton button = new JButton("Click here");

                f.add(button);

                f.setVisible(true);

        }

}


We were supposed to make a JFrame that is interactive - the user does something and the JFrame responds. So, I made a button. The button doesn't actually affect anything, but by default, it has a different look when it's active. So, when the user presses the button, it changes the button. When the user stops pressing the button, the button goes back.

So cheap. So very cheap. :D
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments