Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JDialog to JFrame - thoughts pls

Reply
Thread Tools

JDialog to JFrame - thoughts pls

 
 
Ike
Guest
Posts: n/a
 
      02-27-2004
I have recently had to convert a JDialog to a JFrame (this is MessageDialog
dialog in the method below, which is now a JFrame). Initially, when this was
a dialog, once constructed at the line where dialog = new MessageDialog(..),
execution would then wait until the dialog was closed.

However, under a JFrame, this line is executed, and the code runs right on
through, causing trouble of course. I'd like to have execution essentially
"wait," in this method, is it had when dialog was derived from JDialog, and
am querying for your thoughts on how this may be done with as little
rewriting as possible. Thanks, Ike

// Send the specified message.
private void sendMessage(int type, Message message) {
// Display message dialog to get message values.
MessageDialog dialog;
try {
dialog = new
MessageDialog(owner.gguser,owner.frame/*RalphVince.Misc.RalphFunctions.getJF
rameForComponent(this)*/, type, message);
/////////////////////////// THIS IS WHERE EXECUTION USED TO 'WAIT' UNTIL
dialog was closed /////////////////////
if (!dialog.display()) {
// Return if dialog was cancelled.
return;
}
} catch (Exception e) {
showError("Unable to send message.", false);
return;
}

try {
// Create a new message with values from dialog.
Message newMessage = new MimeMessage(session);
newMessage.setFrom(new InternetAddress(dialog.getFrom()));
Address addy = new InternetAddress(dialog.getTo());
newMessage.setRecipient(Message.RecipientType.TO,a ddy);
newMessage.setSubject(dialog.getSubject());
newMessage.setSentDate(new Date());
newMessage.setText(dialog.getContent());

// Send new message.
Transport.send(newMessage);
} catch (Exception e) {
showError("Unable to send message.", false);
}
}


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving To JDialog From JFrame: NetBeans Design View Has JFrameWithout A Variable Name clusardi2k@aol.com Java 3 08-27-2012 02:58 PM
Event when JFileChooser, JDialog, or JFrame is setVisible'd, eithertrue or false Ross Java 1 08-19-2011 09:25 AM
start a new JFrame from an existing one, and when old JFrame closes new one does not jakester Java 3 04-02-2007 11:13 PM
Change Look & Feel in open JFrame s & JDialog s Java 6 10-01-2004 02:09 PM
about resizeable problem in JFrame/JDialog!!! James Java 1 09-20-2004 04:17 PM



Advertisments