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

  1. /*
  2.  * @(#)LineView.java    1.3 97/09/29
  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. package com.sun.java.swing.text.html;
  21.  
  22. import java.util.Enumeration;
  23. import java.awt.*;
  24. import com.sun.java.swing.border.*;
  25. import com.sun.java.swing.text.*;
  26.  
  27. /**
  28.  * A view implementation to display an unwrapped 
  29.  * preformatted line.
  30.  *
  31.  * @author  Timothy Prinzing
  32.  * @version 1.3 09/29/97
  33.  */
  34. class LineView extends BoxView  {
  35.  
  36.     /**
  37.      * Creates a LineView object.
  38.      *
  39.      * @param elem the element to wrap in a view
  40.      */
  41.     public LineView(Element elem) {
  42.     super(elem, View.X_AXIS);
  43.     }
  44.  
  45.     /**
  46.      * Gets the resize weight for the specified axis.
  47.      *
  48.      * @param axis may be either X_AXIS or Y_AXIS
  49.      * @return the weight
  50.      */
  51.     public int getResizeWeight(int axis) {
  52.     switch (axis) {
  53.     case View.X_AXIS:
  54.         return 1;
  55.     case View.Y_AXIS:
  56.         return 0;
  57.     default:
  58.         throw new IllegalArgumentException("Invalid axis: " + axis);
  59.     }
  60.     }
  61.  
  62.     /**
  63.      * Gets the alignment for an axis.
  64.      *
  65.      * @param axis may be either X_AXIS or Y_AXIS
  66.      * @return the alignment
  67.      */
  68.     public float getAlignment(int axis) {
  69.     if (axis == View.X_AXIS) {
  70.         return 0;
  71.     }
  72.     return super.getAlignment(axis);
  73.     }
  74.  
  75. }
  76.