• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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.
 
look! it's a bird! it's a plane! It's .... a teeny tiny ad
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic