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

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

?? jstitlebar.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.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Image;
import java.awt.LayoutManager;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.UIManager;

import com.hfkj.jsframe.component.JsComponent;

/**
 * The <code>JsTitleBar</code> uses <code>JsTitleBarLayout</code> layout manager,
 * which contains five components associated with the following constaints
 * as their location in the layout:
 * <p>
 * <ul>
 * <li><code>ICON</code>(defined in <code>JsTitleBarLayout</code>):
 * The icon portion in the layout of this title bar.
 * <li><code>TITLE</code>(defined in <code>JsTitleBarLayout</code>):
 * The title text portoin in the layout of this title bar.
 * <li><code>MINIMIZE</code>(defined in <code>JsTitleBarLayout</code>):
 * The minimize button portion in the layout of this title bar.
 * <li><code>MAXIMIZE_RESTORE</code>(defined in <code>JsTitleBarLayout</code>):
 * The maximize-restore button portion in the layout of this title bar.
 * <li><code>CLOSE</code>(defined in <code>JsTitleBarLayout</code>):
 * The close button portion in the layout of this title bar.
 * <p>
 * If you just want to operate some of the above portions, you should first get it 
 * from the layout of the <code>JsTitleBar</code> object by doing the following:
 * <pre>
 * Component icon = titleBar.getLayoutComponent(JsTitleBarLayout.ICON);
 * Component title = titleBar.getLayoutComponent(JsTitleBarLayout.TITLE);
 * Component minimize = titleBar.getLayoutComponent(JsTitleBarLayout.MINIMIZE);
 * Component maximize = titleBar.getLayoutComponent(JsTitleBarLayout.MAXIMIZE_RESTORE);
 * Component close = titleBar.getLayoutComponent(JsTitleBarLayout.CLOSE);
 * </pre>
 * or doing the following:
 * <pre>
 * JLabel icon = (JLabel) titleBar.getLayoutComponent(JsTitleBarLayout.ICON);
 * JLabel title = (JLabel) titleBar.getLayoutComponent(JsTitleBarLayout.TITLE);
 * JButton minimize = (JButton) titleBar.getLayoutComponent(JsTitleBarLayout.MINIMIZE);
 * JButton maximize = (JButton) titleBar.getLayoutComponent(JsTitleBarLayout.MAXIMIZE_RESTORE);
 * JButton close = (JButton) titleBar.getLayoutComponent(JsTitleBarLayout.CLOSE);
 * </pre>
 * 
 * @see JsTitleBarLayout
 * 
 * @version 1.0 01/05/09
 * @author Jason (MSN:www.jason0086.com@hotmail.com)
 */
public class JsTitleBar extends JsComponent implements MouseListener, MouseMotionListener {
	
	/**
	 * The none button constriant.
	 */
	public static final int NONE_BUTTON = 0;
	
	/**
	 * The all button constraint.
	 */
	public static final int ALL_BUTTON = 1;
	
	/**
	 * The minimize button constraint.
	 */
	public static final int MINIMIZE_BUTTON = 2;
	
	/**
	 * The maximize restore button constraint.
	 */
	public static final int MAXIMIZE_RESTORE_BUTTON = 3;
	
	/**
	 * The close button constraint.
	 */
	public static final int CLOSE_BUTTON = 4;

	private static final long serialVersionUID = 1822916850358931546L;
	
	/**
	 * Constant to specify the js title bar layout for this title bar.
	 */
	private JsTitleBarLayout layoutJtb = null;
	
	/**
	 * Constant to specify the root frame where this title bar lays.
	 */
	private Frame rootFrm = null;
	
	/**
	 * Constant to specify the mouse point.
	 */
	private Point mousePnt = null;
	
	/**
	 * Constant to specify the movabled state of this title bar, 
	 * which also specifies the movabled state of the corresponding root frame.
	 */
	private boolean movableBln = true;
	
	/**
	 * Constant to specify the dragging state of the mouse.
	 */
	private boolean draggingBln = false;
	
	/**
	 * The icon for the maximize-restore button when the state of the frame is not <code>MAXIMIZED_BOTH</code>.
	 */
	private Icon maximizeIcn = null;

	/**
	 * The string for the maximize-restore button when the state of the frame is not <code>MAXIMIZED_BOTH</code>.
	 */
	private String maximizeStr = null;

	/**
	 * The icon for the maximize-restore button when the state of the frame is <code>MAXIMIZED_BOTH</code>.
	 */
	private Icon restoreIcn = null;

	/**
	 * The string for the maximize-restore button when the state of the frame is <code>MAXIMIZED_BOTH</code>.
	 */
	private String restoreStr = null;
	
	/**
	 * Constructs a js title bar for the specify frame.
	 * @param rootFrame the root frame where this title bar is to be laid
	 */
	public JsTitleBar(Frame rootFrame) {
		this.rootFrm = rootFrame;
		// set the layout
		this.layoutJtb = new JsTitleBarLayout(3);
		this.setLayout(this.layoutJtb);
		// setup all the button
		this.setupButton(ALL_BUTTON);
		// add the mouse listener
		this.addMouseListener(this);
		// add the mouse motion listener
		this.addMouseMotionListener(this);
		// add the window state listner
		this.rootFrm.addWindowStateListener(
			new WindowStateListener() {
				public void windowStateChanged(WindowEvent e) {
					int newStateInt = e.getNewState();
					if (newStateInt == Frame.MAXIMIZED_BOTH) {
						movableBln = false;
						JButton maximizeRestoreJbt = (JButton) layoutJtb.getLayoutComponent(JsTitleBarLayout.MAXIMIZE_RESTORE);
						maximizeRestoreJbt.setIcon(UIManager.getIcon("InternalFrame.minimizeIcon"));
						maximizeRestoreJbt.setToolTipText(UIManager.getString("InternalFrameTitlePane.restoreButtonText"));
					}
					else if (newStateInt != Frame.ICONIFIED) {
						movableBln = true;
						JButton maximizeRestoreJbt = (JButton) layoutJtb.getLayoutComponent(JsTitleBarLayout.MAXIMIZE_RESTORE);
						maximizeRestoreJbt.setIcon(UIManager.getIcon("InternalFrame.maximizeIcon"));
						maximizeRestoreJbt.setToolTipText(UIManager.getString("InternalFrameTitlePane.maximizeButtonText"));
					}
				}
			}
		);
	}
	
	@Override
	public LayoutManager getLayout() {
		return this.layoutJtb;
	}
	
	/**
	 * Change the icon and string associated with the look and feel.
	 */
	public void changeLookAndFeel() {
		// minimize button
		JButton minimizeJbt = (JButton) this.layoutJtb.getLayoutComponent(JsTitleBarLayout.MINIMIZE);
		minimizeJbt.setIcon(UIManager.getIcon("InternalFrame.iconifyIcon"));
		minimizeJbt.setToolTipText(UIManager.getString("InternalFrameTitlePane.minimizeButtonText"));
		// maximize-restore button
		this.maximizeIcn = UIManager.getIcon("InternalFrame.maximizeIcon");
		this.maximizeStr = UIManager.getString("InternalFrameTitlePane.maximizeButtonText");
		this.restoreIcn = UIManager.getIcon("InternalFrame.minimizeIcon");
		this.restoreStr = UIManager.getString("InternalFrameTitlePane.restoreButtonText");
		JButton maximizeRestoreJbt = (JButton) this.layoutJtb.getLayoutComponent(JsTitleBarLayout.MAXIMIZE_RESTORE);
		if (this.rootFrm.getExtendedState() == Frame.MAXIMIZED_BOTH) {
			maximizeRestoreJbt.setIcon(this.restoreIcn);
			maximizeRestoreJbt.setToolTipText(this.restoreStr);
		}
		else {
			maximizeRestoreJbt.setIcon(this.maximizeIcn);
			maximizeRestoreJbt.setToolTipText(this.maximizeStr);
		}
		// close button
		JButton closeJbt = (JButton) this.layoutJtb.getLayoutComponent(JsTitleBarLayout.CLOSE);
		closeJbt.setIcon(UIManager.getIcon("InternalFrame.closeIcon"));
		closeJbt.setToolTipText(UIManager.getString("InternalFrameTitlePane.closeButtonText"));
	}

	/**
	 * Sets the image to be desplayed in the <code>ICON</code> portion of this title bar,
	 * and the iconfield icon.
	 * @param image the image for icon
	 */
	public void setIconImage(Image image) {
		JLabel iconJlb = new JLabel(new ImageIcon(image));
		iconJlb.setPreferredSize(new Dimension(25, 25));
		this.add(iconJlb, JsTitleBarLayout.ICON);
	}
	
	/**
	 * Sets the title text to the specify string, which is to be displayed in the 
	 * <code>TITLE</code> portion of this title bar, and the iconfield text.
	 * @param title the title text. A <code>null</code> value is treated as an empty string, ""
	 */
	public void setTitle(String title) {
		if (title == null) {
			title = "";
		}
		JLabel titleJlb = new JLabel(title);
		titleJlb.setFont(new Font(null, Font.BOLD, 16));
		this.add(titleJlb, JsTitleBarLayout.TITLE);
	}

	/**
	 * Sets the enabled state of the specify button.
	 * @param button the button combination of this title bar associated with one of the following constraints: 
	 * 		<code>NONE_BUTTON</code>, <code>ALL_BUTTON</code>, <code>MINIMIZE_BUTTON</code>,
	 * 		<code>MAXIMIZE_RESTORE_BUTTON</code>, <code>CLOSE_BUTTON</code>
	 * @param enabled the enabled state of the given button
	 */
	public void setButtonEnabled(int button, boolean enabled) {
		if (button == ALL_BUTTON) {
			this.setButtonEnabled(MINIMIZE_BUTTON, enabled);
			this.setButtonEnabled(MAXIMIZE_RESTORE_BUTTON, enabled);
			this.setButtonEnabled(CLOSE_BUTTON, enabled);
		}
		else if (button == MINIMIZE_BUTTON) {
			this.layoutJtb.getLayoutComponent(JsTitleBarLayout.MINIMIZE).setEnabled(enabled);
		}
		else if (button == MAXIMIZE_RESTORE_BUTTON) {
			this.layoutJtb.getLayoutComponent(JsTitleBarLayout.MAXIMIZE_RESTORE).setEnabled(enabled);
		}
		else if (button == CLOSE_BUTTON) {
			this.layoutJtb.getLayoutComponent(JsTitleBarLayout.CLOSE).setEnabled(enabled);
		}
		else {
			throw new IllegalArgumentException("Invalid buttonInt.");
		}
	}

	/** 
	 * Sets the movabled state of this title bar, which also specifies the movabled state of
	 * the corresponding root frame.
	 * @param movabled the movabled state of the root frame
	 */
	public void setMovable(boolean movabled) {
		this.movableBln = movabled;
	}

	/**
	 * Implements <code>java.awt.event.MouseListener</code>.
	 */
	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	/**
	 * Implements <code>java.awt.event.MouseListener</code>.
	 */
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	/**
	 * Implements <code>java.awt.event.MouseListener</code>.
	 */
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	/**
	 * Implements <code>java.awt.event.MouseListener</code>.
	 */
	public void mousePressed(MouseEvent e) {
		if (e.getClickCount() == 2) {
			this.draggingBln = false;
			if (rootFrm.isResizable()) {
				if (rootFrm.getExtendedState() == Frame.MAXIMIZED_BOTH) {
					rootFrm.setExtendedState(Frame.NORMAL);
				}
				else {
					rootFrm.setExtendedState(Frame.MAXIMIZED_BOTH);
				}
			}
		}
		else if (this.movableBln) {
			this.draggingBln = true;
			this.mousePnt = MouseInfo.getPointerInfo().getLocation();
		}
	}

