equal
deleted
inserted
replaced
26 package sun.awt.X11; |
26 package sun.awt.X11; |
27 |
27 |
28 import java.awt.*; |
28 import java.awt.*; |
29 import java.awt.peer.*; |
29 import java.awt.peer.*; |
30 import java.awt.event.*; |
30 import java.awt.event.*; |
31 import java.util.logging.*; |
31 import sun.util.logging.PlatformLogger; |
32 |
32 |
33 // FIXME: tab traversal should be disabled when mouse is captured (4816336) |
33 // FIXME: tab traversal should be disabled when mouse is captured (4816336) |
34 |
34 |
35 // FIXME: key and mouse events should not be delivered to listeners when the Choice is unfurled. Must override handleNativeKey/MouseEvent (4816336) |
35 // FIXME: key and mouse events should not be delivered to listeners when the Choice is unfurled. Must override handleNativeKey/MouseEvent (4816336) |
36 |
36 |
41 // edge of the screen won't call layout(). Just do it on paint, I guess |
41 // edge of the screen won't call layout(). Just do it on paint, I guess |
42 |
42 |
43 // TODO: make painting more efficient (i.e. when down arrow is pressed, only two items should need to be repainted. |
43 // TODO: make painting more efficient (i.e. when down arrow is pressed, only two items should need to be repainted. |
44 |
44 |
45 public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelStateListener { |
45 public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelStateListener { |
46 private static final Logger log = Logger.getLogger("sun.awt.X11.XChoicePeer"); |
46 private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XChoicePeer"); |
47 |
47 |
48 private static final int MAX_UNFURLED_ITEMS = 10; // Maximum number of |
48 private static final int MAX_UNFURLED_ITEMS = 10; // Maximum number of |
49 // items to be displayed |
49 // items to be displayed |
50 // at a time in an |
50 // at a time in an |
51 // unfurled Choice |
51 // unfurled Choice |
890 private void trackSelection(int transX, int transY) { |
890 private void trackSelection(int transX, int transY) { |
891 if (!helper.isEmpty()) { |
891 if (!helper.isEmpty()) { |
892 if (transX > 0 && transX < width && |
892 if (transX > 0 && transX < width && |
893 transY > 0 && transY < height) { |
893 transY > 0 && transY < height) { |
894 int newIdx = helper.y2index(transY); |
894 int newIdx = helper.y2index(transY); |
895 if (log.isLoggable(Level.FINE)) { |
895 if (log.isLoggable(PlatformLogger.FINE)) { |
896 log.fine("transX=" + transX + ", transY=" + transY |
896 log.fine("transX=" + transX + ", transY=" + transY |
897 + ",width=" + width + ", height=" + height |
897 + ",width=" + width + ", height=" + height |
898 + ", newIdx=" + newIdx + " on " + target); |
898 + ", newIdx=" + newIdx + " on " + target); |
899 } |
899 } |
900 if ((newIdx >=0) && (newIdx < helper.getItemCount()) |
900 if ((newIdx >=0) && (newIdx < helper.getItemCount()) |