• Post Reply Bookmark Topic Watch Topic
  • New Topic

jdk1.4 popupMenu problem

 
Rishi Yagnik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all
I am sending this code which works fine in jdk1.3.1 when i tried to test in jdk1.4 popupMenu appears for some time but after click it does not come up pls let me know the problem and wht wrong am i doing
my code is as follows :
package org.waterford.wet.wvs.gui.table;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import org.waterford.wet.wvs.gui.table.util.*;
import org.waterford.wet.wvs.operations.wvsc.*;
import org.waterford.wet.wvs.gui.table.model.*;
import org.waterford.wet.utils.ldap.*;
import org.waterford.wet.wvs.gui.outputformatting.*;
/**
* Title: Waterford Version System
* Description: class describes for Row Click MouseListener
* Copyright: Copyright (c) 2001
* Company: waterford india pvt ltd
* @author Rishi
* @version 1.0
*/
public class RowMouseListener extends MouseAdapter
{
/**
* scrollPane instance
*/
private JComponent paneComponent ;
/**
* Constructor
* @param Object entry
* @param JComponent component
*/
public RowMouseListener(JComponent component)
{
this.paneComponent = component ;
}
/**
* Default Implementation for Listener's method
* @param MouseEvent e
*/
public void mouseReleased(MouseEvent e)
{
try
{
if (e.isShiftDown()||e.isControlDown()||e.isAltDown())
{
return ;
}
if (e.isMetaDown())
{
System.out.println("Mouse Released ........");
int selectedIndex = ((JTable)this.paneComponent).rowAtPoint(e.getPoint());
System.out.println("SelectionIndex : "+selectedIndex);
((JTable)this.paneComponent).
setRowSelectionInterval(selectedIndex,selectedIndex);
System.out.println("selection done");
JTable table = (JTable)this.paneComponent ;
System.out.println("table instace casted");
if(table.getModel() instanceof EntryModel)
{
System.out.println("instance of table");
EntryModel entryModel= (EntryModel)table.getModel() ;
System.out.println("entrymodel got");
if(entryModel.getEntryVector().elementAt(selectedIndex) instanceof WVSEntry)
{
System.out.println("In entrymodel wvsentry for if loop");
WVSEntry wvsEntry = (WVSEntry)
entryModel.getEntryVector().elementAt(selectedIndex);
System.out.println("wvsEntry : "+wvsEntry.toString());
final Point point = JFCUtilities.computePopupLocation
(e,this.paneComponent,PopupMenuGenerator.getInstance().getPopupMenu(wvsEntry));
showPopUPMenu(PopupMenuGenerator.getInstance().getPopupMenu(wvsEntry),point);
}
else
{
System.out.println("cvsEnrty if loop");
CVSEntry cvsEntry = (CVSEntry)
entryModel.getEntryVector().elementAt(selectedIndex);
System.out.println("CVSEnrty : "+cvsEntry.toString());
final Point point = JFCUtilities.computePopupLocation
(e,this.paneComponent,PopupMenuGenerator.getInstance().getPopupMenu(cvsEntry));
showPopUPMenu(PopupMenuGenerator.getInstance().getPopupMenu(cvsEntry),point);
}
}
else
{
EntryRevisionModel model = (EntryRevisionModel)table.getModel();
WVSEntry wvsEntry = (WVSEntry)model.getEntryVector()
.elementAt(selectedIndex);
final Point point = JFCUtilities.computePopupLocation
(e,this.paneComponent,PopupMenuGenerator.getInstance().getPopupMenu(wvsEntry));
showPopUPMenu(PopupMenuGenerator.getInstance().getPopupMenu(wvsEntry),point);
}
}
}
catch (Exception ex)
{
ex.printStackTrace() ;
}
}
/**
* doing a finalize work
*/
protected void finalize()throws Throwable
{
super.finalize() ;
}
/**
* showing a popupMenu
* @param JPopupMenu entryPopupMenu
* @param Point point
*/
private void showPopUPMenu(final JPopupMenu entryPopupMenu,final Point point)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
System.out.println("in run method");
entryPopupMenu.show(paneComponent,(int)point.getX()-25,(int)point.getY()-100);
System.out.println("In run method ends here");
}
});
}
}
pls help needed urgently
am i missing something ?
and one more thing how can i clear a selection of popupMenu any idea
Rishi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!