[solved] Toggling Swing Anti-Aliasing on the fly

Hey JGO, I’m trying to add onto my low quality gfx/high quality gfx buttons for my game and when I switch to low quality I’d like to disable anti-aliasing for certain swing components.

The code to disable it on the fly works as expected, but when I try to re-enable it using the same code but a boolean value of true this time it doesn’t update back to anti-aliasing?

First time using/hearing about this method so any help’s appreciated :slight_smile:

CODE:


// Obtain all the children of our frames content pane
for (Component e : GameWindow.frame.getContentPane().getComponents()) {

	// If it's a JButton (Trial)
	if (e instanceof JButton) {
		JButton source = (JButton) e;
							
		// Disable anti-aliasing.
		source.putClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, false);	
	 
		// Show our changes.
		source.repaint();
	}
}