亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jstitlebarlayout.java

?? Java自定義窗體JsFrame。簡介見:http://jason0086.spaces.live.com/Blog/cns!A797D0C5C0C13C92!518.entry
?? JAVA
字號:
package com.hfkj.jsframe.titlebar;

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;

import com.hfkj.jsframe.layout.JsLayoutManager;

/**
 * A js title bar layout lays out a container, arranging the components in its own order:
 * <p>
 * <ul>
 * <li><code>ICON</code>:
 * The head in the direction of west in this layout.
 * <li><code>TITLE</code>:
 * The east neighbor to the <code>ICON</code> in this layout.
 * <li><code>CLOSE</code>:
 * The tail in the direction of east in this layout.
 * <li><code>MAXIMIZE_RESTORE</code>:
 * The east neighbor to the <code>CLOSE</code> in this layout.
 * <li><code>MINIMIZE</code>:
 * The east neighbor to the <code>MAXIMIZE_RESTORE</code> in this layout.
 * </ul>
 * <p>
 * Each of the above regions may contains no more than one component, and is identified
 * by a corresponding constraints:
 * <code>ICON</code>, <code>TITLE</code>, <code>MINIMIZE</code>,
 * <code>MAXIMIZE_RESTORE</code>, <code>CLOSE</code>.
 * When adding a component to a container with a js title bar layout, use one of these
 * five constraints, for example:
 * <pre>
 * Panel p = new Panel();
 * p.setLayout(new JsTitleBarLayout());
 * p.add(new Button("Okay"), JsTitleBarLayout.ICON);
 * </pre>
 * <p>
 * The components are laid out according to their preferred sizes and the constraints of
 * the container's size.
 * <p>
 * Here is an example of five regions in a frame laid out using the <code>JsTitleBarLayout</code>
 * layout manager:
 * <p>
 * <img src="doc-files/JsTitleBarLayout.png" alt="Diagram of a frame demonstrating JsTitleBarLayout.
 * Each section of the JsTitleBarLayout contains a Button associated with its location in the layout,
 * one of: ICON, TITLE, MINIMIZE, MAXIMIZE_RESTORE, CLOSE.">
 * <p>
 * The code for this frame is as follows:
 * <p>
 * <pre>
 * import java.awt.Button;
 * import java.awt.Frame;
 * import java.awt.Color;
 * 
 * import com.hfkj.jsframe.titlebar.JsTitleBarLayout;
 * 
 * public class Test {
 * 
 * 	public static void main(String[] args) {
 * 		Frame xFrm = new Frame("Test JsTitleBarLayout");
 * 		xFrm.setUndecorated(true);
 * 		xFrm.setSize(400, 25);
 * 		xFrm.setLocation(300, 300);
 * 		xFrm.setBackground(Color.YELLOW);
 * 		xFrm.setLayout(new JsTitleBarLayout(5));
 * 		xFrm.add(new Button("Icon"), JsTitleBarLayout.ICON);
 * 		xFrm.add(new Button("Title"), JsTitleBarLayout.TITLE);
 * 		xFrm.add(new Button("-"), JsTitleBarLayout.MINIMIZE);
 * 		xFrm.add(new Button("O"), JsTitleBarLayout.MAXIMIZE_RESTORE);
 * 		xFrm.add(new Button("X"), JsTitleBarLayout.CLOSE);
 * 		xFrm.setVisible(true);
 * 	}
 * 		
 * }
 * </pre>
 * 
 * @see JsTitleBar
 * 
 * @version 1.0 01/05/09
 * @author Jason (MSN:www.jason0086.com@hotmail.com)
 */
public class JsTitleBarLayout implements JsLayoutManager {

	/**
	 * The icon layout constraint(north west of container).
	 */
	public static final String ICON = "Icon";
	
	/**
	 * The title layout constraint(north of container).
	 */
	public static final String TITLE = "Title";
	
	/**
	 * The minimize layout constraint(center of container).
	 */
	public static final String MINIMIZE = "Minimize";
	
	/**
	 * The maximize layout constraint(west of container).
	 */
	public static final String MAXIMIZE_RESTORE = "Maximize_Restore";
	
	/**
	 * The close layout constraint(north east of container).
	 */
	public static final String CLOSE = "Close";
	
