Raja has Published 760 Articles

How can we implement a long text of the JOptionPane message dialog in Java?

raja

raja

Updated on 10-Feb-2020 07:33:26

411 Views

A JOptionPane is a subclass of the JComponent class which includes static methods for creating and customizing modal dialog boxes. A JOptionPane class can be used instead of a JDialog class to minimize the complexity of the code. The JOptionPane displays the dialog boxes with one of the four standard icons (question, information, warning,  and error) or ... Read More

How can we implement the HTML text of JButton in Java?

raja

raja

Updated on 10-Feb-2020 07:28:09

165 Views

A JButton is a subclass of AbstractButton and it is an important component in the Java Swing hierarchy. A JButton can be used mostly in the login based applications. A JButton can generate an ActionListener interface when we trying to press or click a button. A JButton has a text or icon or both text and ... Read More

What are the differences between the TableCellRenderer and TableCellEditor in Java?

raja

raja

Updated on 10-Feb-2020 07:26:26

1K+ Views

TableCellRendererA TableCellRenderer creates a component that displays the value of a JTable cell.The default renderer uses JLabel to display the value of each table cell.The TableCellRenderer interface can be specified in two ways : By class of the object to be rendered using table.setDefaultRenderer() method and by a column using tableColumn.setCellRenderer() method and tableColumn.setHeaderRenderer() method for a ... Read More

How can we add/insert a JCheckBox inside a JTable cell in Java?

raja

raja

Updated on 10-Feb-2020 07:22:40

3K+ Views

A JTable is a subclass of JComponent class and it can be used to create a table with information displayed in multiple rows and columns. When a value is selected from a JTable, a TableModelEvent is generated, which is handled by implementing a TableModelListener interface. We can add or insert a checkbox inside a JTable cell ... Read More

How can we align the JRadioButtons horizontally in Java?

raja

raja

Updated on 10-Feb-2020 07:21:11

572 Views

A JRadioButton is a subclass of JToggleButton and it is a two-state button that can either selected or deselected. Unlike checkboxes, the radio buttons are associated with a group and only one radio button in a group can be selected and it can be implemented by using the ButtonGroup class. When the radio button ... Read More

How can we display the line numbers inside a JTextArea in Java?

raja

raja

Updated on 10-Feb-2020 07:18:54

718 Views

A JTextArea is a subclass of JTextComponent and it is a multi-line text component to display the text or allow the user to enter a text. A JTextArea can generate a CaretListener interface, which can listen to caret update events. By default, JTextArea does not display the line numbers, we have to customize the ... Read More

How to center align the items of a JComboBox in Java?

raja

raja

Updated on 10-Feb-2020 07:16:41

1K+ Views

A JComboBox is a subclass of JComponent class and it is a combination of a text field and a drop-down list from which the user can choose a value. A JComboBox can generate an ActionListener, ChangeListener and an ItemListener when the user actions on a combo box. By default, items in the JCombobox are ... Read More

How can we sort the items of a JComboBox in Java?

raja

raja

Updated on 10-Feb-2020 07:15:16

757 Views

A JComboBox is a subclass of JComponent class and it is a combination of a text field and a drop-down list from which the user can choose a value. A JComboBox can generate an ActionListener, ChangeListener,  and ItemListener interfaces when the user actions on a combo box. By default, a JComboBox does not support for ... Read More

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

raja

raja

Updated on 10-Feb-2020 07:10:41

452 Views

A JList is a subclass of JComponent class and it can be used to display a list of objects that allows the user to select one or more items. A JList can generate a ListSelectiionListener interface and need to implement the abstract method valueChanged(). A JToolTip class is used to display a text or a ... Read More

How many types of selection modes for a JList in Java?

raja

raja

Updated on 10-Feb-2020 07:01:22

509 Views

A JList is a component that can extend JComponent class used to display a list of objects that allows the user to select one or more items.There are three types of selection modes for a JList in JavaListSelectionModel.SINGLE_SELECTION: Only one list index can be selected at a time.ListSelectionModel.SINGLE_INTERVAL_SELECTION: Only one contiguous interval ... Read More

Advertisements