I have a jFormatted textfield with a numeric mask.
This means that when you click on the field, the cursor is positioned where the user has clicked, instead of at the beginning, since it is filled with placeholders .
How can I modify this, keeping the numerical restriction?
code:
MaskFormatter formatter;
txtNum_1 = new JFormattedTextField();
try {
formatter = new MaskFormatter("#########");
formatter.install(txtNum_1);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
txtNum_1.setHorizontalAlignment(JFormattedTextField.LEFT);
txtNum_1.setCaretPosition(JFormattedTextField.LEFT); // No funciona