⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layout.java.svn-base

📁 j2me设计的界面包
💻 SVN-BASE
字号:
/*
 * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Sun designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Sun in the LICENSE file that accompanied this code.
 *
 * This code 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 General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 */
package com.sun.lwuit.layouts;

import com.sun.lwuit.geom.Dimension;
import com.sun.lwuit.*;

/**
 * Abstract class that can be used to arrange components in a container using
 * a predefined algorithm. This class may be implemented externally and is similar
 * in spirit to the AWT/Swing layout managers.
 *
 * @author Chen Fishbein
 */
public abstract class Layout {
    
    /**
     * Layout the given parent container children
     * 
     * @param parent the given parent container
     */
    public abstract void layoutContainer(Container parent);
    
    
    /**
     * Returns the container preferred size
     * 
     * @param parent the parent container
     * @return the container preferred size
     */
    public abstract Dimension getPreferredSize(Container parent);

    /**
     * Some layouts can optionally track the addition of elements with meta-data 
     * that allows the user to "hint" on object positioning.
     * 
     * @param value optional meta data information, like alignment orientation
     * @param comp the added component to the layout
     * @param c the parent container
     */
    public void addLayoutComponent(Object value, Component comp, Container c) {
        throw new IllegalStateException("Layout doesn't support adding with arguments: " + getClass().getName());
    }

    /**
     * Removes the component from the layout this operation is only useful if the 
     * layout maintains references to components within it
     * 
     * @param comp the removed component from layout
     */
    public void removeLayoutComponent(Component comp) {}
    
    public Object getComponentConstraint(Component comp) {
        return null;
    }
    
    /**
     * This method returns true if the Layout allows Components to
     * Overlap.
     * 
     * @return true if Components may intersect in this layout
     */
    public boolean isOverlapSupported(){
        return false;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -