Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing support for labelFor property in javafx.scene.control.Label #55

Open
gluon-bot opened this issue Feb 2, 2016 · 4 comments
Open
Labels
enhancement New feature or request major

Comments

@gluon-bot
Copy link

Originally reported by: Anonymous


It seems that SceneBuilder has added support for the accessibility fields added recently (in JDK8_40?) but it still missing the support for the basic labelFor property of the javafx.scene.control.Label class.

This attribute can be set manually in the FXML by doing:

Unfortunately SceneBuilder will erase those values if you happen to open the FXML later in it.


@gluon-bot
Copy link
Author

Original comment by gerardo balderas (Bitbucket: gbalderas, GitHub: gbalderas):


If the labelFor is pointing to an fxid, it will not be removed. But if the fxid is changed it will be removed. I think it is because it cannot find a reference to it anymore.

I think this issue is a bit unclear, do you want to be able to set the labelFor property directly from the SceneBuilder or just that it won't be removed or update it when the fxid changes?

@gluon-bot
Copy link
Author

Original comment by Fabrice Bouyé (Bitbucket: fabricebouye, GitHub: fabricebouye):


Back and authenticated this time.

In my experience (8.1.0) it is removed every time from the FXML when editing with SceneBuilder. It should NEVER be removed if defined in the FXML.

It's pretty clear that this property needs to have support in SceneBuilder's UI. Currently there is no field to set this property in the UI.

Also there is currently a JavaFX / FXML bug related to that property : [FXML] setting labelFor on FXML is complicated (https://bugs.openjdk.java.net/browse/JDK-8090250) which makes the value appear null after the FXML has been loaded because FXMLLoader does not do a second pass after loading an FXML to resolve unresolved ids.

@gluon-bot gluon-bot added major enhancement New feature or request labels May 9, 2018
abhinayagarwal added a commit that referenced this issue May 9, 2018
…pe (pull request #55)

Issue 158/including fxml fails with npe

Approved-by: Jose Pereda <[email protected]>
Approved-by: Joeri Sykora <[email protected]>
@DesertCookie
Copy link

This issue still persists with Scene Builder 20.0.0. using Java and JavaFX 20.0.1.

@Locke
Copy link

Locke commented Mar 5, 2024

As there were two points raised, it is not clear what "This issue still persists" from the previous comment refers to, so I'm writing this a bit more verbose.

I'm using the same version: JavaFX Scene Builder 20.0.0 with JavaFX Version: 20.0.1 on Java 20.0.1.

  1. The labelFor attribute does not get removed for me, so that issues seems resolved or there is a more specific bug.

Given that JDK-8090250 mentions that the order of elements matters, I have the following FXML, where I placed the TextField before the Label. When I open, modify, and save the file in SceneBuilder, the labelFor property remains.

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.VBox?>

<VBox xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1">
	<children>
		<GridPane>
			<children>
				<TextField fx:id="myCustomField" GridPane.columnIndex="1" />
				<Label labelFor="$myCustomField" text="My Custom Label" />
			</children>
		</GridPane>
	</children>
</VBox>
  1. Support for the labelFor attribute in the UI (e.g. having a field in the properties / code panel) is still missing in the SceneBuilder version I'm using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request major
Projects
None yet
Development

No branches or pull requests

3 participants