• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

drop down menu

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys , I need to make a drop down menu in my application .

so that when I click on it a list of object names would appear in the list.

thanks guys .
[ June 04, 2007: Message edited by: Amgad Sobieh ]
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JComboBox ?
 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Java Ranch Amgad,

Is your JMenu static or do the objects of the class JMenuItem change? If they change, see MenuListener.

In any case, you have to call the JMenu method add() to add objects of the class JMenuItem.

Also, you'll always need a listener for the objects of JMenuItem before they'll do anything. See ActionListener actionPerformed().

If we don't answer your question, feel free to post a follow-up question.

Kaydell
[ June 04, 2007: Message edited by: Kaydell Leavitt ]
 
Amgad Sobieh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried to use the JComboBox , but I canot see , how can I insert it in a certain position on my panel .

thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
using the correct layoutManager/s (often nested) usually gets you what you
want with location.

Absolute positioning (null layout) lets you specify location, but then you are
also responsible for sizing components and allowing for different user options
e.g. font/resolution/resizing etc etc. All this is handled by the layoutManager,
so using a null layoutManager is rarely recommended.
 
reply
    Bookmark Topic Watch Topic
  • New Topic