Alshifa Hasnain has Published 283 Articles

How to set a tooltip text for each item of a JList in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 07-May-2025 18:33:46

740 Views

In this article, we will learn to set a tooltip text for each item of a JList in Java. Tooltips give meaningful information as users hover over UI components. Swing's JList does not support tooltips on a per-item basis, so it will involve some customization. What is JList? A JList ... Read More

How to Write/create a JSON file using Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 07-May-2025 18:33:22

64K+ Views

In this article, we will learn to write/create a JSON file using Java. JSON has become the standard for data exchange for any kind of application. Java also has a collection of libraries helpful in creating and storing JSON files. JSON JSON or JavaScript Object Notation is a lightweight text-based ... Read More

When will be an IllegalStateException (unchecked) thrown in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 06-May-2025 18:38:52

430 Views

In this article, we will learn how an IllegalStateException (unchecked) is thrown in Java. IllegalStateException is a subclass of RuntimeException. It occurs when a method is used at the wrong time or when an object is not in the right state. What is an IllegalStateException? An IllegalStateException is an unchecked ... Read More

What is an Event Handling and describe the components in Event Handling in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 06-May-2025 18:38:43

5K+ Views

The GUI in Java processes the interactions with users via mouse, keyboard, and various user controls such as buttons, checkboxes, text fields, etc., as events. These events are to be handled properly to implement Java as an Event-Driven Programming. What is Event Handling? Event handling refers to the mechanism that ... Read More

How can we implement right click menu using JPopupMenu in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 06-May-2025 18:38:17

2K+ Views

In this article, we will learn to implement right right-click menu using JPopupMenu in Java. A JPopupMenu appears anywhere on the screen when the right mouse button is clicked. JPopupMenu A JPopupMenu menu is a free-floating menu that is associated with an underlying component called the invoker. Most of the ... Read More

How can we set a border to JCheckBox in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 05-May-2025 18:33:11

665 Views

In this article, we will learn to set a border for JCheckBox in Java. JCheckBox is a Swing component that is commonly used in user interface selection. Although it includes a default appearance, we can customize its look by setting borders in order to have a good visual effect. What ... Read More

How can we set the shortcut key to a JButton in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 05-May-2025 18:32:59

2K+ Views

In this article, we will learn to set the shortcut key to a JButton in Java. In Swing-based applications, we can implement the addition of keyboard shortcuts to buttons to enable quicker navigation by the user. What is a JButton? A JButton is a subclass of AbstractButton, and it can ... Read More

How can we implement the word wrap JTableHeader of a JTable in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 05-May-2025 18:32:47

821 Views

In this article, we will learn to implement the word wrap JTableHeader of a JTable in Java. The Java Swing default JTableHeader does not support word wrapping. This is a problem if you have long column headers. We can implement this by customizing the DefaultTableModel class or the AbstractTableModel class. ... Read More

How to read/parse JSON array using Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 05-May-2025 18:32:29

60K+ Views

In this article, we will learn to read/parse a JSON array using Java. A JSON array is an ordered collection of values that are enclosed in square brackets, i.e., it begins with ‘[’ and ends with ‘]’. The values in the arrays are separated by ‘, ’ (comma). Sample JSON ... Read More

How can we align the JRadioButtons horizontally in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 02-May-2025 19:26:39

820 Views

In this article, we will learn to align the JRadioButtons horizontally in Java. While designing graphical user interfaces (GUIs) in Java using Swing, you might frequently have to position radio buttons horizontally instead of the default vertical layout. What is a JRadioButton? A JRadioButton is a subclass of JToggleButton ... Read More

Previous 1 ... 7 8 9 10 11 ... 29 Next
Advertisements