Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / February 2006

Tip: Looking for answers? Try searching our database.

Label in a dialog box

Thread view: 
fb - 14 Feb 2006 04:08 GMT
Hello.  I can't seem to figure out why my Label won't appear in my
Dialog box....Any Ideas?

//here is the dialog window
class AboutDialog extends Dialog {
    //do the setup of the window in the constructor
    AboutDialog(Frame in_frame, String in_title, boolean in_modal) {

        super(in_frame,in_title,in_modal);  // Call ancestor

        //Get the location of parent; add 50
        Point theP = in_frame.getLocation();
        this.setLocation(theP.x + 50, theP.y + 50);
        this.setSize(200,200);

        // add components to the Dialog window
        Panel diPanel = new Panel();
        Label nameLabel = new Label("Created by some guy");
        diPanel.add(nameLabel);

        ExitDialogL theDL = new ExitDialogL(this);
        this.addWindowListener(theDL);       // have Dialog window take
care of its own window close events
    }

......
......
......
etc.
fb - 14 Feb 2006 04:19 GMT
> Hello.  I can't seem to figure out why my Label won't appear in my
> Dialog box....Any Ideas?

Nevermind...Figured it out.  Somehow I forgot to add the Panel...Oops.  :-)
Roedy Green - 14 Feb 2006 04:20 GMT
>         this.setLocation(theP.x + 50, theP.y + 50);
>         this.setSize(200,200);

The default layout for a dialog is BorderLayout..

Use a proper layout or at least set the layout  to null if you want to
code in C.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Vivek - 14 Feb 2006 05:06 GMT
Hi,

See if you have added the panel to the dialog after adding the label to
the panel.
otherwise, do it.

Luck.
vivek

> Hello.  I can't seem to figure out why my Label won't appear in my
> Dialog box....Any Ideas?
[quoted text clipped - 25 lines]
> ......
> etc.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.