WingPanel.java :  » Web-Framework » wingS » com » javujavu » javux » wings » Java Open Source

Java Open Source » Web Framework » wingS 
wingS » com » javujavu » javux » wings » WingPanel.java
/*
*  Javu WingS - Lightweight Java Component Set
*  Copyright (c) 2005-2007 Krzysztof A. Sadlocha
*  e-mail: ksadlocha@programics.com
*
*  This library is free software; you can redistribute it and/or
*  modify it under the terms of the GNU Lesser General Public
*  License as published by the Free Software Foundation; either
*  version 2.1 of the License, or (at your option) any later version.
*
*  This library is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
*  Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public
*  License along with this library; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

package com.javujavu.javux.wings;

import java.awt.FlowLayout;
import java.awt.LayoutManager;
import java.awt.Point;

/**
 * <code>WingPanel</code> is the container class
 * in which an application can attach any other
 * component, including other panels.
 * <br>
 * <b>This class is thread safe.</b>
 **/
public class WingPanel extends WingComponent
{
    /**
     * Creates a new panel using <code>FlowLayout</code> class as the layout manager.
     */
  public WingPanel()
  {
    this(new FlowLayout());
  }
    /**
     * Creates a new panel with the specified layout manager.
     * @param lm the layout manager for this panel.
     */
  public WingPanel(LayoutManager lm)
  {
    setLayout(lm);
  }
    /**
     * Loads skin resources.<br>
     * <pre>
     * styles:
     * [optional styleID.]panel.normal
     * [optional styleID.]panel.disabled
     * </pre>
     * @see Style
     * @see WingSkin
     */
  public void loadSkin()
  {
    stNormal= WingSkin.getStyle(styleId, "panel", NORMAL, null);
    stDisabled= WingSkin.getStyle(styleId, "panel", DISABLED, stNormal).merge(stTop);
    stNormal= stNormal.merge(stTop);
  }
  /**
   * @see com.javujavu.javux.wings.WingComponent#getScrollIncrements(java.awt.Point, java.awt.Point)
   */
  public void getScrollIncrements(Point unit, Point block)
  {
    super.getScrollIncrements(unit, block);
    WingFont font= getWingFont();
    unit.x= font.stringWidth("O");
    unit.y= font.getHeight();
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.