Skip to content

Cursor

Cursor animation

AnimatedCursor

A looping animation of the mouse pointer is created by switching the Cursor using a Timer.

Creating a Cursor object

CustomCursor

Create a cursor object from BufferedImage and set it to the component.

Change Cursor to hourglass

WaitCursor

While processing is running in the background, enable the GlassPane with the hourglass icon set in the Cursor.

Use a transparent JDialog in a Modal to block input to the parent JFrame

Section titled “Use a transparent JDialog in a Modal to block input to the parent JFrame”
Use a transparent JDialog in a Modal to block input to the parent JFrame

BlockingDialog

By displaying a transparent JDialog using a Modal, input operations on the entire parent JFrame are blocked.

Get the mouse's position on the screen

MouseInfo

The absolute position of the mouse on the screen is obtained, and the racket in the panel is moved accordingly.

JToolTip display position

ToolTipLocation

This sets the JToolTip's display position to follow the mouse cursor when dragged.

Prohibit input to components specified in JLayer

Section titled “Prohibit input to components specified in JLayer”
Prohibit input to components specified in JLayer

DisableInputLayer

This code uses JLayer, introduced in JDK7, to block input to a specified component.

The cursor changes for each component placed within a JList cell

Section titled “The cursor changes for each component placed within a JList cell”
The cursor changes for each component placed within a JList cell

CursorOfCellComponent

Search for the component placed in a JList cell based on the mouse coordinates, and apply the cursor set on that component to the JList.

Change the resize cursor for JSplitPane and TableColumn

Section titled “Change the resize cursor for JSplitPane and TableColumn”
Change the resize cursor for JSplitPane and TableColumn

ResizeColumnCursor

This modifies the mouse cursor displayed when resizing components in JSplitPane's Divider or JTableHeader's TableColumn.