/[classpath]/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mark, Sat Jul 31 22:56:54 2004 UTC revision 1.5 by mkoch, Sun Sep 26 15:21:13 2004 UTC
# Line 153  public class BasicSplitPaneDivider exten Line 153  public class BasicSplitPaneDivider exten
153    // left (top), middle, right(bottom)    // left (top), middle, right(bottom)
154    //    0          1          2    //    0          1          2
155    
156    /** Keeps track of where the divider should be placed when using one touch expand    /**
157     * buttons. */     * Keeps track of where the divider should be placed when using one touch
158       * expand buttons.
159       */
160    private transient int currentDividerLocation = 1;    private transient int currentDividerLocation = 1;
161      
162      /** DOCUMENT ME! */
163    private transient Border tmpBorder = new Border()    private transient Border tmpBorder = new Border()
   {  
     public Insets getBorderInsets(Component c)  
     {  
       return new Insets(2, 2, 2, 2);  
     }  
       
     public boolean isBorderOpaque()  
164      {      {
165        return false;        public Insets getBorderInsets(Component c)
166      }        {
167               return new Insets(2, 2, 2, 2);
168      public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)        }
169      {  
170        Color saved = g.getColor();        public boolean isBorderOpaque()
171        g.setColor(Color.BLACK);        {
172                 return false;
173        g.drawRect(x + 2, y + 2, width - 4, height - 4);        }
174          
175        g.setColor(saved);        public void paintBorder(Component c, Graphics g, int x, int y,
176      }                                int width, int height)
177    };        {
178           Color saved = g.getColor();
179           g.setColor(Color.BLACK);
180    
181           g.drawRect(x + 2, y + 2, width - 4, height - 4);
182    
183           g.setColor(saved);
184          }
185        };
186    
187    /**    /**
188     * Constructs a new divider.     * Constructs a new divider.
# Line 420  public class BasicSplitPaneDivider exten Line 424  public class BasicSplitPaneDivider exten
424      if (orientation == JSplitPane.VERTICAL_SPLIT)      if (orientation == JSplitPane.VERTICAL_SPLIT)
425        dir = SwingConstants.NORTH;        dir = SwingConstants.NORTH;
426      JButton button = new BasicArrowButton(dir);      JButton button = new BasicArrowButton(dir);
427      button.setBorderPainted(false);      button.setBorder(null);
428    
429      return button;      return button;
430    }    }
# Line 437  public class BasicSplitPaneDivider exten Line 441  public class BasicSplitPaneDivider exten
441      if (orientation == JSplitPane.VERTICAL_SPLIT)      if (orientation == JSplitPane.VERTICAL_SPLIT)
442        dir = SwingConstants.SOUTH;        dir = SwingConstants.SOUTH;
443      JButton button = new BasicArrowButton(dir);      JButton button = new BasicArrowButton(dir);
444      button.setBorderPainted(false);      button.setBorder(null);
445      return button;      return button;
446    }    }
447    
# Line 484  public class BasicSplitPaneDivider exten Line 488  public class BasicSplitPaneDivider exten
488    }    }
489    
490    /**    /**
491     * This helper method moves the divider to one of the     * This helper method moves the divider to one of the  three locations when
492     * three locations when using one touch expand buttons.     * using one touch expand buttons. Location 0 is the left (or top) most
493     * Location 0 is the left (or top) most location.     * location. Location 1 is the middle. Location 2 is the right (or bottom)
494     * Location 1 is the middle.     * most location.
    * Location 2 is the right (or bottom) most location.  
495     *     *
496     * @param locationIndex The location to move to.     * @param locationIndex The location to move to.
497     */     */
# Line 612  public class BasicSplitPaneDivider exten Line 615  public class BasicSplitPaneDivider exten
615     */     */
616    protected class DragController    protected class DragController
617    {    {
618      /** The difference between where the mouse is clicked and the      /**
619       * initial divider location. */       * The difference between where the mouse is clicked and the  initial
620         * divider location.
621         */
622      transient int offset;      transient int offset;
623    
624      /**      /**
# Line 650  public class BasicSplitPaneDivider exten Line 655  public class BasicSplitPaneDivider exten
655      }      }
656    
657      /**      /**
658       * This method returns one of the two paramters       * This method returns one of the two paramters for the orientation. In
659       * for the orientation. In this case, it returns x.       * this case, it returns x.
660       *       *
661       * @param x The x coordinate.       * @param x The x coordinate.
662       * @param y The y coordinate.       * @param y The y coordinate.
# Line 664  public class BasicSplitPaneDivider exten Line 669  public class BasicSplitPaneDivider exten
669      }      }
670    
671      /**      /**
672       * This method is called to pass on the drag information       * This method is called to pass on the drag information to the UI through
673       * to the UI through dragDividerTo.       * dragDividerTo.
674       *       *
675       * @param newX The x coordinate of the MouseEvent.       * @param newX The x coordinate of the MouseEvent.
676       * @param newY The y coordinate of the MouseEvent.       * @param newY The y coordinate of the MouseEvent.
# Line 677  public class BasicSplitPaneDivider exten Line 682  public class BasicSplitPaneDivider exten
682      }      }
683    
684      /**      /**
685       * This method is called to pass on the drag information       * This method is called to pass on the drag information  to the UI
686       * to the UI through dragDividerTo.       * through dragDividerTo.
687       *       *
688       * @param e The MouseEvent.       * @param e The MouseEvent.
689       */       */
# Line 689  public class BasicSplitPaneDivider exten Line 694  public class BasicSplitPaneDivider exten
694      }      }
695    
696      /**      /**
697       * This method is called to finish the drag session       * This method is called to finish the drag session  by calling
698       * by calling finishDraggingTo.       * finishDraggingTo.
699       *       *
700       * @param x The x coordinate of the MouseEvent.       * @param x The x coordinate of the MouseEvent.
701       * @param y The y coordinate of the MouseEvent.       * @param y The y coordinate of the MouseEvent.
# Line 701  public class BasicSplitPaneDivider exten Line 706  public class BasicSplitPaneDivider exten
706      }      }
707    
708      /**      /**
709       * This method is called to finish the drag session       * This method is called to finish the drag session  by calling
710       * by calling finishDraggingTo.       * finishDraggingTo.
711       *       *
712       * @param e The MouseEvent.       * @param e The MouseEvent.
713       */       */
# Line 710  public class BasicSplitPaneDivider exten Line 715  public class BasicSplitPaneDivider exten
715      {      {
716        finishDraggingTo(positionForMouseEvent(e));        finishDraggingTo(positionForMouseEvent(e));
717      }      }
718        
719      /**      /**
720       * This is a helper method that includes the offset       * This is a helper method that includes the offset in the needed
721       * in the needed location.       * location.
722       *       *
723       * @param x The x coordinate of the MouseEvent.       * @param x The x coordinate of the MouseEvent.
724       * @param y The y coordinate of the MouseEvent.       * @param y The y coordinate of the MouseEvent.
# Line 727  public class BasicSplitPaneDivider exten Line 732  public class BasicSplitPaneDivider exten
732    }    }
733    
734    /**    /**
735     * This is a helper class that controls dragging when     * This is a helper class that controls dragging when  the orientation is
736     * the orientation is VERTICAL_SPLIT.     * VERTICAL_SPLIT.
737     */     */
738    protected class VerticalDragController extends DragController    protected class VerticalDragController extends DragController
739    {    {
# Line 744  public class BasicSplitPaneDivider exten Line 749  public class BasicSplitPaneDivider exten
749      }      }
750    
751      /**      /**
752       * This method returns one of the two parameters given       * This method returns one of the two parameters given the orientation. In
753       * the orientation. In this case, it returns y.       * this case, it returns y.
754       *       *
755       * @param x The x coordinate of the MouseEvent.       * @param x The x coordinate of the MouseEvent.
756       * @param y The y coordinate of the MouseEvent.       * @param y The y coordinate of the MouseEvent.
# Line 758  public class BasicSplitPaneDivider exten Line 763  public class BasicSplitPaneDivider exten
763      }      }
764    
765      /**      /**
766       * This method returns the new location of the divider       * This method returns the new location of the divider given a MouseEvent.
      * given a MouseEvent.  
767       *       *
768       * @param e The MouseEvent.       * @param e The MouseEvent.
769       *       *
# Line 771  public class BasicSplitPaneDivider exten Line 775  public class BasicSplitPaneDivider exten
775      }      }
776    
777      /**      /**
778       * This is a helper method that includes the offset       * This is a helper method that includes the offset in the needed
779       * in the needed location.       * location.
780       *       *
781       * @param x The x coordinate of the MouseEvent.       * @param x The x coordinate of the MouseEvent.
782       * @param y The y coordinate of the MouseEvent.       * @param y The y coordinate of the MouseEvent.
# Line 782  public class BasicSplitPaneDivider exten Line 786  public class BasicSplitPaneDivider exten
786      int adjust(int x, int y)      int adjust(int x, int y)
787      {      {
788        return getNeededLocation(x, y) + getY() - offset;        return getNeededLocation(x, y) + getY() - offset;
789      }              }
790    }    }
791    
792    /**    /**
793     * This helper class acts as the Layout Manager for     * This helper class acts as the Layout Manager for the divider.
    * the divider.  
794     */     */
795    protected class DividerLayout implements LayoutManager    protected class DividerLayout implements LayoutManager
796    {    {
# Line 858  public class BasicSplitPaneDivider exten Line 861  public class BasicSplitPaneDivider exten
861      }      }
862    
863      /**      /**
864       * This method changes the button orientation when       * This method changes the button orientation when the orientation of the
865       * the orientation of the SplitPane changes.       * SplitPane changes.
866       */       */
867      private void changeButtonOrientation()      private void changeButtonOrientation()
868      {      {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26