3 JButton and JToggleButton Examples To Get Started

Here are 3 examples, two on JButton and one on JToggleButton which gives you an effortless start. These examples cover almost all of the methods and constructors in these classes.
JButton is a nothing more than a push-button which you might already have gone through many times. User can click on it to get anything done.
  1. Creating Buttons in Swing
  2. Complete JButton Example for Beginners
A JToggleButton is another component much similar to a JButton. But the difference is that a JToggleButton goes into pressed state when mouse is pressed on it. To get that back into normal state, we need to press again. This component is mostly used when there is an on/off situation. You'll get a better idea of what it is when you see it in practical.

No comments: