< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java

Print this page




1327                 // We perform (additional) dispatching of events to buttons of
1328                 // scrollbar, instead of leaving it to JScrollbar. This is
1329                 // required, because of different listeners in Swing and AWT,
1330                 // which trigger scrolling (ArrowButtonListener vs. TrackListener,
1331                 // accordingly). So we dispatch events to scroll-buttons, to
1332                 // invoke a correct Swing button listener.
1333                 // See CR 6175401 for more information.
1334                 case BAR:
1335                 case BUTTON:
1336                     Component c = current.getBar();
1337                     Point p = toLocalSpace( c, event.getPoint() );
1338                     if ( current.getType()==Pointer.Type.BUTTON ) {
1339                         c = current.getButton();
1340                         p = toLocalSpace( c, p );
1341                     }
1342                     AWTAccessor.getComponentAccessor().processEvent( c, newMouseEvent( c, p, event ) );
1343                     break;
1344             }
1345         }
1346 

1347         private static MouseEvent newMouseEvent(
1348             Component source, Point point, MouseEvent template )
1349         {
1350             MouseEvent e = template;
1351             MouseEvent nme = new MouseEvent(
1352                 source,
1353                 e.getID(), e.getWhen(),
1354                 e.getModifiersEx() | e.getModifiers(),
1355                 point.x, point.y,
1356                 e.getXOnScreen(), e.getYOnScreen(),
1357                 e.getClickCount(), e.isPopupTrigger(), e.getButton() );
1358             // Because these MouseEvents are dispatched directly to
1359             // their target, we need to mark them as being
1360             // system-generated here
1361             SunToolkit.setSystemGenerated(nme);
1362             return nme;
1363         }
1364 
1365         private void setCursor() {
1366             if ( current.getType()==Pointer.Type.TEXT ) {




1327                 // We perform (additional) dispatching of events to buttons of
1328                 // scrollbar, instead of leaving it to JScrollbar. This is
1329                 // required, because of different listeners in Swing and AWT,
1330                 // which trigger scrolling (ArrowButtonListener vs. TrackListener,
1331                 // accordingly). So we dispatch events to scroll-buttons, to
1332                 // invoke a correct Swing button listener.
1333                 // See CR 6175401 for more information.
1334                 case BAR:
1335                 case BUTTON:
1336                     Component c = current.getBar();
1337                     Point p = toLocalSpace( c, event.getPoint() );
1338                     if ( current.getType()==Pointer.Type.BUTTON ) {
1339                         c = current.getButton();
1340                         p = toLocalSpace( c, p );
1341                     }
1342                     AWTAccessor.getComponentAccessor().processEvent( c, newMouseEvent( c, p, event ) );
1343                     break;
1344             }
1345         }
1346 
1347         @SuppressWarnings("deprecation")
1348         private static MouseEvent newMouseEvent(
1349             Component source, Point point, MouseEvent template )
1350         {
1351             MouseEvent e = template;
1352             MouseEvent nme = new MouseEvent(
1353                 source,
1354                 e.getID(), e.getWhen(),
1355                 e.getModifiersEx() | e.getModifiers(),
1356                 point.x, point.y,
1357                 e.getXOnScreen(), e.getYOnScreen(),
1358                 e.getClickCount(), e.isPopupTrigger(), e.getButton() );
1359             // Because these MouseEvents are dispatched directly to
1360             // their target, we need to mark them as being
1361             // system-generated here
1362             SunToolkit.setSystemGenerated(nme);
1363             return nme;
1364         }
1365 
1366         private void setCursor() {
1367             if ( current.getType()==Pointer.Type.TEXT ) {


< prev index next >