Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #360

Re: How to determine if a

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Orlando" <orlando@THRWHITE.remove-dii-this>
Subject Re: How to determine if a
Message-ID <1165660595.211492.47430@79g2000cws.googlegroups.com> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <1165640664.144009.182990@79g2000cws.googlegroups.com>
References <1165640664.144009.182990@79g2000cws.googlegroups.com>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 37
Date Wed, 27 Apr 2011 15:27:05 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303918025 96.60.20.240 (Wed, 27 Apr 2011 10:27:05 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:27:05 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:360

Show key headers only | View raw


  To: comp.lang.java.gui
After some trial I figured that one can cast the items added to the
JMenuBar to a Container and use the getComponent() and
getComponentCount() to iterate through the items inside that container.
 The only exception was the JMenu object.  Calling the
getComponentCount() method would always return 0.

After some reading and browsing the source code for the JMenu class I
noticed that a JMenu does not behave like other containers.  One need
to call the method getMenuComponent() or getMenuComponentCount() to
iterate through the subcomponents of the menu.  So I placed an if
statement to deal with this specific class using the alternate methods.


Just in case I went about this the long way, does anyone have any
better suggestions?


Orlando wrote:
> I like to write a method that will set the font of a JMenuBar and all
> menu items in that Menu bar.  I can find any components inside the
> menubar using the getComponents() method.  How can one determine if any
> of these components is a container?  I would like to recursively go
> through every item in the menus and sub-menus and set the font of those
> menuitems as per the user preferences.
>
> Any suggestions?
> 
> Saludos,
> 
> Orlando
> orlandoamador@yahoo.com

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How to determine if a JCo "Orlando" <orlando@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: How to determine if a "Orlando" <orlando@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: How to determine if a "Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000

csiph-web