[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: swing and documentation fixes

Kaffe CVS cvs-commits at kaffe.org
Mon Jul 25 07:45:36 PDT 2005


PatchSet 6765 
Date: 2005/07/25 14:40:23
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: swing and documentation fixes

Members: 
	ChangeLog:1.4290->1.4291 
	libraries/javalib/gnu/java/awt/peer/gtk/GtkImage.java:1.8->1.9 
	libraries/javalib/java/io/DataOutput.java:1.8->1.9 
	libraries/javalib/java/io/LineNumberInputStream.java:1.7->1.8 
	libraries/javalib/java/lang/IllegalAccessException.java:1.4->1.5 
	libraries/javalib/java/net/DatagramSocket.java:1.27->1.28 
	libraries/javalib/javax/swing/JFileChooser.java:1.8->1.9 
	libraries/javalib/javax/swing/JInternalFrame.java:1.14->1.15 
	libraries/javalib/javax/swing/JTree.java:1.21->1.22 
	libraries/javalib/javax/swing/plaf/basic/BasicLookAndFeel.java:1.17->1.18 
	libraries/javalib/javax/swing/plaf/basic/BasicMenuUI.java:1.9->1.10 
	libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.10->1.11 
	libraries/javalib/javax/swing/plaf/metal/MetalIconFactory.java:1.1->1.2 
	libraries/javalib/javax/swing/text/html/parser/ParserDelegator.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4290 kaffe/ChangeLog:1.4291
--- kaffe/ChangeLog:1.4290	Mon Jul 25 13:43:26 2005
+++ kaffe/ChangeLog	Mon Jul 25 14:40:23 2005
@@ -2,6 +2,73 @@
 
 	Resynced with GNU Classpath.
 
+	2005-07-11  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * java/lang/IllegalAccessException.java: fixed minor API doc errors,
+        
+	2005-07-11  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * java/io/DataOutput.java: fixed minor API doc errors,
+        * java/io/LineNumberInputStream.java: likewise.
+
+	2005-07-11  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * javax/swing/plaf/metal/MetalIconFactory.java
+        (HorizontalSliderThumbIcon): new inner class,
+        (VerticalSliderThumbIcon): new inner class,
+        (getHorizontalSliderThumbIcon): implemented,
+        (getVerticalSliderThumbIcon): implemented.
+
+	2005-07-11  Sven de Marothy  <sven at physto.se>
+
+        * gnu/java/awt/peer/gtk/GtkImage.java:
+        (setImage): Set error flag on bad width, height or pixels.
+        (checkImage): Return error flag.
+
+	2005-07-11  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/JInternalFrame.java
+        (addImpl): Add to the frame itself if we are in the init
+        stage, otherwise add to the contentPane.
+
+	2005-07-11  Lillian Angel  <langel at redhat.com>
+
+        * javax/swing/plaf/basic/BasicLookAndFeel.java
+        Changed the default row height for the tree.
+
+	2005-07-11  Mark Wielaard  <mark at klomp.org>
+
+        * javax/swing/JFileChooser.java (getSelectedFiles): Return an one
+        element array containing selectedFile if selectedFiles is null.
+
+	2005-07-11  Lillian Angel  <langel at redhat.com>
+
+        * javax/swing/plaf/basic/BasicTreeUI.java
+        (getPreviousVisibleNode): Implemented
+        (selectPath): helper method, implemented.
+        (keyPressed): handles up/down/left/right keys
+        (mouseClicked): made more efficent and implemented double 
+        clicking for folders.
+        * javax/swing/JTree.java
+        (clearSelection): Lead selection path is set to null when 
+        nothing is currently selected.
+
+	2005-07-11  Anthony Balkissoon  <abalkiss at redhat.com>
+
+        * javax/swing/plaf/basic/BasicMenuUI.java:
+        (MouseHandler.popupVisible): new method.
+        (MouseHandler.mouseEntered): Removed check for menu being armed to
+        comply with reference implementation.  Calls popupVisible to check
+        for menus with their popup menu visible.
+
+	2005-07-11  Mark Wielaard  <mark at klomp.org>
+
+        * java/net/DatagramSocket.java (getImpl): Record cause of Exception.
+
+2005-07-25  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-07-11  Anthony Balkissoon  <abalkiss at redhat.com>
 
         * javax/swing/plaf/basic/BasicMenuUI.java:
Index: kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkImage.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkImage.java:1.8 kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkImage.java:1.9
--- kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkImage.java:1.8	Mon Jul  4 00:05:24 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkImage.java	Mon Jul 25 14:40:27 2005
@@ -100,6 +100,11 @@
   boolean offScreen;
 
   /**
+   * Error flag for loading.
+   */
+  boolean errorLoading;
+
+  /**
    * Original source, if created from an ImageProducer.
    */
   ImageProducer source;
@@ -176,6 +181,7 @@
     isLoaded = false;
     observers = new Vector();
     source = producer;
+    errorLoading = false;
     source.startProduction(new GtkImageConsumer(this, source));
     offScreen = false;
   }
@@ -243,6 +249,13 @@
     this.width = width;
     this.height = height;
     props = (properties != null) ? properties : new Hashtable();
+
+    if (width <= 0 || height <= 0 || pixels == null)
+      {
+	errorLoading = true;
+	return;
+      }
+
     isLoaded = true;
     deliver();
     createPixmap();
@@ -346,7 +359,12 @@
   public int checkImage (ImageObserver observer)
   {
     if (addObserver(observer))
-      return 0;
+      {
+	if (errorLoading == true)
+	  return ImageObserver.ERROR;
+	else
+	  return 0;
+      }
 
     return ImageObserver.ALLBITS | ImageObserver.WIDTH | ImageObserver.HEIGHT;
   }
Index: kaffe/libraries/javalib/java/io/DataOutput.java
diff -u kaffe/libraries/javalib/java/io/DataOutput.java:1.8 kaffe/libraries/javalib/java/io/DataOutput.java:1.9
--- kaffe/libraries/javalib/java/io/DataOutput.java:1.8	Mon Jul  4 00:06:35 2005
+++ kaffe/libraries/javalib/java/io/DataOutput.java	Mon Jul 25 14:40:27 2005
@@ -195,7 +195,7 @@
    *
    * @exception IOException If an error occurs
    *
-   * @see writeInt
+   * @see #writeInt
    * @see DataInput#readFloat
    * @see Float#floatToIntBits
    */
@@ -216,7 +216,7 @@
    *
    * @exception IOException If any other error occurs
    *
-   * @see writeLong
+   * @see #writeLong
    * @see DataInput#readDouble
    * @see Double#doubleToLongBits
    */
@@ -245,7 +245,7 @@
    *
    * @exception IOException If an error occurs
    *
-   * @see writeChar
+   * @see #writeChar(int)
    */
   void writeChars(String value) throws IOException;
 
Index: kaffe/libraries/javalib/java/io/LineNumberInputStream.java
diff -u kaffe/libraries/javalib/java/io/LineNumberInputStream.java:1.7 kaffe/libraries/javalib/java/io/LineNumberInputStream.java:1.8
--- kaffe/libraries/javalib/java/io/LineNumberInputStream.java:1.7	Mon Jul  4 00:06:36 2005
+++ kaffe/libraries/javalib/java/io/LineNumberInputStream.java	Mon Jul 25 14:40:27 2005
@@ -216,8 +216,8 @@
    * a single "\n" value which is stored in the buffer.  Only a single
    * byte is counted towards the number of bytes read in this case.
    *
-   * @param buf The array into which the bytes read should be stored
-   * @param offset The offset into the array to start storing bytes
+   * @param b The array into which the bytes read should be stored
+   * @param off The offset into the array to start storing bytes
    * @param len The requested number of bytes to read
    *
    * @return The actual number of bytes read, or -1 if end of stream
Index: kaffe/libraries/javalib/java/lang/IllegalAccessException.java
diff -u kaffe/libraries/javalib/java/lang/IllegalAccessException.java:1.4 kaffe/libraries/javalib/java/lang/IllegalAccessException.java:1.5
--- kaffe/libraries/javalib/java/lang/IllegalAccessException.java:1.4	Mon Jul  4 00:06:45 2005
+++ kaffe/libraries/javalib/java/lang/IllegalAccessException.java	Mon Jul 25 14:40:27 2005
@@ -39,6 +39,10 @@
 
 package java.lang;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
 /**
  * Thrown whenever a reflective method tries to do something that the
  * compiler would not allow.  For example, using reflection to set a private
Index: kaffe/libraries/javalib/java/net/DatagramSocket.java
diff -u kaffe/libraries/javalib/java/net/DatagramSocket.java:1.27 kaffe/libraries/javalib/java/net/DatagramSocket.java:1.28
--- kaffe/libraries/javalib/java/net/DatagramSocket.java:1.27	Mon Jul  4 00:06:54 2005
+++ kaffe/libraries/javalib/java/net/DatagramSocket.java	Mon Jul 25 14:40:28 2005
@@ -209,7 +209,9 @@
       }
     catch (IOException e)
       {
-	throw new SocketException(e.getMessage());
+	SocketException se = new SocketException();
+	se.initCause(e);
+	throw se;
       }
   }
 
Index: kaffe/libraries/javalib/javax/swing/JFileChooser.java
diff -u kaffe/libraries/javalib/javax/swing/JFileChooser.java:1.8 kaffe/libraries/javalib/javax/swing/JFileChooser.java:1.9
--- kaffe/libraries/javalib/javax/swing/JFileChooser.java:1.8	Mon Jul  4 00:08:12 2005
+++ kaffe/libraries/javalib/javax/swing/JFileChooser.java	Mon Jul 25 14:40:28 2005
@@ -357,7 +357,11 @@
    */
   public File[] getSelectedFiles()
   {
-    return selectedFiles;
+    if (selectedFiles != null)
+      return selectedFiles;
+    if (selectedFile != null)
+      return new File[] { selectedFile };
+    return null;
   }
 
   /**
Index: kaffe/libraries/javalib/javax/swing/JInternalFrame.java
diff -u kaffe/libraries/javalib/javax/swing/JInternalFrame.java:1.14 kaffe/libraries/javalib/javax/swing/JInternalFrame.java:1.15
--- kaffe/libraries/javalib/javax/swing/JInternalFrame.java:1.14	Sun Jul 17 15:24:11 2005
+++ kaffe/libraries/javalib/javax/swing/JInternalFrame.java	Mon Jul 25 14:40:28 2005
@@ -584,9 +584,10 @@
    */
   protected void addImpl(Component comp, Object constraints, int index)
   {
-    // If we're adding the rootPane (initialization stages) use super.add.
-    // otherwise pass the add onto the content pane.
-    if (comp==rootPane)
+    // If we're in the initialization stage use super.add. Here we add the
+    // rootPane as well as the title bar and other stuff.
+    // Otherwise pass the add onto the content pane.
+    if (!initStageDone)
       super.addImpl(comp,constraints, index);
     else
       {
Index: kaffe/libraries/javalib/javax/swing/JTree.java
diff -u kaffe/libraries/javalib/javax/swing/JTree.java:1.21 kaffe/libraries/javalib/javax/swing/JTree.java:1.22
--- kaffe/libraries/javalib/javax/swing/JTree.java:1.21	Thu Jul  7 02:19:02 2005
+++ kaffe/libraries/javalib/javax/swing/JTree.java	Mon Jul 25 14:40:28 2005
@@ -1145,6 +1145,7 @@
 	public void clearSelection()
 	{
 		selectionModel.clearSelection();
+      setLeadSelectionPath(null);
 	}
 
 	public TreePath getLeadSelectionPath()
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLookAndFeel.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLookAndFeel.java:1.17 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLookAndFeel.java:1.18
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLookAndFeel.java:1.17	Sun Jul 17 16:40:13 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicLookAndFeel.java	Mon Jul 25 14:40:29 2005
@@ -1032,7 +1032,7 @@
          new IconUIResource(new ImageIcon(getClass().getResource(
             "/gnu/javax/swing/plaf/gtk/icons/TreeOpen.png"))),
       "Tree.rightChildIndent", new Integer(13),
-      "Tree.rowHeight", new Integer(16),
+      "Tree.rowHeight", new Integer(19),
       "Tree.scrollsOnExpand", Boolean.TRUE,
       "Tree.selectionBackground", new ColorUIResource(Color.black),
       "Tree.selectionBorderColor", new ColorUIResource(Color.black),
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicMenuUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicMenuUI.java:1.9 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicMenuUI.java:1.10
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicMenuUI.java:1.9	Mon Jul 25 13:43:29 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicMenuUI.java	Mon Jul 25 14:40:29 2005
@@ -292,6 +292,19 @@
       manager.processMouseEvent(e);
     }
 
+    private boolean popupVisible()
+    {
+      JMenuBar mb = (JMenuBar) ((JMenu)menuItem).getParent();
+      // check if mb.isSelected because if no menus are selected
+      // we don't have to look through the list for popup menus
+      if (!mb.isSelected())
+        return false;
+      for (int i=0;i<mb.getMenuCount();i++)
+        if (((JMenu)mb.getComponent(i)).isPopupMenuVisible())
+          return true;
+      return false;
+    }
+
     public void mouseEntered(MouseEvent e)
     {
       /* When mouse enters menu item, it should be considered selected
@@ -303,12 +316,15 @@
                it will be selected)
       */
       JMenu menu = (JMenu) menuItem;
-      JMenuBar mb = (JMenuBar) menu.getParent();
-      if (! menu.isTopLevelMenu()
-          || (mb.isSelected() && (((JMenu)(mb.getComponent             
-                                           (mb.getSelectionModel().
-                                            getSelectedIndex()))).
-                                  isPopupMenuVisible()) && ! menu.isArmed()))
+
+      // NOTE: the following if used to require !menu.isArmed but I could find
+      // no reason for this and it was preventing some JDK-compatible behaviour.
+      // Specifically, if a menu is selected but its popup menu not visible,
+      // and then another menu is selected whose popup menu IS visible, when
+      // the mouse is moved over the first menu, its popup menu should become
+      // visible.
+
+      if (! menu.isTopLevelMenu() || popupVisible())
         {
 	  // set new selection and forward this event to MenuSelectionManager
 	  MenuSelectionManager manager = MenuSelectionManager.defaultManager();
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.10 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.11
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java:1.10	Sun Jul 17 16:40:14 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTreeUI.java	Mon Jul 25 14:40:29 2005
@@ -653,6 +653,39 @@
    }
 
    /**
+    * Get previous visible node in the tree.
+    * 
+    * @param the current node
+    * @return the next visible node in the JTree. Return null if there are no
+    *         more.
+    */
+   private DefaultMutableTreeNode getPreviousVisibleNode
+                                             (DefaultMutableTreeNode node)
+   {
+      DefaultMutableTreeNode prev = null;
+      TreePath current = null;
+
+      if (node != null)
+         prev = node.getPreviousNode();
+
+      if (prev != null)
+      {
+         current = new TreePath(prev.getPath());
+         if (tree.isVisible(current))
+            return prev;
+
+         while (prev != null && !tree.isVisible(current))
+         {
+            prev = prev.getPreviousNode();
+
+            if (prev != null)
+               current = new TreePath(prev.getPath());
+         }
+      }
+      return prev;
+   }
+   
+   /**
     * Returns the row that the last item identified in path is visible at. Will
     * return -1 if any of the elments in the path are not currently visible.
     * 
@@ -1523,6 +1556,40 @@
          return true;
    }
 
+   /**
+    * Selects the specified path in the tree depending on modes.
+    * 
+    * @param tree is the tree we are selecting the path in
+    * @param path is the path we are selecting
+    */
+   private void selectPath(JTree tree, TreePath path)
+   {
+      if (path != null)
+      {
+         if (tree.isPathSelected(path))
+            tree.removeSelectionPath(path);
+         else if (tree.getSelectionModel().getSelectionMode() 
+               == TreeSelectionModel.SINGLE_TREE_SELECTION)
+         {
+            tree.getSelectionModel().clearSelection();
+            tree.addSelectionPath(path);
+            tree.setLeadSelectionPath(path);
+         }
+         else if (tree.getSelectionModel().getSelectionMode() 
+               == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION)
+         {
+            // TODO
+         }
+         else
+         {
+            tree.getSelectionModel().setSelectionMode(
+                  TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
+            tree.addSelectionPath(path);
+            tree.setLeadSelectionPath(path);
+         }
+      }
+   }
+   
    /* * INTERNAL CLASSES * */
 
    /**
@@ -1692,7 +1759,53 @@
        * @param e the key pressed
        */
       public void keyPressed(KeyEvent e)
-      {
+      {         
+         TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath();
+         DefaultMutableTreeNode last = null;
+         
+         if (start != null)
+            last = (DefaultMutableTreeNode) start.getLastPathComponent();
+         if (last != null)
+         {
+            if (e.getKeyCode() == KeyEvent.VK_DOWN)
+            {
+               DefaultMutableTreeNode next = (DefaultMutableTreeNode) 
+                  BasicTreeUI.this.getNextVisibleNode(last);
+               
+               if (next != null)
+                  BasicTreeUI.this.selectPath(BasicTreeUI.this.tree,
+                        new TreePath(next.getPath()));
+            }
+            else if (e.getKeyCode() == KeyEvent.VK_UP)
+            {
+               DefaultMutableTreeNode prev = (DefaultMutableTreeNode) 
+               BasicTreeUI.this.getPreviousVisibleNode(last);
+            
+            if (prev != null)
+               BasicTreeUI.this.selectPath(BasicTreeUI.this.tree,
+                     new TreePath(prev.getPath()));
+            }
+            else if (e.getKeyCode() == KeyEvent.VK_LEFT)
+            {
+               TreePath path = new TreePath(last.getPath());
+               
+               if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path))
+               {
+                  BasicTreeUI.this.tree.collapsePath(path);
+                  BasicTreeUI.this.tree.fireTreeCollapsed(path);
+               }
+            }
+            else if (e.getKeyCode() == KeyEvent.VK_RIGHT)
+            {
+               TreePath path = new TreePath(last.getPath());
+   
+               if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path))
+               {
+                  BasicTreeUI.this.tree.expandPath(path);
+                  BasicTreeUI.this.tree.fireTreeExpanded(path);
+               }
+            }
+         }
       }
 
       /**
@@ -1775,6 +1888,9 @@
 
       /** Destination that receives all events. */
       protected Component destination;
