--start--
Sample code:
int i = textfield.getText().length();
textfield.setSelectionStart(0);
textfield.setSelectionEnd(i);
Put this in the action or wherever you want it. Replace textfield variable to the name of your textfield. I'm not sure but this might work for JTextArea and JTextPane too.
--end---
Showing posts with label textfield. Show all posts
Showing posts with label textfield. Show all posts
Thursday, July 15, 2010
Monday, November 23, 2009
How to Add Formatted Text Field in Netbeans: Limit the Input in Java Text Field
---
Formatted text field is a feature in Java programming that lets you control the input in your JTextFields.
In Netbeans IDE, you cannot just edit the codes anywhere you like it if the GUI is generated by the IDE. This may mean that putting your formatting code would take you some time by overriding the class, function, etc (That's how you usually customize Netbeans - generated codes). However, there's a shorter way to do that, follow these steps:




1. Right click on the JFormattedTextField and select Customize Code
Labels:
formatting,
Java,
JFormattedTextField,
Netbeans,
textfield