	/**
	 * Constant to specify components location to be the icon portion of the layout.
	 */
	private Component icon = null;
	
	/**
	 * Constant to specify components location to be the title portion of the layout.
	 */
	private Component title = null;
	
	/**
	 * Constant to specify components location to be the minimize portion of the layout.
	 */
	private Component minimize = null;
	
	/**
	 * Constant to specify components location to be the maximize portion of the layout.
	 */
	private Component maximize = null;
	
	/**
	 * Constant to specify components location to be the close portion of the layout.
	 */
	private Component close = null;
	
	/**
	 * The horizontal gap between components.
	 */
	private int hgap = 0;
	
	/**
	 * Constructs a new layout with no gaps between components.
	 *
	 */
	public JsTitleBarLayout() {
		this(0);
	}
	
	/**
	 * Constructs a layout with the specify gaps between components.
	 * @param h the horizontal gap between components
	 */
	public JsTitleBarLayout(int h) {
		hgap = h;
	}
	
	/**
	 * Sets the horizontal gap between components.
	 * @param h the horizontal gap
	 */
	public void setHgap(int h) {
		hgap = h;
	}
	
	/**
	 * Returns the horizontal gap between components.
	 * @return the horizontal gap
	 */
	public int getHgap() {
		return hgap;
	}
	
	/**
	 * Returns the component that was added using the given constraint.
	 * @param constraints the location of the component in this layout
	 * @return the component associated with the given constraints.
	 */
	public Component getLayoutComponent(Object constraints) {
		if (ICON.equals(constraints)) {
			return icon;
		}
		else if (TITLE.equals(constraints)) {
			return title;
		}
		else if (MINIMIZE.equals(constraints)) {
			return minimize;
		}
		else if (MAXIMIZE_RESTORE.equals(constraints)) {
			return maximize;
		}
		else if (CLOSE.equals(constraints)) {
			return close;
		}
		else {
			throw new IllegalArgumentException("Can not get component: unknown constraint:" + constraints);
		}
	}

	/**
	 * Returns the aligment along the x axis.
	 * This specifies how the component would like to aligned relative to other components.
	 * The value should be a number between 0 and 1 where 0 represents alignment along the origin,
	 * 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
	 * @param target the container
	 * @return the aligment along the x axis
	 */
	public float getLayoutAlignmentX(Container target) {
		return 0.5f;
	}

	/**
	 * Returns the alignment along the y axis.
	 * This specifies how the component would like to be aligned relative to other components.
	 * The value should be a number between 0 and 1 where 0 represents alignment along the origin, 
	 * 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
	 * @param target the container
	 * @return the aligment along the y axis
	 */
	public float getLayoutAlignmentY(Container target) {
		return 0.5f;
	}

	/**
	 * Invalidates the layout, 
	 * indicating that if the layout manager has cached information it should be discarded.
	 * @param target the container
	 */
	public void invalidateLayout(Container target) {
		// TODO Auto-generated method stub
		
	}

	/**
	 * Determines the maximum dimensions of the target container using this layout manager.
	 * @param target the container
	 * @return the maximum dimensions for this layout
	 */
	public Dimension maximumLayoutSize(Container target) {
		return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
	}
	
	/**
	 * Adds the specify component to the layout, using the specify constraint object.
	 * The constraint should be null or one of the following constants:
	 * <code>ICON</code>, <code>TITLE</code>, <code>MINIMIZE</code>, <code>MAXIMAZI_RESTORE</code>,
	 * <code>CLOSE</code>.
	 * @param component the component to be added to this layout
	 * @param constraints the location of the component in this layout
	 */
	public void addLayoutComponent(Component component, Object constraints) {
		synchronized (component.getTreeLock()) {
			if ((constraints == null)  
					|| (constraints instanceof String)) {
				addLayoutComponent((String) constraints, component);
			}
			else {
				throw new IllegalArgumentException("Can not add to layout: constraint must be a string (or null)");
			}
		}
	}

	
	/**
	 * Adds the specify component to the layout, using the specify name as its location.
	 * The constraint should be null or one of the following constants:
	 * <code>ICON</code>, <code>TITLE</code>, <code>MINIMIZE</code>, <code>MAXIMAZI_RESTORE</code>,
	 * <code>CLOSE</code>.
	 * @param name the location of the component in this layout
	 * @param component the component to be added to this layout
	 */
	public void addLayoutComponent(String name, Component component) {
		synchronized (component.getTreeLock()) {
			/* Assign the componentonent to one of the known regions of the layout. */
			if (ICON.equals(name)) {
				icon = component;
			}
			else if (TITLE.equals(name)) {
				title = component;
			}
			else if (MINIMIZE.equals(name)) {
				minimize = component;
			}
			else if (MAXIMIZE_RESTORE.equals(name)) {
				maximize = component;
			}
			else if (CLOSE.equals(name)) {
				close = component;
			}
			else {
				throw new IllegalArgumentException("Can not add to layout:unkown constraint:" +name);
			}
		}
	}