	/**
	 * Implements <code>java.awt.event.MouseListener</code>.
	 */
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	/**
	 * Implements <code>java.awt.event.MouseMotionListener</code>.
	 */
	public void mouseDragged(MouseEvent e) {
		if (this.draggingBln 
				&& this.movableBln) {
	        Point xPnt = MouseInfo.getPointerInfo().getLocation();
	        int x = this.rootFrm.getX();
	        int y = this.rootFrm.getY();
	        x += xPnt.x - this.mousePnt.x;
	        y += xPnt.y - this.mousePnt.y;
	        this.mousePnt = xPnt;
	        this.rootFrm.setLocation(x, y);
		}
	}

	/**
	 * Implements <code>java.awt.event.MouseMotionListener</code>.
	 */
	public void mouseMoved(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	
	private void setupButton(int buttonInt) {
		if (buttonInt == NONE_BUTTON) {
			Component xCmp = null;
			if ((xCmp = this.layoutJtb.getLayoutComponent(JsTitleBarLayout.MINIMIZE)) != null) {
				this.layoutJtb.removeLayoutComponent(xCmp);
			}
			if ((xCmp = this.layoutJtb.getLayoutComponent(JsTitleBarLayout.MAXIMIZE_RESTORE)) != null) {
				this.layoutJtb.removeLayoutComponent(xCmp);
			}
			if ((xCmp = this.layoutJtb.getLayoutComponent(JsTitleBarLayout.CLOSE)) != null) {
				this.layoutJtb.removeLayoutComponent(xCmp);
			}
		}
		else if (buttonInt == ALL_BUTTON) {
			this.setupButton(MINIMIZE_BUTTON);
			this.setupButton(MAXIMIZE_RESTORE_BUTTON);
			this.setupButton(CLOSE_BUTTON);
		}
		else if (buttonInt == MINIMIZE_BUTTON) {
			JButton minimizeJbt = new JButton();
			minimizeJbt.setIcon(UIManager.getIcon("InternalFrame.iconifyIcon"));
			minimizeJbt.setToolTipText(UIManager.getString("InternalFrameTitlePane.minimizeButtonText"));
			minimizeJbt.setPreferredSize(new Dimension(25, 25));
			minimizeJbt.addMouseListener(
				new MouseAdapter() {
					public void mouseReleased(MouseEvent e) {
						rootFrm.setExtendedState(Frame.ICONIFIED);
					}
				}
			);
			this.add(minimizeJbt, JsTitleBarLayout.MINIMIZE);
		}
		else if (buttonInt == MAXIMIZE_RESTORE_BUTTON) {
			JButton maximizeRestoreJbt = new JButton();
			if (this.rootFrm.getExtendedState() == Frame.MAXIMIZED_BOTH) {
				maximizeRestoreJbt.setIcon(UIManager.getIcon("InternalFrame.minimizeIcon"));
				maximizeRestoreJbt.setToolTipText(UIManager.getString("InternalFrameTitlePane.restoreButtonText"));
			}
			else {
				maximizeRestoreJbt.setIcon(UIManager.getIcon("InternalFrame.maximizeIcon"));
				maximizeRestoreJbt.setToolTipText(UIManager.getString("InternalFrameTitlePane.maximizeButtonText"));
			}
			maximizeRestoreJbt.setPreferredSize(new Dimension(25, 25));
			maximizeRestoreJbt.addMouseListener(
				new MouseAdapter() {
					public void mouseReleased(MouseEvent e) {
						if (rootFrm.getExtendedState() == Frame.MAXIMIZED_BOTH) {
							rootFrm.setExtendedState(Frame.NORMAL);
						}
						else {
							rootFrm.setExtendedState(Frame.MAXIMIZED_BOTH);
						}
					}
				}
			);
			this.add(maximizeRestoreJbt, JsTitleBarLayout.MAXIMIZE_RESTORE);
		}
		else if (buttonInt == CLOSE_BUTTON) {
			JButton closeJbt = new JButton();
			closeJbt.setIcon(UIManager.getIcon("InternalFrame.closeIcon"));
			closeJbt.setToolTipText(UIManager.getString("InternalFrameTitlePane.closeButtonText"));
			closeJbt.setPreferredSize(new Dimension(25, 25));
			closeJbt.addMouseListener(
				new MouseAdapter() {
					public void mouseReleased(MouseEvent e) {
						rootFrm.dispose();
					}
				}
			);
			this.add(closeJbt, JsTitleBarLayout.CLOSE);
		}
		else {
			throw new IllegalArgumentException("Invalid buttonInt.");
		}
	}
	
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品久久久久久久99樱桃| 久久久99精品免费观看不卡| 亚洲自拍偷拍综合| 日本精品一区二区三区四区的功能| 一色桃子久久精品亚洲| 99天天综合性| 亚洲黄色片在线观看| 欧美在线免费视屏| 免费成人美女在线观看.| 精品国产91洋老外米糕| 国产激情一区二区三区四区| 国产精品国产三级国产aⅴ原创 | 韩国视频一区二区| 精品久久久久久久人人人人传媒| 国产精品中文字幕一区二区三区| 亚洲国产精品黑人久久久| 日本韩国精品一区二区在线观看| 亚洲第一久久影院| 26uuu亚洲| 91免费国产在线| 日本网站在线观看一区二区三区| 精品国产三级电影在线观看| 97se亚洲国产综合自在线观| 天天色天天操综合| 欧美国产综合色视频| 欧美中文字幕一区二区三区| 久久超碰97人人做人人爱| 国产精品乱码妇女bbbb| 欧美日韩免费观看一区三区| 国产一区激情在线| 一级精品视频在线观看宜春院| 91精品国产免费| 91在线观看美女| 久久黄色级2电影| 夜夜精品视频一区二区| 精品国产网站在线观看| 欧美综合在线视频| 国产成人精品一区二| 视频一区在线视频| 中文字幕一区在线| 日韩精品一区二区三区中文精品| 91免费观看视频在线| 国产精品亚洲一区二区三区在线| 亚洲综合一二三区| 亚洲国产高清aⅴ视频| 欧美挠脚心视频网站| av电影天堂一区二区在线| 日本不卡不码高清免费观看| 亚洲欧美另类综合偷拍| 久久久蜜桃精品| 日韩视频在线观看一区二区| 色视频成人在线观看免| 国产精品亚洲视频| 久久99深爱久久99精品| 亚洲福利一区二区三区| 亚洲免费在线视频| 国产天堂亚洲国产碰碰| 精品欧美久久久| 欧美群妇大交群中文字幕| 99re视频精品| 成人国产精品免费| 国产原创一区二区三区| 日本成人在线网站| 亚洲bt欧美bt精品777| 亚洲一二三四区不卡| 亚洲色欲色欲www| 一区在线观看视频| 综合分类小说区另类春色亚洲小说欧美| 精品欧美一区二区久久 | aaa欧美日韩| 国产精一区二区三区| 极品销魂美女一区二区三区| 视频一区二区三区在线| 亚洲国产cao| 偷拍与自拍一区| 日日骚欧美日韩| 亚洲大片精品永久免费| 亚洲成人免费观看| 天使萌一区二区三区免费观看| 日韩中文字幕亚洲一区二区va在线| 亚洲久草在线视频| 亚洲欧美二区三区| 亚洲综合精品自拍| 亚洲成av人片在线观看无码| 亚洲电影中文字幕在线观看| 天天综合色天天综合| 人人精品人人爱| 久久超级碰视频| 国产精品91一区二区| 成人一区在线观看| 91蝌蚪porny九色| 欧美在线高清视频| 日韩欧美中文字幕精品| 久久夜色精品国产欧美乱极品| 精品国内二区三区| 国产精品国产成人国产三级| 亚洲精品免费在线观看| 日韩国产一二三区| 国内外精品视频| 成人美女在线观看| 欧美视频精品在线观看| 欧美xxxx在线观看| 国产精品久久二区二区| 亚洲综合久久久久| 精品一区二区三区在线观看| 国产成人免费在线观看不卡| 91农村精品一区二区在线| 欧美日韩精品二区第二页| 精品福利视频一区二区三区| 中文字幕成人在线观看| 亚洲v日本v欧美v久久精品| 久久99国产精品久久99果冻传媒| 国产99久久久精品| 在线区一区二视频| 久久综合精品国产一区二区三区 | 亚洲国产精品成人久久综合一区| 亚洲日本乱码在线观看| 美女性感视频久久| 色综合天天综合网天天看片| 3751色影院一区二区三区| 国产精品久久久久久久久久久免费看 | 蜜臀av国产精品久久久久| 成人av网站在线| 日韩一区二区在线看片| 国产精品美日韩| 日本不卡中文字幕| 99re热视频这里只精品| 亚洲精品一区二区三区蜜桃下载 | eeuss鲁片一区二区三区在线观看| 欧美午夜精品电影| 国产欧美日韩中文久久| 免费看日韩a级影片| 色综合天天综合狠狠| 精品区一区二区| 日韩精品欧美精品| 色94色欧美sute亚洲线路二 | 日韩欧美不卡在线观看视频| 一区二区三区国产精华| 国产精品一卡二| 91麻豆精品91久久久久同性| 中文字幕永久在线不卡| 国产精品一区二区x88av| 日韩视频免费观看高清完整版| 亚洲视频一区二区在线观看| 国产成人综合网站| 精品少妇一区二区| 蜜臀av性久久久久av蜜臀妖精 | eeuss鲁片一区二区三区在线观看| 91精品国产色综合久久不卡蜜臀 | 在线一区二区观看| 国产精品久久久久aaaa| 国产麻豆午夜三级精品| 日韩欧美aaaaaa| 美腿丝袜在线亚洲一区| 884aa四虎影成人精品一区| 亚洲午夜精品在线| 一本大道久久a久久综合婷婷 | 亚洲午夜一区二区| 91丨九色丨蝌蚪丨老版| 欧美高清在线视频| 国产福利精品一区| 欧美国产视频在线| 国产很黄免费观看久久| 国产亚洲短视频| 国产九色精品成人porny| 久久精品一区二区三区不卡| 美女视频黄 久久| 日韩三级免费观看| 欧美a一区二区| 日韩欧美亚洲国产另类| 久久se精品一区精品二区| 精品国产伦理网| 国产美女在线精品| 亚洲国产成人自拍| 不卡区在线中文字幕| 亚洲人成小说网站色在线| 97超碰欧美中文字幕| 亚洲一区二区av在线| 91精品国产福利| 激情伊人五月天久久综合| 久久久精品人体av艺术| 99热这里都是精品| 亚洲午夜久久久久久久久久久| 欧美精品在线一区二区三区| 男人的天堂久久精品| 久久亚洲一区二区三区明星换脸| 国产一区二区三区四区五区入口| 国产日产精品1区| 色婷婷亚洲精品| 五月婷婷综合网| 欧美大尺度电影在线| 丁香婷婷综合网| 亚洲激情图片一区| 日韩欧美黄色影院| 成人免费av资源| 亚洲成人黄色影院| 久久综合给合久久狠狠狠97色69| 国产激情视频一区二区三区欧美| 日韩理论在线观看| 欧美久久久久久久久中文字幕|