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

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

?? officexpmenuitemui.java

?? java lookandfeel office pack
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* ====================================================================
 * 
 * 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.*;
import java.awt.event.KeyEvent;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.ButtonModel;
import javax.swing.*;
import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;

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


/**
 * UI for menu items using the OfficeXP Look and Feel.
 *
 * @author Robert Futrell
 * @version 1.0
 */
public class OfficeXPMenuItemUI extends WindowsMenuItemUI {

	static final int MENU_ITEM_HEIGHT	= 23;

	static final String MAX_TEXT_WIDTH =  "maxTextWidth";
	static final String MAX_ACC_WIDTH  =  "maxAccWidth";

	// These rects are used for painting and preferredsize calculations.
	// They used to be regenerated constantly.  Now they are reused.
	protected static final Rectangle zeroRect = new Rectangle(0,0,0,0);
	protected static Rectangle iconRect = new Rectangle();
	protected static Rectangle textRect = new Rectangle();
	protected static Rectangle acceleratorRect = new Rectangle();
	protected static Rectangle viewRect = new Rectangle(Short.MAX_VALUE, Short.MAX_VALUE);
	protected static Rectangle r = new Rectangle();


	protected MouseInputListener createMouseInputListener(JComponent c) {
		return new RMouseInputHandler();
	}


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


    protected Dimension getPreferredMenuItemSize(JComponent c,
                                                     Icon checkIcon,
                                                     Icon arrowIcon,
                                                     int defaultTextIconGap) {
		JMenuItem b = (JMenuItem) c;
		Icon icon = (Icon) b.getIcon();
		String text = b.getText();
		KeyStroke accelerator =  b.getAccelerator();
		String acceleratorText = "";

		if (accelerator != null) {
			int modifiers = accelerator.getModifiers();
			if (modifiers > 0) {
				acceleratorText = KeyEvent.getKeyModifiersText(modifiers);
				acceleratorText += "+";
			}
			int keyCode = accelerator.getKeyCode();
			if (keyCode != 0) {
				acceleratorText += KeyEvent.getKeyText(keyCode);
			}
			else {
				acceleratorText += accelerator.getKeyChar();
			}
		}

		Font font = b.getFont();
		FontMetrics fm = c.getFontMetrics(font);

		resetRects();

		layoutMenuItem(
				fm, text, acceleratorText, icon, checkIcon, arrowIcon,
				viewRect, iconRect, textRect, acceleratorRect,
				text == null ? 0 : defaultTextIconGap,
				defaultTextIconGap
				);

		// Find the union of the icon and text rects.
		r.setBounds(textRect);
		r = SwingUtilities.computeUnion(iconRect.x, iconRect.y,
								iconRect.width, iconRect.height, r);

		// To make the text and accelerators of each menu item in a menu
		// align, we'll check the width of each for this menu item, and if
		// either value is greater than the parent menu's cached current
		// greatest value, it is updated.  Since all menu items do this
		// (even child JMenus, but they do it in OfficeXPMenuUI), the
		// parent menu will have the proper values.

		// We need a JComponent-derived parent in order to store the
		// width properties.
		Container parent = menuItem.getParent();
		if (parent != null && parent instanceof JComponent) {

			JComponent p = (JComponent) parent;

			// Get widest values so far from parent, or null if none yet.
			Integer maxTextWidth = (Integer) p.getClientProperty(MAX_TEXT_WIDTH);
			Integer maxAccWidth = (Integer) p.getClientProperty(MAX_ACC_WIDTH);
			int maxTextValue = maxTextWidth!=null ? maxTextWidth.intValue() : 0;
			int maxAccValue = maxAccWidth!=null ? maxAccWidth.intValue() : 0;

			//Compare the text widths, and adjust the r.width to the widest.
			if (r.width < maxTextValue) {
				r.width = maxTextValue;
			}
			else {
				p.putClientProperty(MAX_TEXT_WIDTH, new Integer(r.width) );
			}

			// Compare the accelarator widths.
			if (acceleratorRect.width > maxAccValue) {
				maxAccValue = acceleratorRect.width;
				p.putClientProperty(MAX_ACC_WIDTH, new Integer(acceleratorRect.width) );
			}

			// Add on the widest accelerator.
			r.width += maxAccValue;
			r.width += defaultTextIconGap;

		}

		// Add in the checkIcon
		r.width += 20;//checkIconRect.width;
		r.width += defaultTextIconGap;

		// Add in the arrowIcon
		r.width += defaultTextIconGap;
		r.width += 12;//arrowIconRect.width;

		// Add in the "padding" on either side of the menu item.
		r.width += 2*defaultTextIconGap;

		Insets insets = b.getInsets();
		if(insets != null) {
			r.width += insets.left + insets.right;
			r.height += insets.top + insets.bottom;
		}

		// if the width is even, bump it up one. This is critical
		// for the focus dash line to draw properly
		if(r.width%2 == 0) {
			r.width++;
		}

		// if the height is even, bump it up one. This is critical
		// for the text to center properly
		if(r.height%2 == 0) {
			r.height++;
		}

		return new Dimension((int)r.getWidth(), MENU_ITEM_HEIGHT);

	}


