Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDialog Dilemma I Have

 
Karen Baog
Ranch Hand
Posts: 120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a simple problem that I know most of you guys would know the answer in an instant, and willing to help your humankind.

I have a JDialog. On it is a JButton.
I want this JDialog to be modal, I set it to setModal(true).
Fair enough.
I have an actionEvent for the JButton press.

The problem is, because it's set to Modal, it won't process the actionEvent.

What I am trying to do here is make a JDialog with a JButton (the easiest part). It must be modal so the the JButton must be pressed to close this JDialog (call it dialog1). It then creates another JDialog (call it dialog2). This dialog2 has a Jbutton, which also must be pressed to close it.

Very familiar. Hoepfully lots of you there would provide help.

Thanks much, guys!
 
Karen Baog
Ranch Hand
Posts: 120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys!

I can close it now. However, in the JDialog is a JTextArea,
how do I handle the event (and which method) when there is no text input to the JTextArea?

I don't want the JDialog to close if the JTextArea is blank.
 
Giovanni De Stefano
Ranch Hand
Posts: 154
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karen,
it's fairly simple: before you close the JDialog you have to check if there is no text input in the JTextArea, you simply do this checking if the getText() method of JTextArea returns an empty string or not.

I hope this helps.

Giovanni
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic