Raja has Published 760 Articles

How can we change the JButton text dynamically in Java?

raja

raja

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

7K+ Views

A JButton is a subclass of AbstractButton and it can be used for adding platform-independent buttons in a Java Swing application. A JButon can generate an ActionListener interface when the user clicking on a button, it can also generate the MouseListener and KeyListener interfaces. By default, we can create a JButton with a text and ... Read More

How can we detect an event when the mouse moves over any component in Java?

raja

raja

Updated on 10-Feb-2020 10:38:28

3K+ Views

We can implement a MouseListener interface when the mouse is stable while handling the mouse event. A MouseEvent is fired when we can press, release or click (press followed by release) a mouse button (left or right button) at the source object or position the mouse pointer at (enter) and away (exit) ... Read More

How can we set the foreground and background color to JComboBox items in Java?

raja

raja

Updated on 10-Feb-2020 10:21:27

2K+ 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. We can also set the foreground ... Read More

How to display a value when select a JList item in Java?

raja

raja

Updated on 10-Feb-2020 10:04:57

1K+ Views

A JList is a subclass of JComponent class that allows the user to choose either a single or multiple selections of items. A JList can generate a ListSelectiionListener interface and it includes one abstract method valueChanged(). We can display a value when an item is selected from a JList by implementing MouseListener interface or extending ... Read More

How can we disable cut, copy and paste functionality of a JTextArea in Java?

raja

raja

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

553 Views

A JTextArea is a subclass of the JTextComponent class and it is a multi-line text component to display the text or allow a user to enter the text. A JTextArea can generate a CaretListener interface when we are trying to implement the functionality of the JTextArea. By default, the JTextArea class can support cut, ... Read More

What is the importance of a Cursor class in Java?

raja

raja

Updated on 10-Feb-2020 09:03:57

2K+ Views

A Cursor is a subclass of Object class and it can be defined as point or indicator on the screen. A Cursor is used to select the input from the system that the user operates with the mouse. Different types of cursors available in the Cursor class are DEFAULT_CURSOR, CROSSHAIR_CURSOR, HAND_CURSOR, TEXT_CURSOR, WAIT_CURSOR and etc. ... Read More

How can we add/insert a JRadioButton to a JTable cell in Java?

raja

raja

Updated on 10-Feb-2020 08:59:20

814 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 radio button to a ... Read More

How can we create a JPopupMenu with a sub menu in Java?

raja

raja

Updated on 10-Feb-2020 08:15:41

563 Views

A JPopupMenu is a subclass of JComponent class and it can appear anywhere on the screen when a right mouse button is clicked. In order to create a popup menu, we can use the JPopupMenu class. In general, we can add the menu items to a JPopupMenu and also add a submenu to JPopupMenu by adding ... Read More

How can we disable the cell editing inside a JTable in Java?

raja

raja

Updated on 10-Feb-2020 08:12:59

3K+ Views

A JTable is a subclass of JComponent for displaying complex data structures. A JTable can follow the Model View Controller (MVC) design pattern for displaying the data in rows and columns. A JTable can fire TableModelListener, TableColumnModelListener, ListSelectionListener, CellEditorListener and RowSorterListener interfaces. By default, we can edit the text and modify it inside a ... Read More

How can we minimize/maximize a JFrame programmatically in Java?

raja

raja

Updated on 10-Feb-2020 08:11:34

4K+ Views

A JFrame class is a subclass of Frame class and the components added to a frame are referred to as its contents, these are managed by the contentPane. A JFrame contains a window with title, border, (optional) menu bar and user-specific components. By default, we can minimize a JFrame by clicking on ... Read More

Advertisements