🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12912

Re: getParent-Problem

#12912
From: Richard Wilkman
Date: Mon, 19 Oct 1998 00:00
98 lines
3550 bytes
Katharina:

Try making your frame a JFrame.  (this isn't easy to debug with the
fractional code that's been posted and with me working from memory
instead of with JBuilder in front of me).

Basicly you have a simple cast problem.  Your construct is:

Score = ((frame)getParent()).getChoice();

Whatever type 'Score' is must be the same type as what is returned by
the RHS of the assignment.  You are doing a getParent() (I assume that
you are in a JDialog, so that this is the same as JDialog.getParent())
and casting it's return type to a DecoratedFrame object.  On this you
are then calling getChoice().  The error is telling you that the
result of all of this isn't the same data type as Score (which I'm
guessing is an int).

-Rich

Katharina Schade wrote:
> 
> Hi Rich,
> frame extends from DecoratedFrame and the dialog from JDialog. I think the
> JDialog is the problem!!!?
> 
> Richard Wilkman schrieb:
> 
> > Katharina:
> >
> > What kind of object is 'frame' in your cast.  One or more of the items
> > you are using has likely switched parents to use JFC and you have a
> > type mis-match in the cast (hence the error).
> >
> > -Rich
> >
> > Katharina Schade wrote:
> > >
> > > Hi anyone,
> > >
> > > under JBuilder 1.0 I used in a dialog getParent  to access a method
> > > from a parent-frame.
> > >
> > >  Score = ((frame)getParent()).getChoice();
> > >
> > > Running this under JBuilder2.0 I get the Error:
> > > java.lang.ClassCastException: com.sun.java.swing.SwingUtilities.
> > >
> > > What is wrong?
> > >
> > > --
> > > Katharina Schade
> > > Pape + Partner Informationssysteme GmbH
> > > Graumannsweg 54
> > > D-22087 Hamburg
> > > Tel.: +49(40)22743349
> > > Fax:  +49(40)22743333
> > > Mailto:ks@ppi.de
> > >
> >
> > --
> >
> > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> > Rich Wilkman
> > Senior Quality Assurance Engineer
> > Borland JBuilder Team
> >
> > If you see something that looks like an opinion up there,
> > it's mine and mine alone.
> >
> > Mail sent to me from the newsgroups won't bounce but will
> > be ignored.  If I have time, I'll respond, but you  have
> > a better chance if you confine your posts to the newsgroups
> > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> 
> --
> Katharina Schade
> Pape + Partner Informationssysteme GmbH
> Graumannsweg 54
> D-22087 Hamburg
> Tel.: +49(40)22743349
> Fax:  +49(40)22743333
> Mailto:ks@ppi.de

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Senior Quality Assurance Engineer
Borland JBuilder Team

If you see something that looks like an opinion up there,
it's mine and mine alone.

Mail sent to me from the newsgroups won't bounce but will
be ignored.  If I have time, I'll respond, but you  have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <362B704B.41121B91@inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3625EF47.4C3D5403@ppi.de> <36260F04.F2837F52@inprise.com> <362B46B7.F1F7998E@ppi.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,432bd929d163a02
X-Google-Attributes: gid111d45,public
From: Richard Wilkman <rwilkman@inprise.com>
Subject: Re: getParent-Problem
Date: 1998/10/19
Message-ID: <362B704B.41121B91@inprise.com>
X-Deja-AN: 402862757
Content-Transfer-Encoding: 7bit
References: <3625EF47.4C3D5403@ppi.de> <36260F04.F2837F52@inprise.com> <362B46B7.F1F7998E@ppi.de>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing