home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / jfc.bin / OrganicArrowIcon.java < prev    next >
Text File  |  1998-02-26  |  2KB  |  85 lines

  1. /*
  2.  * @(#)OrganicArrowIcon.java    1.2 98/01/30
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.organic;
  22.  
  23. import java.awt.*;
  24. import java.awt.event.*;
  25. import com.sun.java.swing.*;
  26. import com.sun.java.swing.border.*;
  27. import com.sun.java.swing.plaf.*;
  28.  
  29. import java.io.Serializable;
  30.  
  31. import com.sun.java.swing.plaf.basic.BasicSpinnerUI;
  32. import com.sun.java.swing.plaf.basic.Spinner;
  33.  
  34.  
  35.  
  36. /**
  37.  * An icon that draws an up or down arrow.
  38.  *
  39.  * @version 1.2 01/30/98
  40.  * @author Steve Wilson
  41.  */
  42. public class OrganicArrowIcon implements Icon {
  43.     private boolean up = true;
  44.  
  45.     public OrganicArrowIcon(boolean up) {
  46.         this.up = up;
  47.     }
  48.    /**
  49.      * Paints the arrow
  50.      */
  51.     public void paintIcon(Component c, Graphics g, int x, int y){
  52.  
  53.         g.setColor(Color.black);
  54.         g.translate((x-1),y);
  55.  
  56.     if (up) {
  57.       g.drawLine(0,-2,0,-2);
  58.       g.drawLine(-1,-1,1,-1);
  59.       g.drawLine(-2, 0, 2,0);
  60.       g.drawLine(-3, 1, 3, 1);
  61.     } else {
  62.       g.drawLine(0,1,0,1);
  63.       g.drawLine(-1,0,1,0);
  64.       g.drawLine(-2, -1, 2,-1);
  65.       g.drawLine(-3, -2, 3, -2);
  66.     }
  67.     
  68.  
  69.     g.translate(-(x-1), -y);
  70.     }
  71.   
  72.     
  73.     /**
  74.      * stubbed to statify the interface.
  75.      */
  76.     public int getIconWidth() { return 0; }
  77.  
  78.     /**
  79.      * stubbed to statify the interface.
  80.      */
  81.     public int getIconHeight()  { return 0; }
  82.  
  83. }
  84.  
  85.