+      
+      /** Number of mouse clicks on a non-leaf */
+      private int clickCount = 0;
 
       /**
        * Constructor
@@ -1806,39 +1922,28 @@
             BasicTreeUI.this.tree.getSelectionModel().clearSelection();
             BasicTreeUI.this.tree.repaint();
          }
-
-         if (BasicTreeUI.this.tree.isVisible(path))
-         {
-            if (BasicTreeUI.this.tree.isExpanded(path))
-            {
-               BasicTreeUI.this.tree.collapsePath(path);
-               BasicTreeUI.this.tree.fireTreeCollapsed(path);
-            }
-            else
-            {
-               BasicTreeUI.this.tree.expandPath(path);
-               BasicTreeUI.this.tree.fireTreeExpanded(path);
-            }
-
-            if (BasicTreeUI.this.tree.isRowSelected(row))
-               BasicTreeUI.this.tree.removeSelectionRow(row);
-            else if (BasicTreeUI.this.tree.getSelectionModel()
-                  .getSelectionMode() == TreeSelectionModel.SINGLE_TREE_SELECTION)
+         else if (BasicTreeUI.this.tree.isVisible(path))
+         {           
+            if (!BasicTreeUI.this.isLeaf(row))
+               clickCount++;
+            
+            if (clickCount == 2)
             {
                BasicTreeUI.this.tree.getSelectionModel().clearSelection();
-               BasicTreeUI.this.tree.addSelectionRow(row);
-            }
-            else if (BasicTreeUI.this.tree.getSelectionModel()
-                  .getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION)
-            {
-               // TODO
-            }
-            else
-            {
-               BasicTreeUI.this.tree.getSelectionModel().setSelectionMode(
-                     TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
-               BasicTreeUI.this.tree.addSelectionRow(row);
+               clickCount = 0;
+               if (BasicTreeUI.this.tree.isExpanded(path))
+               {
+                  BasicTreeUI.this.tree.collapsePath(path);
+                  BasicTreeUI.this.tree.fireTreeCollapsed(path);
+               }
+               else
+               {
+                  BasicTreeUI.this.tree.expandPath(path);
+                  BasicTreeUI.this.tree.fireTreeExpanded(path);
+               }
             }
+            
+            BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, path);
          }
       }
 
Index: kaffe/libraries/javalib/javax/swing/plaf/metal/MetalIconFactory.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/metal/MetalIconFactory.java:1.1 kaffe/libraries/javalib/javax/swing/plaf/metal/MetalIconFactory.java:1.2
--- kaffe/libraries/javalib/javax/swing/plaf/metal/MetalIconFactory.java:1.1	Sun Jul 10 02:11:43 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/metal/MetalIconFactory.java	Mon Jul 25 14:40:29 2005
@@ -44,6 +44,7 @@
 import java.io.Serializable;
 
 import javax.swing.Icon;
+import javax.swing.JSlider;
 
 /**
  * Creates icons for the {@link MetalLookAndFeel}.
@@ -206,7 +207,205 @@
     }
         
   }
+   
+    /**
+   * The icon used to display the thumb control on a horizontally oriented
+   * {@link JSlider} component.
+   */
+  private static class HorizontalSliderThumbIcon 
+      implements Icon, Serializable 
+  {
+
+    /**
+     * Creates a new instance.
+     */
+    public HorizontalSliderThumbIcon() 
+    {
+    }
+    
+    /**
+     * Returns the width of the icon, in pixels.
+     * 
+     * @return The width of the icon.
+     */
+    public int getIconWidth() 
+    {
+      return 15;
+    }
+    
+    /**
+     * Returns the height of the icon, in pixels.
+     * 
+     * @return The height of the icon.
+     */
+    public int getIconHeight() 
+    {
+      return 16;
+    }
+    
+    /**
+     * Paints the icon, taking into account whether or not the component has 
+     * the focus.
+     * 
+     * @param c  the component.
+     * @param g  the graphics device.
+     * @param x  the x-coordinate.
+     * @param y  the y-coordinate.
+     */
+    public void paintIcon(Component c, Graphics g, int x, int y) 
+    {
+      boolean focus = false;
+      if (c != null) 
+        focus = c.hasFocus();    
+      // TODO: pick up the colors from the look and feel
+      
+      // draw the outline
+      g.setColor(Color.black);
+      g.drawLine(x + 1, y, x + 13, y);
+      g.drawLine(x + 14, y + 1, x + 14, y + 7);
+      g.drawLine(x + 14, y + 8, x + 7, y + 15);
+      g.drawLine(x + 6, y + 14, x, y + 8);
+      g.drawLine(x, y + 7, x, y + 1);
+      
+      // fill the icon
+      g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204));  // medium
+      g.fillRect(x + 2, y + 2, 12, 7);
+      g.drawLine(x + 2, y + 9, x + 12, y + 9);
+      g.drawLine(x + 3, y + 10, x + 11, y + 10);
+      g.drawLine(x + 4, y + 11, x + 10, y + 11);
+      g.drawLine(x + 5, y + 12, x + 9, y + 12);
+      g.drawLine(x + 6, y + 13, x + 8, y + 13);
+      g.drawLine(x + 7, y + 14, x + 7, y + 14);
+      
+      // draw highlights
+      g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255));  // light
+      g.drawLine(x + 1, y + 1, x + 13, y + 1);
+      g.drawLine(x + 1, y + 2, x + 1, y + 8);
+      g.drawLine(x + 2, y + 2, x + 2, y + 2);
+      g.drawLine(x + 6, y + 2, x + 6, y + 2);
+      g.drawLine(x + 10, y + 2, x + 10, y + 2);
+
+      g.drawLine(x + 4, y + 4, x + 4, y + 4);
+      g.drawLine(x + 8, y + 4, x + 8, y + 4);
+
+      g.drawLine(x + 2, y + 6, x + 2, y + 6);
+      g.drawLine(x + 6, y + 6, x + 6, y + 6);
+      g.drawLine(x + 10, y + 6, x + 10, y + 6);
+
+      // draw dots
+      g.setColor(focus ? new Color(102, 102, 153) : Color.black);                 // dark
+      g.drawLine(x + 3, y + 3, x + 3, y + 3);
+      g.drawLine(x + 7, y + 3, x + 7, y + 3);
+      g.drawLine(x + 11, y + 3, x + 11, y + 3);
+
+      g.drawLine(x + 5, y + 5, x + 5, y + 5);
+      g.drawLine(x + 9, y + 5, x + 9, y + 5);
+
+      g.drawLine(x + 3, y + 7, x + 3, y + 7);
+      g.drawLine(x + 7, y + 7, x + 7, y + 7);
+      g.drawLine(x + 11, y + 7, x + 11, y + 7);
+
+    }        
+  }
+  
+  /**
+   * The icon used to display the thumb control on a horizontally oriented
+   * {@link JSlider} component.
+   */
+  private static class VerticalSliderThumbIcon implements Icon, Serializable 
+  {
+    /**
+     * Creates a new instance.
+     */
+    public VerticalSliderThumbIcon() 
+    {
+    }
+    
+    /**
+     * Returns the width of the icon, in pixels.
+     * 
+     * @return The width of the icon.
+     */
+    public int getIconWidth() 
+    {
+      return 16;
+    }
+    
+    /**
+     * Returns the height of the icon, in pixels.
+     * 
+     * @return The height of the icon.
+     */
+    public int getIconHeight() 
+    {
+      return 15;
+    }
     
+    /**
+     * Paints the icon taking into account whether the slider control has the
+     * focus or not.
+     * 
+     * @param c  the slider (must be a non-<code>null</code> instance of
+     *           {@link JSlider}.
+     * @param g  the graphics device.
+     * @param x  the x-coordinate.
+     * @param y  the y-coordinate.
+     */
+    public void paintIcon(Component c, Graphics g, int x, int y) 
+    {
+      boolean focus = false;
+      if (c != null) 
+        focus = c.hasFocus();    
+      // TODO: pick up the colors from the look and feel
+      
+      // draw the outline
+      g.setColor(Color.black);
+      g.drawLine(x + 1, y, x + 7, y);
+      g.drawLine(x + 8, y, x + 15, y + 7);
+      g.drawLine(x + 14, y + 8, x + 8, y + 14);
+      g.drawLine(x + 8, y + 14, x + 1, y + 14);
+      g.drawLine(x, y + 13, x, y + 1);
+      
+      // fill the icon
+      g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204));  // medium
+      g.fillRect(x + 2, y + 2, 7, 12);
+      g.drawLine(x + 9, y + 2, x + 9, y + 12);
+      g.drawLine(x + 10, y + 3, x + 10, y + 11);
+      g.drawLine(x + 11, y + 4, x + 11, y + 10);
+      g.drawLine(x + 12, y + 5, x + 12, y + 9);
+      g.drawLine(x + 13, y + 6, x + 13, y + 8);
+      g.drawLine(x + 14, y + 7, x + 14, y + 7);
+      
+      // draw highlights
+      g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255));  // light
+      g.drawLine(x + 1, y + 1, x + 8, y + 1);
+      g.drawLine(x + 1, y + 2, x + 1, y + 13);
+      g.drawLine(x + 2, y + 2, x + 2, y + 2);
+      g.drawLine(x + 2, y + 6, x + 2, y + 6);
+      g.drawLine(x + 2, y + 10, x + 2, y + 10);
+
+      g.drawLine(x + 4, y + 4, x + 4, y + 4);
+      g.drawLine(x + 4, y + 8, x + 4, y + 8);
+
+      g.drawLine(x + 6, y + 2, x + 6, y + 2);
+      g.drawLine(x + 6, y + 6, x + 6, y + 6);
+      g.drawLine(x + 6, y + 10, x + 6, y + 10);
+
+      // draw dots
+      g.setColor(focus ? new Color(102, 102, 153) : Color.black);                 // dark
+      g.drawLine(x + 3, y + 3, x + 3, y + 3);
+      g.drawLine(x + 3, y + 7, x + 3, y + 7);
+      g.drawLine(x + 3, y + 11, x + 3, y + 11);
+
+      g.drawLine(x + 5, y + 5, x + 5, y + 5);
+      g.drawLine(x + 5, y + 9, x + 5, y + 9);
+
+      g.drawLine(x + 7, y + 3, x + 7, y + 3);
+      g.drawLine(x + 7, y + 7, x + 7, y + 7);
+      g.drawLine(x + 7, y + 11, x + 7, y + 11);
+    }        
+  }
+  
   /**
    * A tree control icon.  This icon can be in one of two states: expanded and
    * collapsed.
@@ -415,6 +614,28 @@
   {   
   }
   
+  /**
+   * Returns the icon used to display the thumb for a horizontally oriented
+   * {@link JSlider}.
+   * 
+   * @return The icon.
+   */
+  public static Icon getHorizontalSliderThumbIcon() 
+  {
+    return new HorizontalSliderThumbIcon();
+  }
+    
+  /**
+   * Returns the icon used to display the thumb for a vertically oriented
+   * {@link JSlider}.
+   * 
+   * @return The icon.
+   */
+  public static Icon getVerticalSliderThumbIcon() 
+  {
+    return new VerticalSliderThumbIcon();
+  }
+    
   /**
    * Creates and returns a new tree folder icon.
    * 
Index: kaffe/libraries/javalib/javax/swing/text/html/parser/ParserDelegator.java
diff -u kaffe/libraries/javalib/javax/swing/text/html/parser/ParserDelegator.java:1.5 kaffe/libraries/javalib/javax/swing/text/html/parser/ParserDelegator.java:1.6
--- kaffe/libraries/javalib/javax/swing/text/html/parser/ParserDelegator.java:1.5	Mon Jul  4 00:08:47 2005
+++ kaffe/libraries/javalib/javax/swing/text/html/parser/ParserDelegator.java	Mon Jul 25 14:40:31 2005
@@ -113,7 +113,7 @@
 
     DTD getDTD()
     {
-      return dtd;
+      return super.dtd;
     }
   }
 




More information about the kaffe mailing list