Reputation: 19444
In the catch block I want to display a error message to textArea to display the error happening.
Upvotes: 0
Views: 117
Reputation: 17648
A catch block does not limit the methods you can call in any way : it is only different from the try block above it in that it is not, as is, in a exception handling scope.
Thus, you can
1) enclose the call to Any exception throwing gui elements, in the catch block, inside another try/catch
Or simpler
2) Simply use a component like JoptionPane which will safely launch an exception-less dialog box.
Upvotes: 2
Reputation: 44808
Since you are not on the EDT, you can use SwingUtilities#invokeLater
to safely perform your action on the EDT.
Upvotes: 6