   /**
     * Compute and return the location of the icons origin, the
     * location of origin of the text baseline, and a possibly clipped
     * version of the compound labels string.  Locations are computed
     * relative to the viewR rectangle.
     */
    public static String layoutCompoundLabel(JComponent c, FontMetrics fm,
    									String text, Rectangle viewR,
    									Rectangle iconR, Rectangle textR) {

		boolean ltr = true;
		if (c!=null) ltr = c.getComponentOrientation().isLeftToRight();
		int hAlign = ltr ? SwingConstants.RIGHT : SwingConstants.LEFT;
		int hTextPos = ltr ? SwingConstants.LEFT : SwingConstants.RIGHT;

		// Note that iconR won't matter if an icon doesn't exist, so it
		// doesn't matter that it's in the same (x,y) location as the text.
		iconR.width  = 20;
		iconR.height = 20;
		if (hTextPos==SwingConstants.LEFT) {
			iconR.x = 4;
		}
		else {
			iconR.x = viewR.x+viewR.width-20-1;
		}
		iconR.y = viewR.y + (viewR.height/2) - 7; //(iconR.height/2);

		// Initialize the text bounds rectangle textR.  If a null
		// or and empty String was specified we substitute "" here
		// and use 0,0,0,0 for textR.
		boolean textIsEmpty = (text == null) || text.equals("");
		if (textIsEmpty) {
			textR.width = textR.height = 0;
			text = "";
		}
		else {

			textR.width = SwingUtilities.computeStringWidth(fm,text);
			textR.height = fm.getHeight();

            /* If the label text string is too wide to fit within the available
             * space, "..." and as many characters as will fit will be
             * displayed instead.
             */
            int availTextWidth = viewR.width - 32;

            if (textR.width > availTextWidth) {
			    String clipString = "...";
			    int totalWidth = SwingUtilities.computeStringWidth(fm,clipString);
			    int nChars;
			    for(nChars = 0; nChars < text.length(); nChars++) {
					totalWidth += fm.charWidth(text.charAt(nChars));
					if (totalWidth > availTextWidth)
					    break;
			    }
			    text = text.substring(0, nChars) + clipString;
			    textR.width = SwingUtilities.computeStringWidth(fm,text);
            }

		}

		// If this is a top-level menu, there will be no icon.
		if ((c instanceof JMenu) && ((JMenu)c).isTopLevelMenu()) {
			int nonShadowWidth = viewR.width - 4;
			textR.x = viewR.x + nonShadowWidth/2 - textR.width/2;	// Text will be centered.
		}
		else
			// Text will be placed after the icon/check/whatever if it's not
			// a top-level menu item.
			if (hTextPos==SwingConstants.LEFT) {
				textR.x = 32;
			}
			else { // SwingConstants.RIGHT
				Integer i = (Integer)c.getClientProperty(MAX_ACC_WIDTH);
				int maxAccWidth = i==null ? 0 : i.intValue();
				textR.x = viewR.x+viewR.width -(32 + /*defaultTextIconGap*/5 + textR.width);
			}

		// Must compute text's y-coordinate after textR.height has been computed.
		textR.y = viewR.y + (viewR.height/2) - (textR.height/2);

        return text;

    }


