Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Swing - Display table in sub menu  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a menu that displays say

Item1
Item2
Item3
Item 4

etc. Clicking on Item1 should display me a Table with 2 columns.
I looked at JMenu and JMenuItem classes, tried various methods. But I cant make it work.
Can somebody help me please?
 
Rancher
Posts: 2930
19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But I cant make it work.



That does not describe the problem.

Is the problem that you don't know how to use a JMenuItem? Do you know how to add an ActionListener to a menu item? Do you know how to create a table? Are you trying to create a popup JDialog to display the table or are you trying to add the JTable to an existing panel in the GUI?

There is no way we can help you because you question is so vague.

All I can suggest it to read the JMenuItem API or the JTable API and you will find links to the Swing tutorial that given examples of using menu items and tables.

Then is you have further questions you can post a SSCCE with the question showing the problems you are having.

 
Stephanie Johnson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried something below with displaying just a label. But the label gets displayed somewhere in the screen where as I am expecting it to be a submenu under menuitem1.

 
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recommended reading: http://download-llnw.oracle.com/javase/tutorial/uiswing/index.html

And of course the SSCCE link that Rob posted. It's clear you haven't even glanced at the page.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!