setUndecorated() isDisplayable() and Parent Frames

Discussion in 'Java' started by Daniel Pitts, Mar 22, 2007.

  1. Daniel Pitts

    Daniel Pitts Guest

    On Mar 22, 3:50 pm, "Richard Maher" <>
    wrote:
    > Hi,
    >
    > Below is the question I was about to post before it occured to me that I was
    > just making another schoolboy error and attempting to change the parent
    > frame instead of the frame for my new dialog box.
    >
    > OK, that problem is fixed, but can someone tell me if the parent frame for
    > such an Applet is in fact the Browser? And if so, is it concievable that
    > methods such a parentFrame.setTitle("Unlikely") and repaint() (send events,
    > minimise) would work on the browser? Given that one's an apple and the
    > other is a pineapple it could be ludicrous to suggest the possibility of
    > such tight coupling, but then surely only forces beyond my understanding
    > could put the Browser frame in an inventory available to getParent()?
    >
    > Cheers Richard Maher
    >
    > Hi,
    >
    > I have an Applet that is being invoked in a web browser that has html
    > "width" and "height" both set at 0. In the init() method I want to create a
    > dialog box and need a Frame so I have been using the following logic to
    > locate one: -
    >
    > Object parentFrame = getParent();
    > while ((parentFrame != null) &&
    > !(parentFrame instanceof Frame))
    > {
    > parentFrame = ((Component)parentFrame).getParent();
    > }
    >
    > Frame creds = (Frame)parentFrame;
    > : : : :
    > Tier3Welcome welcome = new Tier3Welcome(creds, appl, pipe.t3IdBuf);
    >
    > In Tier3Welcome I do: -
    >
    > public class Tier3Welcome extends Dialog
    > implements ActionListener
    >
    > public Tier3Welcome(Frame wframe, String AppName, byte[] t3IdBuf)
    > {
    > super(wframe,"Tier3 Confirmation",true);
    >
    > What I'd like to do now is wframe.setUndecorated(true); but I'm getting the
    > well-documented IllegalComponentStateException. I've looked up the docs for
    > Component.isDisplayable() but am still none the wiser as to how to make my
    > Frame "undisplayable" long enough to make it "undecorated". Should I forget
    > about getting a "parent" frame and just Frame x = new Frame(); and pass in X
    >
    > to my Tier3Welcome class? What is the Parent Frame anyway? The Browser?
    > Portion of the Browser?
    >
    > <epiphany here: "this".setUndectorated(true) *not* "wframe"> - Doh!
    >
    > Cheers Richard Maher


    My guess is that the parent for an Applet is null, and for an Dialog
    it is the owning window, which is still in Java land, not browser land.
     
    Daniel Pitts, Mar 22, 2007
    #1
    1. Advertising

  2. Daniel Pitts wrote:
    > My guess is that the parent for an Applet is null, and for an Dialog
    > it is the owning window, which is still in Java land, not browser land.


    Your guess is correct for Applet in the general case (i.e., it is
    probably null except in exceptional circumstances).

    For Dialog, getParent() should return null, seeing as neither Window nor
    Dialog overrides getParent().
     
    Joshua Cranmer, Mar 22, 2007
    #2
    1. Advertising

  3. Hi,

    Below is the question I was about to post before it occured to me that I was
    just making another schoolboy error and attempting to change the parent
    frame instead of the frame for my new dialog box.

    OK, that problem is fixed, but can someone tell me if the parent frame for
    such an Applet is in fact the Browser? And if so, is it concievable that
    methods such a parentFrame.setTitle("Unlikely") and repaint() (send events,
    minimise) would work on the browser? Given that one's an apple and the
    other is a pineapple it could be ludicrous to suggest the possibility of
    such tight coupling, but then surely only forces beyond my understanding
    could put the Browser frame in an inventory available to getParent()?

    Cheers Richard Maher

    Hi,

    I have an Applet that is being invoked in a web browser that has html
    "width" and "height" both set at 0. In the init() method I want to create a
    dialog box and need a Frame so I have been using the following logic to
    locate one: -

    Object parentFrame = getParent();
    while ((parentFrame != null) &&
    !(parentFrame instanceof Frame))
    {
    parentFrame = ((Component)parentFrame).getParent();
    }

    Frame creds = (Frame)parentFrame;
    : : : :
    Tier3Welcome welcome = new Tier3Welcome(creds, appl, pipe.t3IdBuf);

    In Tier3Welcome I do: -

    public class Tier3Welcome extends Dialog
    implements ActionListener

    public Tier3Welcome(Frame wframe, String AppName, byte[] t3IdBuf)
    {
    super(wframe,"Tier3 Confirmation",true);

    What I'd like to do now is wframe.setUndecorated(true); but I'm getting the
    well-documented IllegalComponentStateException. I've looked up the docs for
    Component.isDisplayable() but am still none the wiser as to how to make my
    Frame "undisplayable" long enough to make it "undecorated". Should I forget
    about getting a "parent" frame and just Frame x = new Frame(); and pass in X

    to my Tier3Welcome class? What is the Parent Frame anyway? The Browser?
    Portion of the Browser?

    <epiphany here: "this".setUndectorated(true) *not* "wframe"> - Doh!

    Cheers Richard Maher
     
    Richard Maher, Mar 22, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Powerslave2112

    From Frames to no frames?

    Powerslave2112, Jan 20, 2004, in forum: HTML
    Replies:
    2
    Views:
    620
    brucie
    Jan 20, 2004
  2. Philip
    Replies:
    3
    Views:
    992
    Karl Groves
    Jun 28, 2004
  3. Replies:
    1
    Views:
    1,017
    dorayme
    Feb 10, 2006
  4. Replies:
    3
    Views:
    128
  5. PD
    Replies:
    6
    Views:
    730
Loading...

Share This Page