	/**
	 * Lays out the container argument using this layout.
	 * This method actually reshapes the components in the specify container 
	 * in order to satisfy the constraints of this <code>JsTitleBarLayout</code> object.
	 * @param target the container
	 */
	public void layoutContainer(Container target) {
		synchronized (target.getTreeLock()) {
			Insets xIns = target.getInsets();
			int top = xIns.top;
			int left = xIns.left;
			int right = target.getWidth() - xIns.right;
			if (icon != null) {
				Dimension d  = icon.getPreferredSize();
				icon.setBounds(left, top, d.width, d.height);
				left += d.width + hgap;
			}
			if (title != null) {
				Dimension d = title.getPreferredSize();
				title.setBounds(left, top, d.width, d.height);
				left += d.width + hgap;
			}
			if (close != null) {
				Dimension d = close.getPreferredSize();
				close.setBounds(right - d.width, top, d.width, d.height);
				right -= d.width + hgap;
			}
			if (maximize != null) {
				Dimension d = maximize.getPreferredSize();
				maximize.setBounds(right - d.width, top, d.width, d.height);
				right -= d.width + hgap;
			}
			if (minimize != null) {
				Dimension d = minimize.getPreferredSize();
				minimize.setBounds(right - d.width, top, d.width, d.height);
				right -= d.width + hgap;
			}
		}
	}

