- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the importance of a Cursor class in Java?
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. The important methods of Cursor class are getDefaultCursor(), getName(), getPredefinedCursor(), getSystemCustomCursor() and getType().
Example
import java.awt.*; import javax.swing.*; public class CursorTest extends JFrame { public CursorTest() { setTitle("Cursor Test"); Cursor cursor = new Cursor(Cursor.HAND_CURSOR); // HAND CURSOR setCursor(cursor); setSize(375, 250); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setVisible(true); } public static void main(String[] args) { new CursorTest(); } }
Output
- Related Articles
- What is the importance of SwingUtilities class in Java?
- What is the importance of Runtime class in Java?
- What is the importance of JViewport class in Java?
- What is the importance of JSeparator class in Java?
- What is the importance of a SwingWorker class in Java?\n
- What is the importance of the GridBagConstraints class in Java?
- What is the importance of the CardLayout class in Java?
- What is the importance of the Container class in Java?
- What is the importance of Boolean class in Java?\n
- Importance of a Dictionary class in Java?
- Importance of a Locale class in Java?
- What is the importance of the Throwable class and its methods in Java?
- What is the importance of a StringWriter in Java?
- Importance of StringReader class in Java?\n
- Importance of MethodHandles class in Java 9?

Advertisements