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

Selected JButtons do not respect setForeground(color) #756

Closed
eclab opened this issue Oct 26, 2023 · 2 comments
Closed

Selected JButtons do not respect setForeground(color) #756

eclab opened this issue Oct 26, 2023 · 2 comments
Milestone

Comments

@eclab
Copy link

eclab commented Oct 26, 2023

Tested on MacOS 12.6 Java 20.2 or Java 1.8.0, flatlaf-3.2.2.jar

Expected Behavior: Non-HTML selected buttons can have their text colored via setForeground(color).

Errant Result: Non-HTML selected buttons ignore setForeground(color). HTML works fine, and unselected buttons work fine. JButtons without flatlaf can be colored fine.

import javax.swing.*;
import java.awt.*;
import com.formdev.flatlaf.*;

public class Example
	{
	public static void main(String[] args)
		{
		FlatLightLaf.setup();			// Comment out to see difference
		
		JFrame frame = new JFrame();
		Box box = new Box(BoxLayout.Y_AXIS);
		JButton button = new JButton("Selected Normal");
		button.setSelected(true);
		box.add(button);
		button = new JButton("Selected Blue");
		button.setForeground(Color.BLUE);
		button.setSelected(true);
		box.add(button);
		button = new JButton("<html><font color=blue>Selected Blue HTML</font></html>");
		button.setSelected(true);
		box.add(button);
		button = new JButton("Unselected Normal");
		box.add(button);
		button = new JButton("Unselected Blue");
		button.setForeground(Color.BLUE);
		box.add(button);
		button = new JButton("<html><font color=blue>Unselected Blue HTML</font></html>");
		box.add(button);
		frame.add(box);
		frame.setVisible(true);
		}
	}
DevCharly added a commit that referenced this issue Oct 31, 2023
@DevCharly
Copy link
Collaborator

Thanks for reporting.

fixed in latest 3.3-SNAPSHOT: https://github.com/JFormDesigner/FlatLaf#snapshots

@DevCharly DevCharly added this to the 3.3 milestone Oct 31, 2023
@eclab
Copy link
Author

eclab commented Oct 31, 2023

Works!

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