mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
FormattedTextField: On Linux, fixed IllegalArgumentException: Invalid location if JFormattedTextField.setDocument() is invoked in a focus gained listener on that formatted text field. (issue #698)
This commit is contained in:
@@ -30,6 +30,9 @@ FlatLaf Change Log
|
|||||||
- Native Windows libraries: Fixed crash when running in Java 8 and newer Java
|
- Native Windows libraries: Fixed crash when running in Java 8 and newer Java
|
||||||
version is installed in `PATH` environment variable and using class
|
version is installed in `PATH` environment variable and using class
|
||||||
`SystemInfo` before AWT initialization. (issue #673)
|
`SystemInfo` before AWT initialization. (issue #673)
|
||||||
|
- FormattedTextField: On Linux, fixed `IllegalArgumentException: Invalid
|
||||||
|
location` if `JFormattedTextField.setDocument()` is invoked in a focus gained
|
||||||
|
listener on that formatted text field. (issue #698)
|
||||||
|
|
||||||
|
|
||||||
## 3.1.1
|
## 3.1.1
|
||||||
|
|||||||
@@ -256,10 +256,14 @@ public class FlatCaret
|
|||||||
// select all
|
// select all
|
||||||
if( c instanceof JFormattedTextField ) {
|
if( c instanceof JFormattedTextField ) {
|
||||||
EventQueue.invokeLater( () -> {
|
EventQueue.invokeLater( () -> {
|
||||||
if( getComponent() == null )
|
// Warning: do not use variables from outside of this runnable
|
||||||
|
// because they may be out-of-date when this runnable is executed
|
||||||
|
|
||||||
|
JTextComponent c2 = getComponent();
|
||||||
|
if( c2 == null )
|
||||||
return; // was deinstalled
|
return; // was deinstalled
|
||||||
|
|
||||||
select( 0, doc.getLength() );
|
select( 0, c2.getDocument().getLength() );
|
||||||
} );
|
} );
|
||||||
} else {
|
} else {
|
||||||
select( 0, doc.getLength() );
|
select( 0, doc.getLength() );
|
||||||
|
|||||||
Reference in New Issue
Block a user