View Full Version : Buttons in Java
05-26-2008, 05:00 PM
Okay, so I need to make some buttons and connect them to methods. Unfortunately, I haven't the slightest idea how to begin. I've found various ways to make buttons, but I haven't figured out to make them call methods in another class. This is probably very simple, so I apologize.
Thanks so much for your help!
06-02-2008, 09:19 PM
jButton.addActionListener(this); will add and action listener which will listen for clicks. If a click occurs on jButton it will search 'this' for the action handler to figure out what to do.
Before you try doing UI, you should attempt to learn the basics of Java and OOP. Java's website java.sun.com has some good tutorials or you can checkout/buy a book on beginning java programming.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.