The Artima Developer Community
Sponsored Link

Java Answers Forum
jdk1.4 popupMenu problem

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Rishi

Posts: 1
Nickname: ryagnik
Registered: Aug, 2002

jdk1.4 popupMenu problem Posted: Aug 9, 2002 10:33 PM
Reply to this message Reply
Advertisement
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 and sometimes it works fine also ?

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 ?
Rishi

Topic: Class Collission Previous Topic   Next Topic Topic: How to write formatted text to html file?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use