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

Wrong Spinner text color inside TabPane #227

Open
runiter opened this issue Jun 20, 2023 · 5 comments
Open

Wrong Spinner text color inside TabPane #227

runiter opened this issue Jun 20, 2023 · 5 comments

Comments

@runiter
Copy link

runiter commented Jun 20, 2023

I came across a very specific scenario which causes Spinner text color to change into wrong color.

Here is the code to reproduce it:

public class Test extends Application {
	public void start(Stage stage) throws IOException {
		TabPane tabPane1 = new TabPane(new Tab("Tab1", new Spinner<>(0, 10, 5)));
		TabPane tabPane2 = new TabPane(new Tab("Tab1"), new Tab("Tab2"));
		VBox vbox = new VBox(tabPane1, tabPane2);
		Scene scene = new Scene(vbox);
		stage.setScene(scene);
		new JMetro(scene, Style.DARK);
		stage.show();
	}
}

If you run the above code, initially it shows correct color for spinner text (white):

image

But if you click on Tab2 then the color of spinner text changes from white to black:

image

@dukke
Copy link
Member

dukke commented Oct 9, 2023

HI Saeid,

I've spent quite some time with this but still haven't figured exactly what's wrong.

So far, I've discovered that this only happens when the Spinner control is inside a TabPane.

@runiter
Copy link
Author

runiter commented Oct 10, 2023

Hi Pedro,
Yeah it's a tough one. When I debugged it I noticed that a method is called that keeps setting the text color to default hence overriding your css value. Not sure why that is only triggered when spinner is inside TabPane though!

@dukke
Copy link
Member

dukke commented Oct 10, 2023

@runiter
Can you do the following:
Create the same simple application you posted here and don't use JMetro. Instead, use a custom stylesheet that simply changes the text color of spinners to a specific color (say red or some other color).

Something like:

.spinner > .text-field {
    -fx-text-fill: red;
}

See if the color still changes to black like it's changing in your example...
If it does, then it means it is an issue with javafx and not JMetro and we need to submit an issue to the javafx team (I suspect this is the case).

@dukke
Copy link
Member

dukke commented Oct 11, 2023

... tell me your findings when you do :)

@runiter
Copy link
Author

runiter commented Oct 29, 2023

Sorry for delay.
I tried the css your suggest and nope it did not change color to red. The problem with black text persists.
Looks like the css gets overriden for jspinner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants