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

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

?? officexpbuttonui.java

?? JAVA swing 的office xp 和 office2003 風格。
?? JAVA
字號:
/* ====================================================================
 * 
 * Office Look and Feels License
 * http://sourceforge.net/projects/officelnfs
 *
 * Copyright (c) 2003-2005 Robert Futrell.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The names "Office Look And Feels" and "OfficeLnFs" must not
 *    be used to endorse or promote products derived from this software
 *    without prior written permission. For written permission, please
 *    contact robert_futrell@users.sourceforge.net.
 *
 * 4. Products derived from this software may not be called "OfficeLnFs"
 *    nor may "OfficeLnFs" appear in their names without prior written
 *    permission.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 */ 
package org.fife.plaf.OfficeXP;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import javax.swing.plaf.ComponentUI;
import javax.swing.*;
import javax.swing.event.MouseInputAdapter;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;

import com.sun.java.swing.plaf.windows.WindowsButtonUI;


/**
 * Extension of <code>WindowsButtonUI</code> that paints toolbar buttons like
 * they are painted in Microsoft Office XP applications.
 *
 * @author Robert Futrell
 * @version 1.0
 */
public class OfficeXPButtonUI extends WindowsButtonUI {

	private static MouseInputHandler mouseInputHandler;

	private boolean isMouseOver = false;

	private Rectangle viewRect = new Rectangle();
	private Rectangle iconRect = new Rectangle();
	private Rectangle textRect = new Rectangle();

	/**
	 * This is the width and height of toolbar buttons in Office XP
	 * applications that are only an icon, no text (which is almost all of
	 * them).
	 */
	private static final int PREFERRED_TOOLBAR_BUTTON_SIZE	= 23;


    public static ComponentUI createUI(JComponent c){
		return new OfficeXPButtonUI();
    }


	protected synchronized MouseInputHandler getMouseInputHandler() {
		if (mouseInputHandler==null)
			mouseInputHandler = new MouseInputHandler();
		return mouseInputHandler;
	}


	public Dimension getPreferredSize(JComponent c) {
		Component parent = c.getParent();
		if (parent!=null && (parent instanceof JToolBar)) {
			Dimension preferredSize = super.getPreferredSize(c);
			if (preferredSize.width<PREFERRED_TOOLBAR_BUTTON_SIZE)
				preferredSize.width = PREFERRED_TOOLBAR_BUTTON_SIZE;
			if (preferredSize.height<PREFERRED_TOOLBAR_BUTTON_SIZE)
				preferredSize.height = PREFERRED_TOOLBAR_BUTTON_SIZE;
			return preferredSize;
		}
		return super.getPreferredSize(c);
	}

		
	public void installListeners(AbstractButton b) {
		super.installListeners(b);
		mouseInputHandler = getMouseInputHandler();
		b.addMouseListener(mouseInputHandler);
	}


	protected boolean isMouseOver() {
		return isMouseOver;
	}


	public void paint(Graphics g, JComponent c) {
		AbstractButton button = (AbstractButton)c;
		if (button.getParent() instanceof JToolBar) {
			paintToolbarButton(g, button);
		}
		else {
			super.paint(g, c);
		}
	}


	/**
	 * Paints the background for an armed toolbar button.
	 *
	 * @param g The graphics context.
	 * @param width The width of the button.
	 * @param height The height of the button.
	 */
	static void paintArmedToolbarButtonBackground(Graphics g,
										int width, int height) {
		g.setColor(UIManager.getColor("OfficeLnF.HighlightBorderColor"));
		g.drawRect(0,0, width,height);
		g.setColor(UIManager.getColor("OfficeXPLnF.PressedHighlightColor"));
		g.fillRect(1,1, width-1,height-1);
	}


	/**
	 * Paints the background for a toolbar button with the mouse hovering
	 * over it.
	 *
	 * @param g The graphics context.
	 * @param width The width of the button.
	 * @param height The height of the button.
	 */
	static void paintMouseOverToolbarButtonBackground(Graphics g,
											int width, int height) {
		g.setColor(UIManager.getColor("OfficeLnF.HighlightBorderColor"));
		g.drawRect(0,0, width,height);
		g.setColor(UIManager.getColor("OfficeLnF.HighlightColor"));
		g.fillRect(1,1, width-1,height-1);
	}


	public void paintToolbarButton(Graphics g, JComponent c) {

		// Paint the button's background.
		paintToolbarButtonBackground(g,c);

		// Get the bounds for the text and icon.
		AbstractButton b = (AbstractButton) c;
		Icon icon = b.getIcon();
		String text = b.getText();
		FontMetrics fm = c.getFontMetrics(g.getFont());
		Insets i = c.getInsets();
		viewRect.x = i.left;
		viewRect.y = i.top;
		viewRect.width = b.getWidth() - (i.right + viewRect.x);
		viewRect.height = b.getHeight() - (i.bottom + viewRect.y);
		textRect.x = textRect.y = textRect.width = textRect.height = 0;
		iconRect.x = iconRect.y = iconRect.width = iconRect.height = 0;
		text = SwingUtilities.layoutCompoundLabel(
			c, fm, text, icon,
			b.getVerticalAlignment(), b.getHorizontalAlignment(),
			b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
			viewRect, iconRect, textRect, 
			text==null ? 0 : b.getIconTextGap());

		// Actually paint the text and icon.
		if (text!=null && !text.equals("")) {
			View v = (View) c.getClientProperty(BasicHTML.propertyKey);
			if (v != null)
				v.paint(g, textRect);
			else
				paintText(g, c, textRect, text);
		}
		paintToolbarButtonIcon(g,c, iconRect);

	}


	protected void paintToolbarButtonBackground(Graphics g, JComponent c) {

		AbstractButton button = (AbstractButton)c;
		ButtonModel model = button.getModel();

		int width = button.getWidth() - 1;
		int height = button.getHeight() - 1;

		// Before you try to "optimize" the below, remember this:
		// model.isEnabled() returns whether the button is enabled.
		// model.isArmed() returns true ONLY IF both the button is depressed
		//                 (model.isPressed()) and the mouse is over the
		//                 button.
		// isMouseOver() returns true ONLY IF the mouse is over the button AND
		//               this button is the one over which the mouse was
		//               originally depressed.  (This is equivalent to
		//               model.isRollover() in Sun's JRE 1.5, but not 1.4).
		// model.isPressed() returns true if the user has down-clicked on the
		//               button and not yet released the mouse button.
		// model.isSelected() returns true if the button is "pressed."  I
		//               THINK that for regular JButtons, this is equivalent
		//               to model.isPressed(), but for JToggleButtons, this
		//               is whether or not the button is currently in its
		//               down position (i.e., the user may have clicked and
		//               released the mouse button already).
		// model.isRollover() returns true if the mouse is over the button.
		//               Note that the behavior for this changes between Sun's
		//               1.4 and 1.5 Windows JREs...

		// This case is when the button isn't even enabled.
		if (!model.isEnabled()) {
			// Do nothing.
		}

		// This case is when the user has down-clicked, and the mouse is
		// still over the button.
		else if (model.isArmed()) {
			OfficeXPButtonUI.paintArmedToolbarButtonBackground(g,
												width, height);
		}

		// This case is when the mouse is hovering over the button, or
		// they've left-clicked, but moved the mouse off the button.
		else if (isMouseOver() || model.isPressed()) {
			OfficeXPButtonUI.paintMouseOverToolbarButtonBackground(g,
												width, height);
		}

		// This case is when the user hasn't clicked on the button, nor is
		// the mouse over it.
		else {
			// Do nothing.
		}

	}


	/**
	 * Paints the icon for the specified button.
	 *
	 * @param g The graphics context.
	 * @param c The button.
	 * @param iconRect The area in which to paint the icon.
	 */
	protected void paintToolbarButtonIcon(Graphics g, JComponent c,
									Rectangle iconRect) {

		// NOTE:  This method is NOT the same as OfficeXPToggleButtonUI's
		// paintToolbarToggleButtonIcon() so we cannot factor it out!

		AbstractButton b = (AbstractButton) c;
		ButtonModel model = b.getModel();
		Icon icon;

		if (!model.isEnabled()) {
			OfficeXPUtilities.paintDisabledButtonIcon(g, b, iconRect);
		}
		else if (model.isArmed()) {
			icon = (Icon)b.getIcon();
			if (icon!=null)
				icon.paintIcon(c,g, iconRect.x, iconRect.y);
		}
		else if (isMouseOver() || model.isPressed()) {
			icon = (Icon)b.getDisabledIcon();
			// Necessary as some icons (like JInternalFrame's) don't have
			// disabled icons.
			if (icon!=null) {
				icon.paintIcon(c,g, iconRect.x+1, iconRect.y+1);
				icon = (Icon)b.getIcon();
				// Not sure why we'd have a disabled icon but not a regular
				// one, but better safe than sorry...
				if (icon!=null)
					icon.paintIcon(c,g, iconRect.x-1, iconRect.y-1);
			}
			else {
				icon = b.getIcon();
				if (icon!=null)
					icon.paintIcon(c,g, iconRect.x, iconRect.y);
			}
		}
		else {
			icon = (Icon)b.getIcon();
			if (icon!=null)
				icon.paintIcon(c,g, iconRect.x, iconRect.y);
		}

    }


    protected void setMouseOver(boolean over) {
		isMouseOver = over;
	}


	public void uninstallListeners(AbstractButton b) {
		b.removeMouseListener(mouseInputHandler);
		super.installListeners(b);
	}


	/**
	 * Listens for mouse events in all Office XP buttons, although it's only
	 * really interested in toolbar buttons (FIXME:  It'd be nice to be able
	 * to just check the buttons' parents to see whether they're instances
	 * of <code>JToolBar</code> to add this listener, but then we'd
	 * need to add hierarchy listeners or something similar to each button
	 * in case they add/remove it during runtime, which would be even
	 * more overhead...).  It's here so that we can have a toolbar button
	 * display the "rollover" effect only if no other toolbar button is
	 * depressed.  For example, if you mouse click on one button, but before
	 * you release it, you move the mouse over other buttons.  The other
	 * buttons will have their <code>model.isRollover()</code> method return
	 * <code>true</code>, which will result in us having two buttons
	 * highlighted at the same time, which isn't what we want.<p>
	 *
	 * Note that in Sun's JRE 1.5, it appears that the above scenario is
	 * "fixed;" that is, we don't need this mouse input handler.  In 1.5,
	 * clicking on a button and moving the mouse over other buttons before
	 * releasing the mouse button does NOT make the "other buttons" have their
	 * <code>model.isRollover()</code> method return <code>true</code>.  But,
	 * since we're remaining backwards-compatible with 1.4, we're keeping this
	 * here.
	 */
	protected static class MouseInputHandler extends MouseInputAdapter {

		/**
		 * Flag for whether some toolbar button is depressed.  This is to
		 * prevent the "rollover" property from making two toolbar buttons
		 * appear highlighted at the same time.
		 */
		private boolean someButtonDepressed;

		public MouseInputHandler() {
		}

		public void mousePressed(MouseEvent e) {
			someButtonDepressed = true;
		}

		public void mouseReleased(MouseEvent e) {
			someButtonDepressed = false;
		}

		public void mouseEntered(MouseEvent e) {
			if (!someButtonDepressed) {
				AbstractButton b = (AbstractButton)e.getSource();
				OfficeXPButtonUI ui = (OfficeXPButtonUI)b.getUI();
				ui.setMouseOver(true);
			}
		}

