🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JToolBar and JDialog

#12665
From: Matt Krevs
Date: Thu, 19 Nov 1998 00:00
43 lines
2232 bytes
I'm not sure a JToolBar should know anything about the container that it is
on but.... have you tried getTopLevelAncestor()? Whay do you need to get a
handle to the JToolBar?

You need your JFrame to act as an actionlistener to the menu items and
toolbar buttons. Have a look at the following link, it discusses actions.
http://java.sun.com/docs/books/tutorial/ui/swingMisc/action.html

I have an object called a MenuManager that listens to Actions that are
represented in a menuitem and/or a toolbar item. Any objects that are
interested in these actions ( in your case its a JFrame ) register
themselves as a listener to the MenuManager and receive menu/toolbar events.

An advantage of using Actions is that you can disable an action and the
corresponding menu item and toolbar button is also disabled.

As regards to your JTabbedPane problem, I don't experience this behaviour.
Maybe you could post a snippet of the offending code.

HTH

J Narayana wrote in message <36525EC4.A6B5F194@arsin.com>...
>Hi there!
>
>My problem situation is as follows:
>
>When a JButton [on a JToolBar in a JFrame] is clicked, I need to
instantiate a
>JDialog-subclassed object. This JDialog subclass in turn has a JTabbed pane
>which is not showing properly [only two tab pages show up properly instead
of
>the three that I have added.] I can't figure out what I am doing wrong. Is
it
>a must that I call the super() method in my JDialog-subclassed class? Most
>importantly, how do I get the parent of my JToolBar (Please give the EXACT
>statement.)
>
>My email id is: JNarayan@arsin.com
>
>Thanks very much in advance.
>
>- Nani
>
Technical Details
Message-ID: <72vefe$10c5@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3625EF47.4C3D5403@ppi.de> <36260F04.F2837F52@inprise.com> <362B46B7.F1F7998E@ppi.de> <36525EC4.A6B5F194@arsin.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,432bd929d163a02
X-Google-Attributes: gid111d45,public
From: "Matt Krevs" <mattkrevs@flex.com.au>
Subject: Re: JToolBar and JDialog
Date: 1998/11/19
Message-ID: <72vefe$10c5@forums.borland.com>
X-Deja-AN: 413281301
References: <3625EF47.4C3D5403@ppi.de> <36260F04.F2837F52@inprise.com> <362B46B7.F1F7998E@ppi.de> <36525EC4.A6B5F194@arsin.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing