Doubt with SetFocus ()


I have an exercise and it says that I have to use setFocus() to select the content of a table and to gain focus. Then use the selectAll() to select it. But I do not understand anything.

Can someone explain to me with an example how it works?

That is, I have a box X and when I get an error I have to point it out with selectAll() and then do setFocus() .

The program I'm doing with Java - SWT through WindowsBuilder.

asked by Montse Mkd 11.04.2016 в 18:28

1 answer


Solved, I put a part of my code:

if(data.probarEquiv1()==3) {
    JOptionPane.showMessageDialog(null, "Error a Primera Divisa");

That is the table we want to focus on PrimeraDivisaTXT

This code what does is that if the user when entering the data Equiv1 enters it wrong the system notifies you with a JOptionPane that there is an error and then takes the focus in the box where the error is ( that is, the box PrimeraDivisaTXT )

answered by 12.04.2016 / 23:27