Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2005

Tip: Looking for answers? Try searching our database.

JMenu in JTable

Thread view: 
oziris - 15 Jun 2005 17:18 GMT
Hi,

I'm trying - unsuccessfully - to insert a JMenu in a JTable cell. The
JMenu appears correctly but nothing appends when I click on the arrow
in order to display the menu items.

Is that possible?

Here a piece of my code.

____________________________________________
private class MenuRenderer extends JMenu implements TableCellRenderer {

 public MenuRenderer()
 {
   super();
 }

 public Component getTableCellRendererComponent(JTable table, Object
menu,  boolean isSelected, boolean hasFocus, int row, int column)
 {
   this.add((JMenu)menu);
   return this;
 }
}
____________________________________________
JTable l_table = new JTable(l_tableModel);
l_table.setDefaultRenderer(JMenu.class, new MenuRenderer());
____________________________________________
/**
* In my Table Model class I insert a JMenu object in the correct cell
and
* I define, among others, this method:
*/
public Class getColumnClass(int c)
{
 return getValueAt(0, c).getClass();
}
____________________________________________

Thank you for having read this msg and for your advices.

-o
Arnaud Berger - 17 Jun 2005 10:15 GMT
Hi,

A menu would be an editor rather than a renderer....

Regards,

Arnaud

> Hi,
>
[quoted text clipped - 39 lines]
>
> -o


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.