Jframe is a very basics component in java swing package, it is a must learning if you any Java GUI applications, this tutorial and example is for this, it covers the JFrame introduction, usage and demonstrate how to create simple Jframe programs.
The ButtonGroup Class The ButtonGroup class allows buttons to be logically grouped, guaranteeing that no more than one button in the group is selected at any given time. In fact, once one of the buttons is selected, the ButtonGroup ensures that exactly one button remains selected at all times. Note that this allows for an […]
The propose of this tutorial and example is to learn the Java timer basic knowledge and usage. The Timer Class introduction The Timer class provides a mechanism to generate timed events. It has properties and events, and thus can be used in application builders that understand JavaBeans. It fires an ActionEvent at a given time. […]
This topic is about JToggleButton example and tutrial. Let’s you quickview how to use JToggleButton: The JToggleButton Class(JToggleButton example and tutrial class introduction) JToggleButton is an extension of AbstractButton and is used to represent buttons that can be toggled on and off (as opposed to buttons like JButton which, when pushed, “pop back up”). It […]
JLabel is a display area for a short text string or an image, or both, it is a basic GUI Component defined in Java Swing library. A label does not react to input events. As a result, it cannot get the keyboard focus. In this how-to, we will go over how to set appearance: JLabel font size and […]
Traditionally the background color of JLable is transparent, we can change it by using following code: JPanel panel = new JPanel(); JLabel label = new JLabel(“JLabel Demo”); label.setOpaque(true); label.setForeground(Color.blue); label.setBackground(Color.lightGray); panel .add(label); Code label.setOpaque(true) is required to paint the background color of JLabel.
The needs is that we need have a dialog to ask user user name and password so user are to be granted appropriate privilege to access resource, we will use JoptionPane Showinputdialog but with password textbox presented. How JoptionPane showinputdialog dialog are construed? Name: <jtextfield> Password: <JPasswordField> Button <OK> Button <NO>
JOptionPane is used to prompt up a dialog to accept user input or informs a message, four types of dialog are supported: Message dialog, Confirmation dialog, Input dialog, and Options dialog. Today we get learn how to use JoptionPane showmessagedialog – tutorial and example. 3 static methods are defined in class JOptionPane you can directly […]
JOptionPane Introduction JOptionPane is a basic component defined in Java swing, it makes easy to pop a standard dialog box that accept user input or prompts user for a value, JOptionPane contains classes used for a graphical user interface (GUI) Facilitates data entry and data output. How Do I use Joptionpane – tutorial and example […]
After Swing components have been displayed on the screen, they should only be operated on by the event-handling thread. The event-handling thread (or just event thread) is started automatically by the Java VM when an application has a graphical interface. The event thread calls methods like paint() on Component, actionPerformed() on ActionListener, and all of […]