	/**
	 * Compute and return the location of the icons origin, the
	 * location of origin of the text baseline, and a possibly clipped
	 * version of the compound labels string.  Locations are computed
	 * relative to the viewRect rectangle.
	 */
	protected String layoutMenuItem(FontMetrics fm, String text,
				String acceleratorText, Icon icon, Icon checkIcon,
				Icon arrowIcon, Rectangle viewRect, Rectangle iconRect,
				Rectangle textRect, Rectangle acceleratorRect,
				int textIconGap, int menuItemGap) {

		// Lay out the text and icon rectangles.
		layoutCompoundLabel(menuItem, fm, text, viewRect, iconRect, textRect);

		// Give dimensions to the accelerator text rectangle if the text is
		// actually something.
		if (!acceleratorText.equals("")) {
			acceleratorRect.width = SwingUtilities.computeStringWidth( fm, acceleratorText );
			acceleratorRect.height = fm.getHeight();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
97久久超碰国产精品| 亚洲欧美乱综合| 高清不卡一二三区| 国产精品久久毛片av大全日韩| 欧美日韩在线亚洲一区蜜芽| 日韩黄色在线观看| 久久久蜜桃精品| 色综合天天在线| 日日噜噜夜夜狠狠视频欧美人| 日韩你懂的在线播放| 久久精品av麻豆的观看方式| 欧美日韩电影在线播放| 国产一区二区影院| 一区二区三区资源| 久久综合九色综合欧美就去吻| 国产成人精品一区二| 亚洲小说欧美激情另类| 精品国产乱码久久久久久夜甘婷婷 | 精品综合久久久久久8888| 日本一区二区三区四区| 欧美日韩国产美| 国产在线乱码一区二区三区| 欧美国产欧美亚州国产日韩mv天天看完整| 欧美女孩性生活视频| 99国产精品视频免费观看| 韩国女主播一区| 日日夜夜免费精品视频| 国产不卡在线视频| 同产精品九九九| 综合分类小说区另类春色亚洲小说欧美| 欧美一区二区三区色| 91黄色激情网站| caoporn国产精品| 激情综合色综合久久| 亚洲制服丝袜一区| 亚洲人123区| 欧美国产综合一区二区| 欧美一区二区二区| 欧美日韩久久一区| 欧美日韩二区三区| 91精品国产综合久久福利软件| 午夜电影网亚洲视频| 1024成人网色www| 日韩毛片精品高清免费| 亚洲同性gay激情无套| 国产精品久久久久永久免费观看 | 免费观看91视频大全| 欧美亚洲国产bt| 亚洲成人自拍一区| 欧美丰满美乳xxx高潮www| 五月婷婷色综合| 91精品国产综合久久香蕉麻豆| 日本亚洲一区二区| 4438x成人网最大色成网站| 石原莉奈在线亚洲二区| 国产精品不卡在线| 久久久久久久久久久久久久久99 | 亚洲色图第一区| 亚洲va中文字幕| 九色|91porny| 91在线视频18| 91福利区一区二区三区| 欧美人与禽zozo性伦| 亚洲一线二线三线视频| 一区二区三区中文字幕| 性做久久久久久免费观看欧美| 欧美aⅴ一区二区三区视频| 久久99精品久久久久久| 粉嫩蜜臀av国产精品网站| av动漫一区二区| 中文乱码免费一区二区| 久久精品99国产精品日本| 亚洲婷婷综合久久一本伊一区| 性欧美大战久久久久久久久| 国产毛片一区二区| 一本色道久久综合亚洲精品按摩| 欧美成人a视频| 亚洲免费观看视频| 国产一区二区三区四| 色综合网色综合| 日韩精品中午字幕| 欧美激情综合五月色丁香小说| 亚洲成精国产精品女| 国产精品自拍毛片| 欧美日韩第一区日日骚| 亚洲品质自拍视频网站| 极品美女销魂一区二区三区免费| 在线观看91视频| 国产精品拍天天在线| 久久99精品久久久久婷婷| 在线视频一区二区三区| 26uuu国产日韩综合| 亚洲一区欧美一区| 成人伦理片在线| 国产激情91久久精品导航| 欧美一区午夜视频在线观看| 午夜视频一区在线观看| 91麻豆国产香蕉久久精品| 久久网这里都是精品| 亚洲成a天堂v人片| 欧美亚洲愉拍一区二区| 亚洲天堂精品在线观看| 日韩午夜精品视频| 国产不卡一区视频| 国产片一区二区| 国产综合久久久久影院| 欧美成人一区二区三区片免费| 亚洲女厕所小便bbb| 不卡一区二区三区四区| 国产精品麻豆欧美日韩ww| av在线不卡免费看| 欧美激情一区二区| 成人短视频下载| 久久久久久久综合色一本| 国产在线精品视频| 久久精品亚洲精品国产欧美| 国产成人精品在线看| 中文字幕精品一区| 91蝌蚪porny九色| 亚洲综合色视频| 色婷婷综合久久久久中文 | 另类小说色综合网站| 91精品国产入口| 国产一区不卡在线| 久久久美女毛片| 成人免费观看av| 亚洲成av人**亚洲成av**| 欧美日产在线观看| 成人一区二区三区在线观看| 久久人人爽人人爽| 91在线一区二区| 亚洲一区二区黄色| 337p亚洲精品色噜噜狠狠| 国产成人精品影视| 国产精品乱人伦中文| 欧美日韩中文精品| 久久超碰97人人做人人爱| 欧美国产1区2区| 色综合婷婷久久| 粉嫩嫩av羞羞动漫久久久| 亚洲精品国产a| 欧美成人a∨高清免费观看| 成人午夜免费av| 免费观看一级特黄欧美大片| 亚洲国产精品99久久久久久久久| 欧美性生活一区| 激情五月婷婷综合网| 日韩高清不卡在线| 欧美激情一区二区在线| 久久亚洲一区二区三区明星换脸| 久久久亚洲精品一区二区三区| 欧美在线观看视频一区二区 | 国产精品美女久久久久久久| 91精品国产全国免费观看| av不卡一区二区三区| 国产美女视频91| 日韩av午夜在线观看| 夜夜亚洲天天久久| 一区二区三区中文字幕精品精品| 久久男人中文字幕资源站| 欧美日韩在线直播| 欧美亚洲一区二区在线| 日本精品一区二区三区高清 | 麻豆91精品视频| 日本欧美久久久久免费播放网| 日韩理论在线观看| 欧美绝品在线观看成人午夜影视| 国产精品综合一区二区三区| 久国产精品韩国三级视频| 一区二区三区在线视频免费| 亚洲天堂av一区| 国产精品三级在线观看| 日韩三级av在线播放| 91精品一区二区三区在线观看| 国产成人av电影在线| 亚洲国产一区二区视频| 首页国产丝袜综合| 麻豆精品一区二区| 亚洲欧美日韩国产综合在线| 一色桃子久久精品亚洲| 综合亚洲深深色噜噜狠狠网站| 欧美人狂配大交3d怪物一区| 亚洲日本护士毛茸茸| 国产精品麻豆视频| 久久一留热品黄| 欧美三级日韩在线| 国产很黄免费观看久久| 亚洲成a人片综合在线| 久久精品在这里| 3d动漫精品啪啪一区二区竹菊| 成人免费高清在线| 国产高清在线观看免费不卡| 亚洲制服欧美中文字幕中文字幕| 日韩美女主播在线视频一区二区三区| 成人蜜臀av电影| 久久精品国产精品青草| 亚洲免费高清视频在线| 欧美国产精品v| 亚洲一区二区欧美| 国产在线观看一区二区|