jdk/src/solaris/classes/sun/awt/X11/XListPeer.java
changeset 3938 ef327bd847c0
parent 445 6f717a8cacfb
child 5506 202f599c92aa
equal deleted inserted replaced
3934:487e1aa949c4 3938:ef327bd847c0
    32 import java.awt.event.*;
    32 import java.awt.event.*;
    33 import java.awt.peer.*;
    33 import java.awt.peer.*;
    34 import java.util.Vector;
    34 import java.util.Vector;
    35 import java.awt.geom.*;
    35 import java.awt.geom.*;
    36 import java.awt.image.*;
    36 import java.awt.image.*;
    37 import java.util.logging.*;
    37 import sun.util.logging.PlatformLogger;
    38 
    38 
    39 // TODO: some input actions should do nothing if Shift or Control are down
    39 // TODO: some input actions should do nothing if Shift or Control are down
    40 
    40 
    41 class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
    41 class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
    42 
    42 
    43     private static final Logger log = Logger.getLogger("sun.awt.X11.XListPeer");
    43     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XListPeer");
    44 
    44 
    45     public final static int     MARGIN = 2;
    45     public final static int     MARGIN = 2;
    46     public final static int     SPACE = 1;
    46     public final static int     SPACE = 1;
    47     public final static int     SCROLLBAR_AREA = 17;  // Area reserved for the
    47     public final static int     SCROLLBAR_AREA = 17;  // Area reserved for the
    48                                                       // scrollbar
    48                                                       // scrollbar
   576             repaint();
   576             repaint();
   577         }
   577         }
   578     }
   578     }
   579 
   579 
   580     void mousePressed(MouseEvent mouseEvent) {
   580     void mousePressed(MouseEvent mouseEvent) {
   581         if (log.isLoggable(Level.FINER)) log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis);
   581         if (log.isLoggable(PlatformLogger.FINER)) log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis);
   582         if (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) {
   582         if (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) {
   583             if (inWindow(mouseEvent.getX(), mouseEvent.getY())) {
   583             if (inWindow(mouseEvent.getX(), mouseEvent.getY())) {
   584                 if (log.isLoggable(Level.FINE)) log.fine("Mouse press in items area");
   584                 if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in items area");
   585                 active = WINDOW;
   585                 active = WINDOW;
   586                 int i = y2index(mouseEvent.getY());
   586                 int i = y2index(mouseEvent.getY());
   587                 if (i >= 0) {
   587                 if (i >= 0) {
   588                     if (multipleSelections) {
   588                     if (multipleSelections) {
   589                         if (isSelected(i)) {
   589                         if (isSelected(i)) {
   616                     // 6426186: reset variable to prevent action event
   616                     // 6426186: reset variable to prevent action event
   617                     // if user clicks on unoccupied area of list
   617                     // if user clicks on unoccupied area of list
   618                     currentIndex = -1;
   618                     currentIndex = -1;
   619                 }
   619                 }
   620             } else if (inVerticalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
   620             } else if (inVerticalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
   621                 if (log.isLoggable(Level.FINE)) log.fine("Mouse press in vertical scrollbar");
   621                 if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in vertical scrollbar");
   622                 active = VERSCROLLBAR;
   622                 active = VERSCROLLBAR;
   623                 vsb.handleMouseEvent(mouseEvent.getID(),
   623                 vsb.handleMouseEvent(mouseEvent.getID(),
   624                                      mouseEvent.getModifiers(),
   624                                      mouseEvent.getModifiers(),
   625                                      mouseEvent.getX() - (width - SCROLLBAR_WIDTH),
   625                                      mouseEvent.getX() - (width - SCROLLBAR_WIDTH),
   626                                      mouseEvent.getY());
   626                                      mouseEvent.getY());
   627             } else if (inHorizontalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
   627             } else if (inHorizontalScrollbar(mouseEvent.getX(), mouseEvent.getY())) {
   628                 if (log.isLoggable(Level.FINE)) log.fine("Mouse press in horizontal scrollbar");
   628                 if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in horizontal scrollbar");
   629                 active = HORSCROLLBAR;
   629                 active = HORSCROLLBAR;
   630                 hsb.handleMouseEvent(mouseEvent.getID(),
   630                 hsb.handleMouseEvent(mouseEvent.getID(),
   631                                      mouseEvent.getModifiers(),
   631                                      mouseEvent.getModifiers(),
   632                                      mouseEvent.getX(),
   632                                      mouseEvent.getX(),
   633                                      mouseEvent.getY() - (height - SCROLLBAR_WIDTH));
   633                                      mouseEvent.getY() - (height - SCROLLBAR_WIDTH));
   806         }
   806         }
   807     }
   807     }
   808 
   808 
   809     void keyPressed(KeyEvent e) {
   809     void keyPressed(KeyEvent e) {
   810         int keyCode = e.getKeyCode();
   810         int keyCode = e.getKeyCode();
   811         if (log.isLoggable(Level.FINE)) log.fine(e.toString());
   811         if (log.isLoggable(PlatformLogger.FINE)) log.fine(e.toString());
   812         switch(keyCode) {
   812         switch(keyCode) {
   813           case KeyEvent.VK_UP:
   813           case KeyEvent.VK_UP:
   814           case KeyEvent.VK_KP_UP: // TODO: I assume we also want this, too
   814           case KeyEvent.VK_KP_UP: // TODO: I assume we also want this, too
   815               if (getFocusIndex() > 0) {
   815               if (getFocusIndex() > 0) {
   816                   setFocusIndex(getFocusIndex()-1);
   816                   setFocusIndex(getFocusIndex()-1);
   991     /**
   991     /**
   992      * return value from the scrollbar
   992      * return value from the scrollbar
   993      */
   993      */
   994     public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) {
   994     public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) {
   995 
   995 
   996         if (log.isLoggable(Level.FINE)) log.fine("Notify value changed on " + obj + " to " + v);
   996         if (log.isLoggable(PlatformLogger.FINE)) log.fine("Notify value changed on " + obj + " to " + v);
   997         int value = obj.getValue();
   997         int value = obj.getValue();
   998         if (obj == vsb) {
   998         if (obj == vsb) {
   999             scrollVertical(v - value);
   999             scrollVertical(v - value);
  1000 
  1000 
  1001             // See 6243382 for more information
  1001             // See 6243382 for more information
  1074                 if (selected[j] >= i) {
  1074                 if (selected[j] >= i) {
  1075                     selected[j] += 1;
  1075                     selected[j] += 1;
  1076                 }
  1076                 }
  1077             }
  1077             }
  1078         }
  1078         }
  1079         if (log.isLoggable(Level.FINER)) log.finer("Adding item '" + item + "' to " + addedIndex);
  1079         if (log.isLoggable(PlatformLogger.FINER)) log.finer("Adding item '" + item + "' to " + addedIndex);
  1080 
  1080 
  1081         // Update maxLength
  1081         // Update maxLength
  1082         boolean repaintItems = !isItemHidden(addedIndex);
  1082         boolean repaintItems = !isItemHidden(addedIndex);
  1083         maxLength = Math.max(maxLength, getItemWidth(addedIndex));
  1083         maxLength = Math.max(maxLength, getItemWidth(addedIndex));
  1084         layout();
  1084         layout();
  1092             options = (repaintItems ? (PAINT_ITEMS):0)
  1092             options = (repaintItems ? (PAINT_ITEMS):0)
  1093                 | ((maxLength != oldMaxLength || (hsbWasVis ^ hsbVis))?(PAINT_HSCROLL):0)
  1093                 | ((maxLength != oldMaxLength || (hsbWasVis ^ hsbVis))?(PAINT_HSCROLL):0)
  1094                 | ((vsb.needsRepaint())?(PAINT_VSCROLL):0);
  1094                 | ((vsb.needsRepaint())?(PAINT_VSCROLL):0);
  1095 
  1095 
  1096         }
  1096         }
  1097         if (log.isLoggable(Level.FINEST)) log.finest("Last visible: " + getLastVisibleItem() +
  1097         if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Last visible: " + getLastVisibleItem() +
  1098                                                      ", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems);
  1098                                                      ", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems);
  1099         repaint(addedIndex, getLastVisibleItem(), options);
  1099         repaint(addedIndex, getLastVisibleItem(), options);
  1100     }
  1100     }
  1101 
  1101 
  1102     /**
  1102     /**
  1108         // save the current state of the scrollbars
  1108         // save the current state of the scrollbars
  1109         boolean hsbWasVisible = hsbVis;
  1109         boolean hsbWasVisible = hsbVis;
  1110         boolean vsbWasVisible = vsbVis;
  1110         boolean vsbWasVisible = vsbVis;
  1111         int oldLastDisplayed = lastItemDisplayed();
  1111         int oldLastDisplayed = lastItemDisplayed();
  1112 
  1112 
  1113         if (log.isLoggable(Level.FINE)) log.fine("Deleting from " + s + " to " + e);
  1113         if (log.isLoggable(PlatformLogger.FINE)) log.fine("Deleting from " + s + " to " + e);
  1114 
  1114 
  1115         if (log.isLoggable(Level.FINEST)) log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() +
  1115         if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() +
  1116                                                      ", size " + items.size());
  1116                                                      ", size " + items.size());
  1117 
  1117 
  1118         if (items.size() == 0) {
  1118         if (items.size() == 0) {
  1119             return;
  1119             return;
  1120         }
  1120         }
  1178             int focusBound = (items.size() > 0) ? 0 : -1;
  1178             int focusBound = (items.size() > 0) ? 0 : -1;
  1179             setFocusIndex(Math.max(s-1, focusBound));
  1179             setFocusIndex(Math.max(s-1, focusBound));
  1180             options |= PAINT_FOCUS;
  1180             options |= PAINT_FOCUS;
  1181         }
  1181         }
  1182 
  1182 
  1183         if (log.isLoggable(Level.FINEST)) log.finest("Multiple selections: " + multipleSelections);
  1183         if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Multiple selections: " + multipleSelections);
  1184 
  1184 
  1185         // update vsb.val
  1185         // update vsb.val
  1186         if (vsb.getValue() >= s) {
  1186         if (vsb.getValue() >= s) {
  1187             if (vsb.getValue() <= e) {
  1187             if (vsb.getValue() <= e) {
  1188                 vsb.setValue(e+1 - diff);
  1188                 vsb.setValue(e+1 - diff);
  1431     /**
  1431     /**
  1432      * scrollVertical
  1432      * scrollVertical
  1433      * y is the number of items to scroll
  1433      * y is the number of items to scroll
  1434      */
  1434      */
  1435     void scrollVertical(int y) {
  1435     void scrollVertical(int y) {
  1436         if (log.isLoggable(Level.FINE)) log.fine("Scrolling vertically by " + y);
  1436         if (log.isLoggable(PlatformLogger.FINE)) log.fine("Scrolling vertically by " + y);
  1437         int itemsInWin = itemsInWindow();
  1437         int itemsInWin = itemsInWindow();
  1438         int h = getItemHeight();
  1438         int h = getItemHeight();
  1439         int pixelsToScroll = y * h;
  1439         int pixelsToScroll = y * h;
  1440 
  1440 
  1441         if (vsb.getValue() < -y) {
  1441         if (vsb.getValue() < -y) {
  1471     /**
  1471     /**
  1472      * scrollHorizontal
  1472      * scrollHorizontal
  1473      * x is the number of pixels to scroll
  1473      * x is the number of pixels to scroll
  1474      */
  1474      */
  1475     void scrollHorizontal(int x) {
  1475     void scrollHorizontal(int x) {
  1476         if (log.isLoggable(Level.FINE)) log.fine("Scrolling horizontally by " + y);
  1476         if (log.isLoggable(PlatformLogger.FINE)) log.fine("Scrolling horizontally by " + y);
  1477         int w = getListWidth();
  1477         int w = getListWidth();
  1478         w -= ((2 * SPACE) + (2 * MARGIN));
  1478         w -= ((2 * SPACE) + (2 * MARGIN));
  1479         int h = height - (SCROLLBAR_AREA + (2 * MARGIN));
  1479         int h = height - (SCROLLBAR_AREA + (2 * MARGIN));
  1480         hsb.setValue(hsb.getValue() + x);
  1480         hsb.setValue(hsb.getValue() + x);
  1481 
  1481 
  1704             } finally {
  1704             } finally {
  1705                 XToolkit.awtUnlock();
  1705                 XToolkit.awtUnlock();
  1706             }
  1706             }
  1707 
  1707 
  1708             if (localBuffer == null) {
  1708             if (localBuffer == null) {
  1709                 if (log.isLoggable(Level.FINE)) log.fine("Creating buffer " + width + "x" + height);
  1709                 if (log.isLoggable(PlatformLogger.FINE)) log.fine("Creating buffer " + width + "x" + height);
  1710                 // use GraphicsConfig.cCVI() instead of Component.cVI(),
  1710                 // use GraphicsConfig.cCVI() instead of Component.cVI(),
  1711                 // because the latter may cause a deadlock with the tree lock
  1711                 // because the latter may cause a deadlock with the tree lock
  1712                 localBuffer =
  1712                 localBuffer =
  1713                     graphicsConfig.createCompatibleVolatileImage(width+1,
  1713                     graphicsConfig.createCompatibleVolatileImage(width+1,
  1714                                                                  height+1);
  1714                                                                  height+1);
  1741             paint(listG, firstItem, lastItem, options, null, null);
  1741             paint(listG, firstItem, lastItem, options, null, null);
  1742         }
  1742         }
  1743 
  1743 
  1744         private void paint(Graphics listG, int firstItem, int lastItem, int options,
  1744         private void paint(Graphics listG, int firstItem, int lastItem, int options,
  1745                            Rectangle source, Point distance) {
  1745                            Rectangle source, Point distance) {
  1746             if (log.isLoggable(Level.FINER)) log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options);
  1746             if (log.isLoggable(PlatformLogger.FINER)) log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options);
  1747             if (firstItem > lastItem) {
  1747             if (firstItem > lastItem) {
  1748                 int t = lastItem;
  1748                 int t = lastItem;
  1749                 lastItem = firstItem;
  1749                 lastItem = firstItem;
  1750                 firstItem = t;
  1750                 firstItem = t;
  1751             }
  1751             }
  1830             g.fillRect(0, 0, listWidth, listHeight);
  1830             g.fillRect(0, 0, listWidth, listHeight);
  1831             draw3DRect(g, getSystemColors(), 0, 0, listWidth - 1, listHeight - 1, false);
  1831             draw3DRect(g, getSystemColors(), 0, 0, listWidth - 1, listHeight - 1, false);
  1832         }
  1832         }
  1833 
  1833 
  1834         private void paintItems(Graphics g, int firstItem, int lastItem, int options) {
  1834         private void paintItems(Graphics g, int firstItem, int lastItem, int options) {
  1835             if (log.isLoggable(Level.FINER)) log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem());
  1835             if (log.isLoggable(PlatformLogger.FINER)) log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem());
  1836 
  1836 
  1837             firstItem = Math.max(getFirstVisibleItem(), firstItem);
  1837             firstItem = Math.max(getFirstVisibleItem(), firstItem);
  1838             if (firstItem > lastItem) {
  1838             if (firstItem > lastItem) {
  1839                 int t = lastItem;
  1839                 int t = lastItem;
  1840                 lastItem = firstItem;
  1840                 lastItem = firstItem;
  1841                 firstItem = t;
  1841                 firstItem = t;
  1842             }
  1842             }
  1843             firstItem = Math.max(getFirstVisibleItem(), firstItem);
  1843             firstItem = Math.max(getFirstVisibleItem(), firstItem);
  1844             lastItem = Math.min(lastItem, items.size()-1);
  1844             lastItem = Math.min(lastItem, items.size()-1);
  1845 
  1845 
  1846             if (log.isLoggable(Level.FINER)) log.finer("Actually painting items from " + firstItem + " to " + lastItem +
  1846             if (log.isLoggable(PlatformLogger.FINER)) log.finer("Actually painting items from " + firstItem + " to " + lastItem +
  1847                                                        ", items in window " + itemsInWindow());
  1847                                                        ", items in window " + itemsInWindow());
  1848             for (int i = firstItem; i <= lastItem; i++) {
  1848             for (int i = firstItem; i <= lastItem; i++) {
  1849                 paintItem(g, i);
  1849                 paintItem(g, i);
  1850             }
  1850             }
  1851         }
  1851         }
  1852 
  1852 
  1853         private void paintItem(Graphics g, int index) {
  1853         private void paintItem(Graphics g, int index) {
  1854             if (log.isLoggable(Level.FINEST)) log.finest("Painting item " + index);
  1854             if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting item " + index);
  1855             // 4895367 - only paint items which are visible
  1855             // 4895367 - only paint items which are visible
  1856             if (!isItemHidden(index)) {
  1856             if (!isItemHidden(index)) {
  1857                 Shape clip = g.getClip();
  1857                 Shape clip = g.getClip();
  1858                 int w = getItemWidth();
  1858                 int w = getItemWidth();
  1859                 int h = getItemHeight();
  1859                 int h = getItemHeight();
  1860                 int y = getItemY(index);
  1860                 int y = getItemY(index);
  1861                 int x = getItemX();
  1861                 int x = getItemX();
  1862                 if (log.isLoggable(Level.FINEST)) log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2)));
  1862                 if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2)));
  1863                 g.setClip(x, y, w - (SPACE*2), h-(SPACE*2));
  1863                 g.setClip(x, y, w - (SPACE*2), h-(SPACE*2));
  1864 
  1864 
  1865                 // Always paint the background so that focus is unpainted in
  1865                 // Always paint the background so that focus is unpainted in
  1866                 // multiselect mode
  1866                 // multiselect mode
  1867                 if (isSelected(index)) {
  1867                 if (isSelected(index)) {
  1868                     if (log.isLoggable(Level.FINEST)) log.finest("Painted item is selected");
  1868                     if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painted item is selected");
  1869                     g.setColor(getListForeground());
  1869                     g.setColor(getListForeground());
  1870                 } else {
  1870                 } else {
  1871                     g.setColor(getListBackground());
  1871                     g.setColor(getListBackground());
  1872                 }
  1872                 }
  1873                 if (log.isLoggable(Level.FINEST)) log.finest("Filling " + new Rectangle(x, y, w, h));
  1873                 if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Filling " + new Rectangle(x, y, w, h));
  1874                 g.fillRect(x, y, w, h);
  1874                 g.fillRect(x, y, w, h);
  1875 
  1875 
  1876                 if (index <= getLastVisibleItem() && index < items.size()) {
  1876                 if (index <= getLastVisibleItem() && index < items.size()) {
  1877                     if (!isEnabled()){
  1877                     if (!isEnabled()){
  1878                         g.setColor(getDisabledColor());
  1878                         g.setColor(getDisabledColor());
  1892                 g.setClip(clip);
  1892                 g.setClip(clip);
  1893             }
  1893             }
  1894         }
  1894         }
  1895 
  1895 
  1896         void paintScrollBar(XScrollbar scr, Graphics g, int x, int y, int width, int height, boolean paintAll) {
  1896         void paintScrollBar(XScrollbar scr, Graphics g, int x, int y, int width, int height, boolean paintAll) {
  1897             if (log.isLoggable(Level.FINEST)) log.finest("Painting scrollbar " + scr + " width " +
  1897             if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting scrollbar " + scr + " width " +
  1898                                                          width + " height " + height + ", paintAll " + paintAll);
  1898                                                          width + " height " + height + ", paintAll " + paintAll);
  1899             g.translate(x, y);
  1899             g.translate(x, y);
  1900             scr.paint(g, getSystemColors(), paintAll);
  1900             scr.paint(g, getSystemColors(), paintAll);
  1901             g.translate(-x, -y);
  1901             g.translate(-x, -y);
  1902         }
  1902         }
  1930         private void paintFocus(Graphics g, int options) {
  1930         private void paintFocus(Graphics g, int options) {
  1931             boolean paintFocus = (options & PAINT_FOCUS) != 0;
  1931             boolean paintFocus = (options & PAINT_FOCUS) != 0;
  1932             if (paintFocus && !hasFocus()) {
  1932             if (paintFocus && !hasFocus()) {
  1933                 paintFocus = false;
  1933                 paintFocus = false;
  1934             }
  1934             }
  1935             if (log.isLoggable(Level.FINE)) log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " +
  1935             if (log.isLoggable(PlatformLogger.FINE)) log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " +
  1936                                                      (isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus);
  1936                                                      (isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus);
  1937             Shape clip = g.getClip();
  1937             Shape clip = g.getClip();
  1938             g.setClip(0, 0, listWidth, listHeight);
  1938             g.setClip(0, 0, listWidth, listHeight);
  1939             if (log.isLoggable(Level.FINEST)) log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight));
  1939             if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight));
  1940             Rectangle rect = getFocusRect();
  1940             Rectangle rect = getFocusRect();
  1941             if (prevFocusRect != null) {
  1941             if (prevFocusRect != null) {
  1942                 // Erase focus rect
  1942                 // Erase focus rect
  1943                 if (log.isLoggable(Level.FINEST)) log.finest("Erasing previous focus rect " + prevFocusRect);
  1943                 if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Erasing previous focus rect " + prevFocusRect);
  1944                 g.setColor(getListBackground());
  1944                 g.setColor(getListBackground());
  1945                 g.drawRect(prevFocusRect.x, prevFocusRect.y, prevFocusRect.width, prevFocusRect.height);
  1945                 g.drawRect(prevFocusRect.x, prevFocusRect.y, prevFocusRect.width, prevFocusRect.height);
  1946                 prevFocusRect = null;
  1946                 prevFocusRect = null;
  1947             }
  1947             }
  1948             if (paintFocus) {
  1948             if (paintFocus) {
  1949                 // Paint new
  1949                 // Paint new
  1950                 if (log.isLoggable(Level.FINEST)) log.finest("Painting focus rect " + rect);
  1950                 if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting focus rect " + rect);
  1951                 g.setColor(getListForeground());  // Focus color is always black on Linux
  1951                 g.setColor(getListForeground());  // Focus color is always black on Linux
  1952                 g.drawRect(rect.x, rect.y, rect.width, rect.height);
  1952                 g.drawRect(rect.x, rect.y, rect.width, rect.height);
  1953                 prevFocusRect = rect;
  1953                 prevFocusRect = rect;
  1954             }
  1954             }
  1955             g.setClip(clip);
  1955             g.setClip(clip);