This is how we always popup menu's.
public class PopupListener extends MouseAdapter{
private JPopupMenu popupMenu;
public PopupListener(JPopupMenu popupMenu) {
this.popupMenu = popupMenu;
}
public PopupListener(PopupTrigger popupTrigger) {
this.popupMenu = popupTrigger.getPopupMenu();
}
public void mousePressed(MouseEvent e) {
maybeShowPopup(e);
}
public void mouseReleased(MouseEvent e) {
maybeShowPopup(e);
}
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()){
Component invoker = (Component)e.getSource();
updatePopup(invoker);
Component oldInvoker = popupMenu.getInvoker();
popupMenu.show(invoker, e.getX(), e.getY());
if (oldInvoker != null)
popupMenu.setInvoker(oldInvoker);
}
}
/**
* This method is called just before the popup is shown to change the
* state of the popup; maybe disable some actions.
*
* @param invoker the component the PopupListener is added to.
*/
public void updatePopup(Component invoker){
}
}
- Re: [Tn5250j-general] Pasting long text in long field (... Marc Vos
- Re: [Tn5250j-general] Pasting long text in long field (... Wim . Van . Leuven
- Re: [Tn5250j-general] Pasting long text in long field (... Marc Vos
- Re: [Tn5250j-general] Pasting long text in long field (... Kenneth Pouncey
- Re: [Tn5250j-general] Pasting long text in long field (... Kenneth Pouncey
- Re: [Tn5250j-general] Pasting long text in long field (... Marc Vos
- Re: [Tn5250j-general] Pasting long text in long field (... Kenneth Pouncey
- Re: [Tn5250j-general] Pasting long text in long field (... Marc Vos
- RE: [Tn5250j-general] TN5250j and JRE 5.0 (more info) Patrick Bielen
- RE: [Tn5250j-general] TN5250j and JRE 5.0 (more info) Kenneth Pouncey
- RE: [Tn5250j-general] TN5250j and JRE 5.0 (more info) Wim . Van . Leuven
- RE: [Tn5250j-general] TN5250j and JRE 5.0 (more info) Kenneth Pouncey
- RE: [Tn5250j-general] TN5250j and JRE 5.0 (more info) Wim . Van . Leuven
- RE: [Tn5250j-general] TN5250j and JRE 5.0 (more info) Patrick Bielen
- RE: [Tn5250j-general] TN5250j and JRE 5.0 (more info) Kenneth Pouncey
- [Tn5250j-general] Selection bug on Tiger fixed !!! Patrick Bielen
- Re: [Tn5250j-general] Selection bug on Tiger fixed !!! Kenneth Pouncey
- Re: [Tn5250j-general] Selection bug on Tiger fixed !!! Kenneth Pouncey
- RE: [Tn5250j-general] Selection bug on Tiger fixed !!! Patrick Bielen
- Re: [Tn5250j-general] Selection bug on Tiger fixed !!! Richard Houston
- RE: [Tn5250j-general] Selection bug on Tiger fixed !!! Patrick Bielen
