apache / apache/netbeans

Matisse Swing GUI Editor thinks JToolBar's "floatable" property is false by default

Open
#8,771 3 comments 0 reactions 0 assignees View on GitHub
FormDesigner kind:bug Look and Feel needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 27

### What happened

Upon changes with Matisse that cause Swing GUI code regenerating, `*.setFloatable(false)` lines get removed for all JToolBar instances, if present previously for the edited form. New instances added via Matisse never get the line generated.

This bean property is `true` [by default](https://github.com/openjdk/jdk/blame/master/src/java.desktop/share/classes/javax/swing/JToolBar.java#L365) in the JDK. Yet Matisse treats it as if the default were `false`, evident by the way it is displayed in Netbeans. Immediately after adding a new JToolBar to a container component via Matisse, there's no bold text for "floatable" in Properties tab/table for it and the associated checkbox is unchecked.

Image

This means the user cannot set this property to `false` via the above checkbox for the code generator to pick up.

The expected behavior is: immediately after adding a JToolBar component to a container component via Matisse, the "floatable" property is indeed set to `false` (unchecked checkbox), but appears with the bold text in the Properties tab/table and is also treated accordingly by the generator.

Image

This is what this functionality worked as in older NB versions before this issue being introduced. I do not know when this happened, but we currently have classes that were generated in two different ways, since some were not touched in a while. All generated `.form` XML files (for JFrames) start with ` New Project... > Java with Ant > Java Application" to create a new project. Leave all fields as they are offered by default.
2. Under Projects tab, right-click the only java package entry ("javaapplication1") and choose "New > JFrame Form...", leave defaults and confirm.
3. Switch to Design mode for the newly created JFrame ("NewJFrame").
4. Under Navigator tab for NewJFrame, right-click `[JFrame]` tree node, then "Add From Palette > Swing Containers > Tool Bar".
5. Select the newly added JToolBar and observe set properties under Properties tab/table.

Example project (ignore creation timestamps, the VM's system time was not synced):
[JavaApplication1.zip](https://github.com/user-attachments/files/22023818/JavaApplication1.zip)

### Did this work correctly in an earlier version?

Yes, unknown which.

### Operating System

Windows 10 and 11

### JDK

The one bundled with Windows NB installers

### Apache NetBeans packaging

FoAN provided installer

### Anything else

Always reproducible. I tested in a Windows 10 22H2 virtual machine with a freshly installed [NB 27](https://installers.friendsofapachenetbeans.org/).
There may be other bean properties that are also affected - did not check.

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in the Matisse Swing GUI Editor using the listed Java with Ant steps, then inspect the JToolBar floatable property in the Properties tab and generated .form and Java output. Trace how the property is treated when a toolbar is added and when form code is regenerated. Done means the unchecked property is shown as explicitly changed and false is preserved or generated for JToolBar instances.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.