This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Originally posted by Chris Fetterley: I was wondering if there was an easy way to have textfields deslected until data was entered into the one above it, is there an easy way to do this?
Sure, you just start with your label font grayed out and the TextFeild set to setEditable(false);. Then put a TextListener on the field above it, and in the textValueChanged method, check to make sure that a real value was entered. You probably want to make sure that the length of the entered text is at least one. Then in that method change the font of the label to black and do a setEditable(true) on the blocked componenent. You probably do not want to be re-setting this with every letter that is typed, so you might want to start out with a preliminary check to see if the target field is already editable and then just skip the rest.
"JavaRanch, where the deer and the Certified play" - David O'Meara