-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Invalid Location #698
Comments
The exception is triggered when focusing a text component. |
…d location` if `JFormattedTextField.setDocument()` is invoked in a focus gained listener on that formatted text field. (issue #698)
Was able to reproduce such an exception. Occurs only on Linux for Here is a test case. To reproduce
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.text.PlainDocument;
import com.formdev.flatlaf.FlatLightLaf;
public class TestCaret
{
public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatLightLaf.setup();
JFrame frame = new JFrame();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
JFormattedTextField ftf = new JFormattedTextField();
ftf.setText( "formatted text field" );
ftf.setColumns( 30 );
ftf.addFocusListener( new FocusAdapter() {
@Override
public void focusGained( FocusEvent e ) {
ftf.setDocument( new PlainDocument() );
}
} );
Container contentPane = frame.getContentPane();
contentPane.add( new JTextField( "text field" ), BorderLayout.NORTH );
contentPane.add( ftf, BorderLayout.CENTER );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible( true );
} );
}
} |
Thanks for reporting 👍 fixed in latest |
Came across this clicking a window (I think, not 100% what triggered it) in Ghidra 10.3.1 (NationalSecurityAgency/ghidra#5539), which ships with FlatLaf 2.6, and using ubuntu 22.04 and JDK 17.0.7. Not sure if there's enough info to go off of, but figured worth reporting here too in case.
The text was updated successfully, but these errors were encountered: