java - selecting (highlighting) the text of jdatechooser when focus gained -
im looking line of code, select (highlight) date-text-string in jdatechooser when gets focused.
i read might have .selectall();
. cant access textfield of jdatechooser.
also jdatechooser.selectonfocus(true);
wont compile. netbeans says: "cannot find symbol". eventhough have imported:
import com.toedter.calendar.jdatechooser; import com.toedter.calendar.demo.datechooserpanel;
any ideas ?
jdatechooser datechooser = new jdatechooser(new date()); datechooser.getdateeditor().getuicomponent().addfocuslistener(new focusadapter() { @override public void focusgained(focusevent evt) { ((jtextfielddateeditor)evt.getsource()).selectall(); } });
Comments
Post a Comment