Kenneth,

we have some linux boxes running here. I'll try to test it out some of these days and let you know.




Kenneth Pouncey <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]

08/06/2005 14:47

Please respond to
tn5250j-general@lists.sourceforge.net

To
tn5250j-general@lists.sourceforge.net
cc
Subject
RE: [Tn5250j-general] TN5250j and JRE 5.0 (more info)






Wim

Have used this before but not in the emulator as of yet because I needed to have
access to some other variables that I would not have access to in the adapter.

What I did do was get ready for that type of interface by creating another class
called SessionPopup.java.  This is then called in actionPopup(e).

Now one interesting bit of code you have that I do not is in the mouseReleased()
method for     if (e.isPopupTrigger()){ etc.... }

Hummm what about if we put in the mouseClick method at the beginning something
as follows:

           if (SwingUtilities.isRightMouseButton(e)) {
              return;
             
           }

I wonder if that would work?  I am not sure if I was having problems on linux or
mac for the order of the mouse clicks but at one time there was a problem.  I
know for sure there was a problem with e.isPopupTrigger().  We will have to test
that.  Marc has a mac to test with so he can give us an ok or not.

Patrick how is the debugging going?


Here is the code in the emulator which is close to yours except for the
mouseReleased method.  


     addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
           /** @todo check for popup trigger on linux
            *
            */
//            if (e.isPopupTrigger()) {
           // using SwingUtilities because popuptrigger does not work on linux
           if (SwingUtilities.isRightMouseButton(e)) {
              actionPopup(e);
           }

        }
        public void mouseReleased(MouseEvent e) {
//            System.out.println("Mouse Released");

        }

        public void mouseClicked(MouseEvent e) {

              if (e.getClickCount() == 2 & doubleClick) {

                 screen.sendKeys("[enter]");
              }
              else {
                                                           int pos = bi.getPosFromView(e.getX(), e.getY());
                 if (log.isDebugEnabled()) {
                    log.debug((screen.getRow(pos)) + "," + (screen.getCol(pos)));
                    log.debug(e.getX() + "," + e.getY() + "," + bi.columnWidth
+ ","
                          + bi.rowHeight);
                 }

                 boolean moved = screen.moveCursor(e, pos);
                                                                         // this is a note to not execute this code here when we
                                                                         // implement the remain after edit function option.
                 if (moved) {
                    if (rubberband.isAreaSelected()) {
                       rubberband.reset();
                    }
                    screen.repaintScreen();
                 }
                 getFocusForMe();
              }
        }

     });



Quoting [EMAIL PROTECTED]:

> 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){
>   }
> }






-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Tn5250j-general mailing list
Tn5250j-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tn5250j-general

Reply via email to