		public void mouseExited(MouseEvent e) {
			AbstractButton b = (AbstractButton)e.getSource();
			OfficeXPButtonUI ui = (OfficeXPButtonUI)b.getUI();
			ui.setMouseOver(false);
		}

	}


}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆一区二区在线| 国产成人丝袜美腿| 国产精品综合网| 欧美私模裸体表演在线观看| 精品国产乱码久久久久久蜜臀| 1024成人网| 国产精品自在欧美一区| 欧美一区在线视频| 亚洲视频一区二区在线| 国产一区二区免费视频| 欧美日韩一区二区三区免费看| 欧美国产一区视频在线观看| 日本成人在线网站| 欧洲精品中文字幕| |精品福利一区二区三区| 国产一二精品视频| 精品捆绑美女sm三区| 亚洲成人自拍偷拍| 在线区一区二视频| 亚洲欧洲美洲综合色网| 国产成人午夜视频| 久久在线观看免费| 免费观看成人av| 制服丝袜亚洲播放| 亚洲综合清纯丝袜自拍| 色综合av在线| 亚洲丝袜美腿综合| 91视频com| 综合激情网...| 色婷婷亚洲精品| 亚洲精品乱码久久久久久黑人 | 久久成人av少妇免费| 欧美在线小视频| 亚洲视频一区在线观看| 色婷婷亚洲综合| 一区二区三区在线免费视频 | 欧美日韩成人在线一区| 亚洲一区av在线| 欧美性淫爽ww久久久久无| 亚洲一区二区三区四区五区黄| 成人黄色av电影| 欧美日韩国产高清一区二区三区| 国产精品资源网| 国产欧美精品区一区二区三区| 国产毛片精品国产一区二区三区| 久久久精品一品道一区| 国产jizzjizz一区二区| 亚洲欧美综合在线精品| 91老司机福利 在线| 亚洲精品国产a| 在线成人午夜影院| 韩国欧美国产一区| 日本一区二区视频在线| 91麻豆国产精品久久| 亚洲高清三级视频| 日韩欧美在线观看一区二区三区| 韩国v欧美v日本v亚洲v| 中日韩免费视频中文字幕| 91香蕉视频污| 免费在线观看日韩欧美| 日本一区二区视频在线| 91蜜桃在线免费视频| 婷婷久久综合九色综合绿巨人 | 91欧美一区二区| 亚洲国产cao| 精品国产一区二区在线观看| 成人免费精品视频| 亚洲va欧美va人人爽| 26uuu欧美日本| 色综合久久88色综合天天6| 美女一区二区视频| 中文字幕一区二区在线观看| 欧美男生操女生| 成人激情开心网| 五月婷婷久久丁香| 日本一区二区成人| 日韩一区二区免费视频| 粉嫩高潮美女一区二区三区| 婷婷成人激情在线网| 国产蜜臀av在线一区二区三区| 91精品1区2区| 国产成人精品免费在线| 婷婷综合五月天| 国产精品免费av| 日韩三级伦理片妻子的秘密按摩| 成人免费毛片aaaaa**| 免费高清视频精品| 一区二区视频免费在线观看| 26uuu久久天堂性欧美| 欧美性感一类影片在线播放| 成年人国产精品| 极品少妇xxxx精品少妇偷拍 | 国产精品久久久久久久岛一牛影视| 欧美日韩另类一区| 成人免费三级在线| 国产精品白丝av| 毛片不卡一区二区| 亚洲不卡av一区二区三区| 亚洲欧美一区二区三区孕妇| 久久久久久久久久电影| 日韩一区二区三区视频在线| 精品视频一区二区不卡| 91麻豆精东视频| 94-欧美-setu| 从欧美一区二区三区| 国产精品综合久久| 韩国成人在线视频| 久久精品国产精品亚洲精品| 日本午夜一区二区| 日韩在线卡一卡二| 三级在线观看一区二区| 一区二区三区中文在线| 一区二区三区在线不卡| 亚洲美女在线一区| 亚洲人成亚洲人成在线观看图片 | av电影在线观看一区| 国产成人在线看| 成人高清免费观看| 不卡影院免费观看| 91在线视频观看| 色偷偷88欧美精品久久久| 色综合色狠狠天天综合色| 91免费精品国自产拍在线不卡| 色偷偷88欧美精品久久久| 在线亚洲一区二区| 在线综合亚洲欧美在线视频| 91精品婷婷国产综合久久竹菊| 欧美精品在线观看播放| 欧美一区二区三区免费| 欧美成人猛片aaaaaaa| 欧美精品一区二区久久久| 国产日产欧美一区| 亚洲精品日韩综合观看成人91| 亚洲一区二区三区视频在线播放 | 丁香桃色午夜亚洲一区二区三区| 成人久久视频在线观看| 色婷婷av久久久久久久| 91精品黄色片免费大全| 久久色.com| 亚洲欧美日韩国产成人精品影院| 亚洲一区中文日韩| 激情六月婷婷久久| 99热在这里有精品免费| 51午夜精品国产| 国产午夜亚洲精品羞羞网站| 亚洲精品亚洲人成人网| 日本中文字幕一区二区有限公司| 久久99国产精品久久| 成人免费视频免费观看| 99麻豆久久久国产精品免费| 欧美午夜精品久久久久久孕妇| 欧美日韩久久久一区| 日韩午夜在线影院| 国产精品午夜在线| 一区二区三区久久久| 国产精品一区专区| 91免费在线播放| 欧美一级精品在线| 久久九九影视网| 亚洲精品免费在线观看| 国产露脸91国语对白| 91首页免费视频| 91精品国产欧美一区二区18 | 亚洲天堂精品在线观看| 一区二区三区免费| 国产精品一区专区| 欧美体内she精视频| 久久影视一区二区| 一区二区三区日韩| 韩国女主播一区| 欧美性色欧美a在线播放| 欧美一区二区三区播放老司机| 亚洲区小说区图片区qvod| 日韩黄色小视频| av电影天堂一区二区在线观看| 日韩你懂的在线观看| 国产精品久久久久永久免费观看| 五月天中文字幕一区二区| 国产精品中文欧美| 91精品午夜视频| 国产偷国产偷亚洲高清人白洁| 亚洲激情图片一区| 毛片不卡一区二区| 欧美一区二区三区婷婷月色| 国产精品毛片大码女人| 国产精品一区二区三区99| 欧美日韩一区二区在线观看| 欧美激情中文字幕| 国内精品国产三级国产a久久| 欧美性猛交xxxx乱大交退制版| 国产视频视频一区| 日韩不卡手机在线v区| 欧美日韩一区二区三区不卡| 国产精品初高中害羞小美女文| 麻豆国产一区二区| 日韩视频一区二区在线观看| 有码一区二区三区| 成人18视频在线播放| 欧美一区二区三区在线观看视频| 亚洲精品国产高清久久伦理二区|