-
Bug
-
Resolution: Not an Issue
-
P3
-
9
-
x86_64
-
windows
FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
We call JToggleButton#setBorderPainted(false).
With Java 9 and Windows LF (other LF not tested) the button has no longer a visual inidicator when the button is toggled in contrary to Java 8 where the button is light-blue-gray.
Tested with Java 9 b177, 8 u102, 8 u131, 8 u144 on Windows 7 and Windows 2012 R2.
It was recommended to fill a bug for this:
http://mail.openjdk.java.net/pipermail/swing-dev/2017-July/007663.html
REGRESSION. Last worked in version 8u144
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the reproducer.
Toggle/untoggle the JToggleButton and see that there is no visual difference (set focus to JTextField after toggle/untoggle).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import java.awt.BorderLayout;
import java.awt.EventQueue;
public final class Reproducer {
public static void main(String[] args) throws Exception {
EventQueue.invokeAndWait(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
});
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
JTextField text = new JTextField();
JToggleButton button = new JToggleButton("Test");
button.setBorderPainted(false);
JPanel pane = new JPanel(new BorderLayout());
pane.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
pane.add(text, BorderLayout.NORTH);
pane.add(button, BorderLayout.SOUTH);
JFrame frame = new JFrame();
frame.getContentPane().add(pane);
frame.setSize(200, 200);
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Do not call JToggleButton#setBorderPainted(false).
A DESCRIPTION OF THE PROBLEM :
We call JToggleButton#setBorderPainted(false).
With Java 9 and Windows LF (other LF not tested) the button has no longer a visual inidicator when the button is toggled in contrary to Java 8 where the button is light-blue-gray.
Tested with Java 9 b177, 8 u102, 8 u131, 8 u144 on Windows 7 and Windows 2012 R2.
It was recommended to fill a bug for this:
http://mail.openjdk.java.net/pipermail/swing-dev/2017-July/007663.html
REGRESSION. Last worked in version 8u144
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the reproducer.
Toggle/untoggle the JToggleButton and see that there is no visual difference (set focus to JTextField after toggle/untoggle).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import java.awt.BorderLayout;
import java.awt.EventQueue;
public final class Reproducer {
public static void main(String[] args) throws Exception {
EventQueue.invokeAndWait(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
});
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
JTextField text = new JTextField();
JToggleButton button = new JToggleButton("Test");
button.setBorderPainted(false);
JPanel pane = new JPanel(new BorderLayout());
pane.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
pane.add(text, BorderLayout.NORTH);
pane.add(button, BorderLayout.SOUTH);
JFrame frame = new JFrame();
frame.getContentPane().add(pane);
frame.setSize(200, 200);
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Do not call JToggleButton#setBorderPainted(false).