	/**
	 * Determines the minimum size of the target container using this layout manager.
	 * This method is called when a container calls its getMinimumSize method.
	 * Most applications do no call this method directly.
	 * @param target the container
	 * @return teh minimum size of this layout
	 */
	public Dimension minimumLayoutSize(Container target) {
		synchronized (target.getTreeLock()) {
			Dimension xDmn = new Dimension(0, 0);
			if (icon != null) {
				Dimension d = icon.getMinimumSize();
				xDmn.width += d.width + hgap;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			if (title != null) {
				Dimension d = title.getMinimumSize();
				xDmn.width += d.width + hgap;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			if (minimize != null) {
				Dimension d = minimize.getMinimumSize();
				xDmn.width += d.width;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			if (maximize != null) {
				Dimension d = maximize.getMinimumSize();
				xDmn.width += d.width + hgap;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			if (close != null) {
				Dimension d = close.getMinimumSize();
				xDmn.width += d.width + hgap;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			Insets xIns = target.getInsets();
			xDmn.width += xIns.left + xIns.right;
			xDmn.height += xIns.top + xIns.bottom;
			return xDmn;
		}
	}
	
	/**
	 * Determines the preferred size of the target container using this layout manager, 
	 * based on the components in the container.
	 * This method is called when a container calls its getPreferredSize method.
	 * Most applications do not call this method directly.
	 * @param target the container
	 * @return the preferred size of this layout
	 */
	public Dimension preferredLayoutSize(Container target) {
		synchronized (target.getTreeLock()) {
			// north line
			Dimension xDmn = new Dimension(0, 0);
			if (icon != null) {
				Dimension d = icon.getPreferredSize();
				xDmn.width += d.width + hgap;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			if (title != null) {
				Dimension d = title.getPreferredSize();
				xDmn.width += d.width + hgap;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			if (minimize != null) {
				Dimension d = minimize.getPreferredSize();
				xDmn.width += d.width;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			if (maximize != null) {
				Dimension d = maximize.getPreferredSize();
				xDmn.width += d.width + hgap;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			if (close != null) {
				Dimension d = close.getPreferredSize();
				xDmn.width += d.width + hgap;
				xDmn.height = Math.max(xDmn.height, d.height);
			}
			Insets xIns = target.getInsets();
			xDmn.width += xIns.left + xIns.right;
			xDmn.height += xIns.top + xIns.bottom;
			return xDmn;
		}
	}

	/**
	 * Removes the specify component from this layout.
	 * This method is called when a container calls its remove or removeAll methods.
	 * Most applications do not call this method directly.
	 * @param component the component to be removed from this layout
	 */
	public void removeLayoutComponent(Component component) {
		synchronized (component.getTreeLock()) {
			if (component == icon) {
				icon = null;
			}
			else if (component == title) {
				title = null;
			}
			else if (component == minimize) {
				minimize = null;
			}
			else if (component == maximize) {
				maximize = null;
			}
			else if (component == close) {
				close = null;
			}
		}
	}
	
	/**
	 * Returns the constraints associated with the specify component.
	 * @param component the component
	 * @return the constraints indicating the location of the given component in this layout
	 */
	public Object getConstraints(Component component) {
		if (component == icon) {
			return ICON;
		}
		else if (component == title) {
			return TITLE;
		}
		else if (component == minimize) {
			return MINIMIZE;
		}
		else if (component == maximize) {
			return MAXIMIZE_RESTORE;
		}
		else if (component == close) {
			return CLOSE;
		}
		else {
			return null;
		}
	}
	
	/**
	 * Returns a representation of this layout.
	 * @return the string specifying this layout
	 */
	public String toString() {
		return getClass().getName() + "[hgap=" + hgap + "]";
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美视频一区二区| 成人教育av在线| 国产精品中文字幕一区二区三区| 成人黄页毛片网站| 6080yy午夜一二三区久久| 国产精品毛片大码女人| 日本欧美肥老太交大片| 在线精品亚洲一区二区不卡| 国产欧美精品在线观看| 日日夜夜免费精品| 色爱区综合激月婷婷| 国产精品入口麻豆九色| 精品一区二区三区在线视频| 精品污污网站免费看| 亚洲欧美韩国综合色| 成人毛片在线观看| 欧美激情综合网| 精品亚洲porn| 日韩精品影音先锋| 日韩中文字幕1| 欧美日本高清视频在线观看| 一区二区三区成人| 欧美自拍丝袜亚洲| 亚洲精品高清视频在线观看| eeuss影院一区二区三区| 国产精品色呦呦| jlzzjlzz亚洲女人18| 国产精品国产三级国产普通话蜜臀| 国产激情视频一区二区三区欧美| 久久久亚洲高清| 国产精品69毛片高清亚洲| 2021中文字幕一区亚洲| 久久91精品国产91久久小草| 精品福利一区二区三区免费视频| 久久国产尿小便嘘嘘| 欧美不卡一区二区三区四区| 国精产品一区一区三区mba视频| 日韩丝袜情趣美女图片| 国内精品视频一区二区三区八戒| 亚洲精品一区二区三区精华液 | 亚洲图片有声小说| 欧美午夜精品久久久久久超碰| 亚洲成人激情综合网| 欧美日韩国产高清一区| 日韩国产在线一| 欧美电影免费观看高清完整版在 | 久久蜜桃av一区精品变态类天堂| 国产一区二区三区视频在线播放| 久久亚洲春色中文字幕久久久| 国产在线播放一区三区四| 国产欧美日本一区二区三区| av一二三不卡影片| 亚洲国产精品一区二区尤物区| 在线不卡中文字幕| 国产一区二区在线影院| 国产精品久久久久三级| 欧美日韩小视频| 久久97超碰色| 最新日韩av在线| 欧美一区二区三区免费在线看| 国模无码大尺度一区二区三区| 最近日韩中文字幕| 欧美丰满嫩嫩电影| 国产精品一二三在| 亚洲一区在线观看视频| 亚洲精品在线观| 在线看国产一区二区| 狠狠色狠狠色合久久伊人| 亚洲欧美一区二区三区久本道91| 欧美另类一区二区三区| 国产98色在线|日韩| 亚洲国产乱码最新视频 | 日韩一区二区影院| 91香蕉国产在线观看软件| 日本视频中文字幕一区二区三区| 国产日韩欧美精品在线| 欧美三级视频在线观看| 丁香六月久久综合狠狠色| 日韩高清在线电影| 亚洲欧美日本韩国| 精品久久五月天| 精品视频在线免费观看| 国产suv精品一区二区三区| 亚洲不卡av一区二区三区| 国产三级精品三级| 欧美一卡二卡在线| 欧美在线免费视屏| 国产91精品露脸国语对白| 蜜桃视频在线观看一区| 亚洲图片欧美综合| 亚洲男帅同性gay1069| 国产欧美一区二区精品久导航 | 欧美精品色综合| 一本到一区二区三区| 国产电影一区二区三区| 另类欧美日韩国产在线| 丝袜美腿亚洲综合| 一区二区三区 在线观看视频| 国产欧美日韩在线| 久久在线观看免费| 日韩精品在线一区| 日韩一二在线观看| 欧美日本在线看| 91国产丝袜在线播放| 成人av资源下载| va亚洲va日韩不卡在线观看| 国产经典欧美精品| 岛国一区二区在线观看| 成人中文字幕在线| 国产99久久久久久免费看农村| 久久精品国产精品亚洲精品| 无码av中文一区二区三区桃花岛| 亚洲一区二区三区四区五区中文| 亚洲三级在线免费| 自拍偷拍欧美激情| 一区二区视频在线| 亚洲伊人色欲综合网| 首页国产欧美日韩丝袜| 蜜臀久久99精品久久久久久9| 奇米影视一区二区三区| 精品一区二区日韩| 国产又黄又大久久| 国产黄色精品视频| eeuss鲁片一区二区三区| 99精品久久久久久| 欧美曰成人黄网| 欧美日韩国产成人在线91| 91精品国产一区二区三区香蕉| 日韩欧美国产一二三区| 久久久久国产成人精品亚洲午夜 | 亚洲在线成人精品| 日韩高清不卡一区二区三区| 久久精品国产精品亚洲红杏| 国产成人免费在线| 色8久久精品久久久久久蜜| 9191国产精品| 久久久精品tv| 亚洲一区精品在线| 美女一区二区在线观看| 成人小视频免费观看| 在线观看欧美日本| 精品免费国产一区二区三区四区| 中文字幕第一区二区| 亚洲一级二级在线| 韩国av一区二区三区四区| 91麻豆精品一区二区三区| 欧美一区二区视频在线观看| 日本一区二区三区在线观看| 亚洲国产一区二区在线播放| 激情丁香综合五月| 欧洲另类一二三四区| 精品国产91乱码一区二区三区| 亚洲人成精品久久久久久| 久久99久久99| 91官网在线免费观看| 欧美精品一区二区三区蜜臀| 亚洲精品国产a久久久久久| 精品一区二区免费| 欧美在线高清视频| 国产精品久久一级| 青青草一区二区三区| 色综合久久天天综合网| 2023国产一二三区日本精品2022| 一区二区三区四区五区视频在线观看| 久久精品噜噜噜成人av农村| 色婷婷久久综合| 国产欧美精品国产国产专区| 日韩精品91亚洲二区在线观看| www.99精品| 久久精品日韩一区二区三区| 五月婷婷久久丁香| 91丨九色丨蝌蚪丨老版| 26uuu国产一区二区三区| 日韩不卡手机在线v区| 91激情五月电影| 中文字幕va一区二区三区| 极品尤物av久久免费看| 欧美日韩大陆一区二区| 亚洲色欲色欲www| 国产·精品毛片| 精品国产凹凸成av人网站| 午夜av一区二区三区| 色久综合一二码| 国产蜜臀97一区二区三区 | 欧美又粗又大又爽| 一区二区三区丝袜| 91在线porny国产在线看| 国产日韩精品一区二区浪潮av | 蜜乳av一区二区三区| 欧美喷潮久久久xxxxx| 亚洲最大的成人av| 日本韩国欧美一区二区三区| 亚洲人成在线观看一区二区| 成人污污视频在线观看| 日本一区二区三区免费乱视频| 国产一区二区在线影院| 久久精品亚洲精品国产欧美| 国产成人av一区| 国产精品网站在线| 91啪九色porn原创视频在线观看|