/[classpath]/classpath/javax/swing/ScrollPaneLayout.java
ViewVC logotype

Diff of /classpath/javax/swing/ScrollPaneLayout.java

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

revision 1.8.2.6 by gnu_andrew, Tue Aug 2 20:12:37 2005 UTC revision 1.8.2.7 by gnu_andrew, Tue Sep 20 18:46:32 2005 UTC
# Line 95  public class ScrollPaneLayout Line 95  public class ScrollPaneLayout
95      upperRight = scrollPane.getCorner(UPPER_RIGHT_CORNER);          upperRight = scrollPane.getCorner(UPPER_RIGHT_CORNER);    
96    }    }
97    
98      /**
99       * Removes an existing component.  If oldComponent is not null
100       * and is not equal to newComponent, oldComponent must be removed
101       * from its parent.
102       * @param oldComponent the old Component that may need to be removed.
103       * @param newComponent the Component to add.
104       * @return the newComponent
105       */
106    protected Component addSingletonComponent(Component oldComponent,    protected Component addSingletonComponent(Component oldComponent,
107                                              Component newComponent) {                                              Component newComponent)
108      return null;    {
109        if (oldComponent != null && oldComponent != newComponent)
110          oldComponent.getParent().remove(oldComponent);
111        return newComponent;
112    }    }
113    
114      /**
115       * Add the specified component to the layout.
116       * @param key must be one of VIEWPORT, VERTICAL_SCROLLBAR,
117       * HORIZONTAL_SCROLLBAR, ROW_HEADER, COLUMN_HEADER,
118       * LOWER_RIGHT_CORNER, LOWER_LEFT_CORNER, UPPER_RIGHT_CORNER,
119       * UPPER_LEFT_CORNER.
120       * @param component the Component to add
121       * @throws IllegalArgumentException if key is not as above
122       */
123    public void addLayoutComponent(String key, Component component)    public void addLayoutComponent(String key, Component component)
124    {    {
125      if (key == VIEWPORT)      if (key == VIEWPORT)
# Line 120  public class ScrollPaneLayout Line 140  public class ScrollPaneLayout
140        lowerLeft = component;        lowerLeft = component;
141      else if (key == UPPER_LEFT_CORNER)      else if (key == UPPER_LEFT_CORNER)
142        upperLeft = component;        upperLeft = component;
143        else
144          throw new IllegalArgumentException();
145    }    }
146    
147    public void removeLayoutComponent(Component component) {    public void removeLayoutComponent(Component component) {
# Line 147  public class ScrollPaneLayout Line 169  public class ScrollPaneLayout
169    {    {
170      return vsbPolicy;      return vsbPolicy;
171    }    }
172      
173      /**
174       * Sets the vertical scrollbar policy.
175       * @param policy must be one of VERTICAL_SCROLLBAR_AS_NEEDED,
176       * VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_ALWAYS.
177       * @throws IllegalArgumentException if policy is not one of the valid
178       * JScrollBar policies.
179       */
180    public void setVerticalScrollBarPolicy(int policy)    public void setVerticalScrollBarPolicy(int policy)
181    {    {
182        if (policy != VERTICAL_SCROLLBAR_AS_NEEDED &&
183            policy != VERTICAL_SCROLLBAR_NEVER &&
184            policy != VERTICAL_SCROLLBAR_ALWAYS)
185          throw new IllegalArgumentException("Illegal Scrollbar Policy");
186      vsbPolicy = policy;      vsbPolicy = policy;
187    }    }
188    
# Line 158  public class ScrollPaneLayout Line 191  public class ScrollPaneLayout
191      return hsbPolicy;      return hsbPolicy;
192    }    }
193    
194      /**
195       * Sets the horizontal scrollbar policy.
196       * @param policy must be one of HORIZONTAL_SCROLLBAR_AS_NEEDED,
197       * HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_ALWAYS.
198       * @throws IllegalArgumentException if policy is not one of the valid
199       * JScrollbar policies.
200       */
201    public void setHorizontalScrollBarPolicy(int policy)    public void setHorizontalScrollBarPolicy(int policy)
202    {    {
203        if (policy != HORIZONTAL_SCROLLBAR_AS_NEEDED &&
204            policy != HORIZONTAL_SCROLLBAR_NEVER &&
205            policy != HORIZONTAL_SCROLLBAR_ALWAYS)
206          throw new IllegalArgumentException("Illegal Scrollbar Policy");
207      hsbPolicy = policy;      hsbPolicy = policy;
208    }    }
209    
# Line 188  public class ScrollPaneLayout Line 232  public class ScrollPaneLayout
232      return colHead;      return colHead;
233    }    }
234    
235      /**
236       * Returns the Component at the specified corner.
237       * @param key the corner.
238       * @return the Component at the specified corner, or null if
239       * key is not one of the four valid corners.
240       */
241    public Component getCorner(String key)    public Component getCorner(String key)
242    {    {
243      if (key == LOWER_RIGHT_CORNER)      if (key == LOWER_RIGHT_CORNER)
# Line 377  public class ScrollPaneLayout Line 427  public class ScrollPaneLayout
427          synchronized (sc.getTreeLock ())          synchronized (sc.getTreeLock ())
428            {            {
429              JViewport viewport = sc.getViewport();              JViewport viewport = sc.getViewport();
430              Dimension viewSize = viewport.getViewSize();              Dimension viewSize = viewport.getViewSize();
431              Point viewPos = viewport.getViewPosition();              Point viewPos = viewport.getViewPosition();
432    
433              int x1 = 0, x2 = 0, x3 = 0, x4 = 0;              int x1 = 0, x2 = 0, x3 = 0, x4 = 0;

Legend:
Removed from v.1.8.2.6  
changed lines
  Added in v.1.8.2.7

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