JPopup to stay up

I need my JPopupMenu to stay up, so it shouldn't close after a item is selected. it should only close when user selects elsewhere. can this be done?
[156 byte] By [llpindda] at [2007-10-2 16:45:42]
# 1
You don't have to use a JPopupMenu :- create JWindow W- create JPanel P with a BoxLayout- set the W's content pane P- add your JMenuItems to PThen you can use place and show/hide your window with the usual methods (setLocation, pack, setVisible).
weebiba at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...
# 2
I've got some code behind it that i dont want to change. can it be done with jPopupMenu?
llpindda at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...
# 3

> I've got some code behind it that i dont want to

> change. can it be done with jPopupMenu?

Offcourse It can be done.. U have to set the Dismiss Delay of TootTip to maximum..

class MousePRListener implements MouseListener {

public void mousePressed(MouseEvent event) {

int dismissDelay = ToolTipManager.sharedInstance().getDismissDelay();

dismissDelay = Integer.MAX_VALUE;

ToolTipManager.sharedInstance().setDismissDelay(dismissDelay);

if (event.isPopupTrigger()) {

popupframe.show(label, event.getX(), event.getY());

}

}

public void mouseReleased(MouseEvent event) {

if (event.isPopupTrigger()) {

popupframe.show(label, event.getX(), event.getY());

}

}

gervinia at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...
# 4
hey i thought u were talking about.. Tool Tip. sorry.. this code will allow tooltip to reamin visible showing as long as the cursor is in the component.. for JPopupMenu.. u have to do as weebib said..
gervinia at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...
# 5
made no difference when i added that delay. still closes when a menu is selected.
llpindda at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...
# 6

> made no difference when i added that delay. still

> closes when a menu is selected.

U have to use JWindow.. its not difficult at all.. JWindow is a container that can be displayed anywhere on the user's desktop.. weebib has already described how to do that.. Try it.. and if still problem persists.. come again..

gervinia at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...
# 7
Have an example?
llpindda at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...
# 8
> Have an example?Have you at least tried the solution I gave you ?
weebiba at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...
# 9
weebib, time is bit of an issue, im currently working on a few other projects as well. if you have done this and have an example please paste it here and i can plug it into my application. else i will do it this weekend, thanks for your help,psh
llpindda at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...
# 10
You will more than likely have to extend BasicComboPopup to do this, whichin turn will require extending BasicComboBoxUI. It will probably be less workto go with weebib's suggestion.
JayDSa at 2007-7-13 17:55:58 > top of Java-index,Desktop,Core GUI APIs...