Skip to content

Cursor bug on the borders of the frame if the mouse button is pressed. #1034

@SPV-code

Description

@SPV-code

Hello.

FlatLaf - 3.6.1
OS - linux
JFrame.setDefaultLookAndFeelDecorated(true)

Problem:
If you hold down the mouse button on any interface element (for example, a button), and without releasing it, move the cursor to the border of the frame, the cursor will change (for example, N_RESIZE_CURSOR).
If you continue to move the cursor outside or inside the frame, the cursor will remain N_RESIZE_CURSOR ...

For an example, see the attached video: https://github.com/user-attachments/assets/5eab19b4-1bd1-45c5-8faa-58490c915274

I solved this problem like this:

mainFrame.rootPane.border  = null
val rpBorderColor  = UIManager. getColor("RootPane.activeBorderColor") 
mainFrame.rootPane.apply {
    if (UIManager.getLookAndFeel().name != "Metal") if (JFrame.isDefaultLookAndFeelDecorated()){
    (components[1] as JComponent).border = createMatteBorder(1, 1, 0, 1, rpBorderColor)
    (components[2] as JComponent).border = createMatteBorder(0, 1, 1, 1, rpBorderColor)
    (components[3] as JComponent).border = createMatteBorder(0, 1, 0, 0, rpBorderColor)
    (components[4] as JComponent).border = createMatteBorder(0, 0, 0, 1, rpBorderColor)
}

But it's not a pretty solution.
Is it possible to fix this problem in the FlatLaf library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions