Skip to content

Conversation

@Ziad-Mid
Copy link
Contributor

@Ziad-Mid Ziad-Mid commented Nov 26, 2025

The issue occurred because the skin marks the button cell as “empty” when the value becomes null.
With the fix clearing the ComboBox value re-shows the prompt text.
Tested using the code present in the bug.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8296653: ComboBox promptText is not displayed when the value is reset (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1989/head:pull/1989
$ git checkout pull/1989

Update a local copy of the PR:
$ git checkout pull/1989
$ git pull https://git.openjdk.org/jfx.git pull/1989/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1989

View PR using the GUI difftool:
$ git pr show -t 1989

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1989.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 26, 2025

👋 Welcome back zelmidaoui! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 26, 2025

@Ziad-Mid This change is no longer ready for integration - check the PR body for details.

@openjdk openjdk bot added the rfr Ready for review label Nov 26, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 26, 2025

Webrevs

Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually tested the program attached to the bug. Change fixes the bug.
Can you please try for adding a test.

if (empty) {
if (cell == null) return true;

// JDK-8296653
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally don't include the bug id. Please remove.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we can add a comment to explain the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the code could you please re review

@openjdk openjdk bot added the ready Ready to be integrated label Nov 27, 2025
Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correcting the comment

@openjdk openjdk bot removed the ready Ready to be integrated label Nov 27, 2025
@Maran23
Copy link
Member

Maran23 commented Nov 27, 2025

I think a test would be good here.

@Ziad-Mid Ziad-Mid requested a review from arapte November 27, 2025 14:37
@Ziad-Mid
Copy link
Contributor Author

I think a test would be good here.

I have added one could you please re-review


@Test
public void testPromptTextRestoredAfterSetValueNull() {
comboBox.setPromptText("Select Value");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to have a String variable with "Select Value" as value. And then use it here and the other two occurrences

SingleSelectionModel<String> sm = comboBox.getSelectionModel();
sl = new StageLoader(comboBox);
comboBox.applyCss();
comboBox.show();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applyCss and show are not needed, should be removed

// Select an item
sm.select(2);
Toolkit.getToolkit().firePulse();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An assert that the buttonCell is not Select Value would make sense here (assertNotEquals)


if (cell == buttonCell) {
final String promptText = comboBox.getPromptText();
if (comboBox.getValue() == null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the comboBox.getValue() check needed? Asking, as we are in here only if empty is true, so maybe this is not needed to check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rfr Ready for review

Development

Successfully merging this pull request may close these issues.

3 participants