Forums Register Login

JOptionPane issue

+Pie Number of slices to send: Send
I have an applet, which displays a drawing and allows user to measure area by drawing lines. When the last drawn line intersects another line I display a JOptionPane with warning message for self-intersection. After the user presses the OK button my applet does not regain the focus, so ESC key cannot be used also the wrong line cannot be removed. Tried requestFocus and requestFocusWindow without success. How to regain focus after JOptionPane is closed? Thanks in advance.
+Pie Number of slices to send: Send
You'll probably need to use EventQueue.invokeLater / SwingUtilities.invokeLater, to make sure the focus event is processed correctly:
+Pie Number of slices to send: Send
Using invokeLater does not help, the same issue still occurs. Any other suggestions?
+Pie Number of slices to send: Send
To get better help sooner, post a SSCCE that clearly demonstrates your problem.
+Pie Number of slices to send: Send
This is my function which displays JOptionPane with Warning message in case of self-intersection.


The problem is that after JOptionPane is closed my applet does not gain the focus again, so it cannot capture ESC key pressed and also the applet is not redrawn properly.
+Pie Number of slices to send: Send
vladislav, what part of the SSCCE page wasn't clear to you?
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1536 times.
Similar Threads
"Java Applet Window" message
JOptionPane question
How to make Large JOptionPane?
JOptionPane.showMessageDialog does not return focus to the applet.
JOptionPane does not repaint properly on close
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:10:52.