• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dialog Box

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can I display Dialog without extending class as Frame or Window?
If yes, how? Would you please explain me by simple example?
Thanks in advance,
angela
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This should really be in the Swing/JFC/AWT forum, so I'm transferring it...
 
Jim Yingst
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A java.awt.Dialog is already an extension of java.awt.Window, so you can't change that. I suppose it might be possible to create a Dialog-like component that des not extend Window, but why? What's wrong with using a Window?
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank Jim,
Here is my code:
import java.applet.Applet;
import java.awt.*;
public class myDialog extends Frame
{
Dialog md ;
myDialog()
{
md = new Dialog(this, "Error Message Window");
Panel p = new Panel();
Label l = new Label("No Server Response");
p.add(l);
md.add("Center" ,p);
Panel p2 = new Panel();
p2.setLayout(new FlowLayout());
Button ok = new Button("Retry");
Button cancel = new Button("Cancel");
p2.add(ok);
p2.add(cancel);
md.add("South",p2);

}
public static void main(String args[])
{
myDialog theApp = new myDialog();
theApp.show();
}
}
I want to display dialog box without extending class to Frame?
Please let me know how can I do it?
THanks again
angela
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a dialog class I made as a practice exercise:

An application that would *use* this mcDialog class, would need to extend Frame. (typically, dialogs require a frame as a parent, however I've seen programs send null)
The comment about VB was for me, since I come from a VB Background. In fact, now that I take a second look, the comment is wrong. dispose() is like Me.hide, and not at all like Unload Me.
[This message has been edited by Mike Curwen (edited March 27, 2001).]
 
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic