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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? appletmenubar.java

?? 共有164個(gè)java源程序
?? JAVA
字號(hào):
/* * Copyright (c) 2000 David Flanagan.  All rights reserved. * This code is from the book Java Examples in a Nutshell, 2nd Edition. * It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied. * You may study, use, and modify it for any non-commercial purpose. * You may distribute it non-commercially as long as you retain this notice. * For a commercial use license, or to purchase the book (recommended), * visit http://www.davidflanagan.com/javaexamples2. */package com.davidflanagan.examples.gui;import java.awt.*;import java.awt.event.*;import java.util.Vector;public class AppletMenuBar extends Panel {    // Menubar contents    Vector labels = new Vector();    Vector menus = new Vector();    // Properties    Insets margins = new Insets(3, 10, 3, 10); // top, left, bottom, right    int spacing = 10;              // Space between menu labels    Color highlightColor;          // Rollover color for labels    // internal stuff    boolean remeasure = true;      // Whether the labels need to be remeasured    int[] widths;                          // The width of each label    int[] startPositions;                  // Where each label starts    int ascent, descent;                   // Font metrics    Dimension prefsize = new Dimension();  // How big do we want to be?    int highlightedItem = -1;              // Which item is the mouse over?    /**     * Create a new component that simulates a menubar by displaying     * the specified labels.  Whenever the user clicks the specified label,     * popup up the PopupMenu specified in the menus array.     * Elements of the menus arra may be a static PopupMenu object, or     * a PopupMenuFactory object for dynamically creating menus.     * Perhaps we'll also provide some other kind of constructor or factory     * method that reads popup menus out of a config file.     */    public AppletMenuBar() {	// We'd like these kinds of events to be delivered	enableEvents(AWTEvent.MOUSE_EVENT_MASK |		     AWTEvent.MOUSE_MOTION_EVENT_MASK);    }    /** Add a popup menu to the menubar */    public void addMenu(String label, PopupMenu menu) {	insertMenu(label, menu, -1);    }    /** Insert a popup menu into the menubar */    public void insertMenu(String label, PopupMenu menu, int index) {	if (index < 0) index += labels.size()+1;  // Position to put it at	this.add(menu);                           // Popup belongs to us	labels.insertElementAt(label, index);     // Remember the label	menus.insertElementAt(menu, index);       // Remember the menu	remeasure = true;                         // Remeasure everything	invalidate();                             // Container must relayout    }    /** Property accessor methods for margins property */    public Insets getMargins() { return (Insets) margins.clone(); }    public void setMargins(Insets margins) {	this.margins = margins;	remeasure = true;	invalidate();    }    /** Property accessor methods for spacing property */    public int getSpacing() { return spacing; }    public void setSpacing(int spacing) {	if (this.spacing != spacing) {	    this.spacing = spacing;	    remeasure = true;	    invalidate();	}    }    /** Accessor methods for highlightColor property */    public Color getHighlightColor() {	if (highlightColor == null) return getForeground();	else return highlightColor;    }    public void setHighlightColor(Color c) {	if (highlightColor != c) {	    highlightColor = c;	    repaint();	}    }    /** We override the setFont() method so we can remeasure */    public void setFont(Font f) {	super.setFont(f);	remeasure = true;	invalidate();    }    /** Override these color property setter method so we can repaint */    public void setForeground(Color c) {	super.setForeground(c);	repaint();    }    public void setBackground(Color c) {	super.setBackground(c);	repaint();    }    /**     * This method is called to draw tell the component to redraw itself.     * If we were implementing a Swing component, we'd override      * paintComponent() instead     **/    public void paint(Graphics g) {	if (remeasure) measure();  // Remeasure everything first, if needed		// Figure out Y coordinate to draw at	Dimension size = getSize();	int baseline = size.height - margins.bottom - descent;	// Set the font to draw with	g.setFont(getFont());	// Loop through the labels	int nummenus = labels.size();	for(int i = 0; i < nummenus; i++) {	    // Set the drawing color.  Highlight the current item	    if ((i == highlightedItem) && (highlightColor != null))		g.setColor(getHighlightColor());	    else		g.setColor(getForeground());	    // Draw the menu label at the position computed in measure()	    g.drawString((String)labels.elementAt(i), 			 startPositions[i], baseline);	}	// Now draw a groove at the bottom of the menubar.	Color bg = getBackground();	g.setColor(bg.darker());	g.drawLine(0, size.height-2, size.width, size.height-2);	g.setColor(bg.brighter());	g.drawLine(0, size.height-1, size.width, size.height-1);    }    /** Called when a mouse event happens over the menubar */    protected void processMouseEvent(MouseEvent e) {	int type = e.getID();             // What type of event?	int item = findItemAt(e.getX());  // Over which menu label?	if (type == MouseEvent.MOUSE_PRESSED) {	    // If it was a mouse down event, then pop up the menu	    if (item == -1) return;	    Dimension size = getSize();	    PopupMenu pm = (PopupMenu) menus.elementAt(item);	    if (pm != null) pm.show(this, startPositions[item]-3, size.height);	}	else if (type == MouseEvent.MOUSE_EXITED) {	    // If the mouse left the menubar, then unhighlight	    if (highlightedItem != -1) {		highlightedItem = -1;		if (highlightColor != null) repaint();	    }	}	else if ((type == MouseEvent.MOUSE_MOVED) || 		 (type == MouseEvent.MOUSE_ENTERED)) {	    // If the mouse moved, change the highlighted item, if necessary	    if (item != highlightedItem) {		highlightedItem = item;		if (highlightColor != null) repaint();	    }	}    }    /** This method is called when the mouse moves */    protected void processMouseMotionEvent(MouseEvent e) {	processMouseEvent(e);    }    /** This utility method converts an X coordinate to a menu label index */    protected int findItemAt(int x) {	// This could be a more efficient search...	int nummenus = labels.size();	int halfspace = spacing/2-1;	int i;	for(i = nummenus-1; i >= 0; i--) {	    if ((x >= startPositions[i]-halfspace) && 		(x <= startPositions[i]+widths[i]+halfspace)) break;	}	return i;    }    /**     * Measure the menu labels, and figure out their positions, so we     * can determine when a click happens, and so we can redraw efficiently.     **/    protected void measure() {	// Get information about the font	FontMetrics fm = this.getFontMetrics(getFont());	// Remember the basic font size	ascent = fm.getAscent();	descent = fm.getDescent();	// Create arrays to hold the measurements and positions	int nummenus = labels.size();	widths = new int[nummenus];	startPositions = new int[nummenus];	// Measure the label strings and	// figure out the starting position of each label	int pos = margins.left;	for(int i = 0; i < nummenus; i++) {	    startPositions[i] = pos;	    String label = (String)labels.elementAt(i);	    widths[i] = fm.stringWidth(label);	    pos += widths[i] + spacing;	}	// Compute our preferred size from this data	prefsize.width = pos - spacing + margins.right;	prefsize.height = ascent + descent + margins.top + margins.bottom;	// We've don't need to be remeasured anymore.	remeasure = false;    }    /**     * These methods tell the container how big the menubar wants to be.     *      **/    public Dimension getMinimumSize() { return getPreferredSize(); }    public Dimension getPreferredSize() {	if (remeasure) measure();	return prefsize;    }    /** @deprecated Here for compatibility with Java 1.0 */    public Dimension minimumSize() { return getPreferredSize(); }    /** @deprecated Here for compatibility with Java 1.0 */    public Dimension preferredSize() { return getPreferredSize(); }    /**      * This method is called when the underlying AWT component is created.     * We can't measure ourselves (no font metrics) until this is called.     **/    public void addNotify() {	super.addNotify();	measure();    }    /** This method tells the container not to give us keyboard focus */    public boolean isFocusTraversable() { return false; }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆一区二区三区| 亚洲欧洲精品天堂一级| 亚洲激情一二三区| 国产精品18久久久久久vr| 欧美日韩国产高清一区| 中文字幕亚洲一区二区va在线| 久久国产精品99久久久久久老狼 | 日韩福利视频网| 成人一区二区三区中文字幕| 欧美大白屁股肥臀xxxxxx| 亚洲精品美腿丝袜| 成人h动漫精品一区二| 精品国产一区二区国模嫣然| 日本在线观看不卡视频| 欧美视频完全免费看| 亚洲视频中文字幕| 成人免费精品视频| 久久久久久麻豆| 久久激情五月婷婷| 91精品免费在线| 五月天一区二区| 欧美亚洲免费在线一区| 亚洲欧美另类久久久精品 | 婷婷久久综合九色国产成人| 色综合婷婷久久| 最近中文字幕一区二区三区| 成人在线视频一区二区| 日本一区二区三区四区| 国产很黄免费观看久久| 久久精品夜色噜噜亚洲aⅴ| 久久国产欧美日韩精品| 精品久久久久一区二区国产| 久久精品国产精品亚洲综合| 日韩精品专区在线| 看电视剧不卡顿的网站| 日韩视频免费观看高清完整版在线观看 | aaa亚洲精品| 国产精品美女一区二区| 成人黄色av网站在线| 国产精品情趣视频| 成人晚上爱看视频| 国产精品另类一区| av成人免费在线观看| 亚洲免费成人av| 欧美亚洲国产一区二区三区| 一区二区三区四区在线播放| 在线观看91视频| 亚洲国产成人va在线观看天堂| 欧美日韩一区二区在线观看| 偷偷要91色婷婷| 欧美一区二区日韩一区二区| 久久国产综合精品| 久久综合九色综合97婷婷女人 | 日本在线不卡视频一二三区| 欧美一区二区在线视频| 久久99精品久久久久久国产越南| 日韩欧美在线网站| 国产又黄又大久久| 国产偷v国产偷v亚洲高清| 成人sese在线| 伊人一区二区三区| 3d成人h动漫网站入口| 麻豆精品在线观看| 国产欧美综合色| 97精品久久久久中文字幕| 亚洲一区在线播放| 日韩视频在线观看一区二区| 国产精品亚洲第一区在线暖暖韩国| 国产精品理伦片| 在线观看欧美日本| 久久国产尿小便嘘嘘尿| 国产精品伦理一区二区| 精品视频在线视频| 九九在线精品视频| 国产精品白丝在线| 欧美老年两性高潮| 国产精品一区二区三区四区 | 日韩一区二区三区高清免费看看| 激情国产一区二区| 亚洲人吸女人奶水| 日韩午夜激情电影| 成人av网址在线| 午夜欧美电影在线观看| 久久久一区二区三区| 一本大道久久精品懂色aⅴ| 秋霞成人午夜伦在线观看| 中文字幕不卡在线观看| 欧美日韩一区二区三区高清| 国产综合一区二区| 亚洲伊人色欲综合网| 精品国产a毛片| 在线免费观看视频一区| 久久精品国产亚洲一区二区三区| 综合中文字幕亚洲| 日韩欧美中文字幕公布| 91免费在线视频观看| 麻豆成人久久精品二区三区小说| 亚洲天堂久久久久久久| 欧美成人猛片aaaaaaa| 色域天天综合网| 国产精品456| 三级久久三级久久| 亚洲日本免费电影| 欧美岛国在线观看| 欧美视频中文字幕| 国产成人亚洲精品青草天美| 日韩精品三区四区| 亚洲激情综合网| 国产日产精品一区| 日韩网站在线看片你懂的| 色综合天天综合在线视频| 国产九色精品成人porny| 亚洲成精国产精品女| 亚洲欧洲av在线| 精品va天堂亚洲国产| 欧美区在线观看| 色综合久久99| 国产成人自拍在线| 日韩激情一二三区| 亚洲资源在线观看| 中文字幕一区二区三区在线播放| 久久亚洲欧美国产精品乐播| 欧美揉bbbbb揉bbbbb| 91女神在线视频| 成人性色生活片| 国内外精品视频| 蜜桃久久精品一区二区| 亚洲成人午夜电影| 亚洲色图.com| 中文字幕一区不卡| 国产午夜精品一区二区三区视频| 日韩欧美电影在线| 欧美美女网站色| 欧美性感一类影片在线播放| 91视频精品在这里| 成人国产电影网| 国产精品夜夜嗨| 国产一区二区免费在线| 免费在线观看成人| 三级不卡在线观看| 午夜精品福利一区二区蜜股av| 一区二区成人在线| 亚洲综合久久久久| 一区二区免费视频| 亚洲女同ⅹxx女同tv| 亚洲色图20p| 亚洲人精品一区| 亚洲欧美欧美一区二区三区| 亚洲天堂网中文字| 亚洲三级在线免费| 一区二区三区久久| 奇米四色…亚洲| 亚洲成人动漫精品| 亚洲电影第三页| 亚洲成a人片在线不卡一二三区| 亚洲一区二区三区四区不卡| 樱桃国产成人精品视频| 亚洲永久免费视频| 亚洲成人自拍偷拍| 日韩国产欧美一区二区三区| 日韩精品免费专区| 六月丁香婷婷久久| 国产一区福利在线| 国产成人自拍高清视频在线免费播放| 国产精品综合在线视频| 国产成人精品免费一区二区| 成人精品一区二区三区中文字幕| 成人h精品动漫一区二区三区| aaa欧美色吧激情视频| 在线影院国内精品| 欧美美女一区二区在线观看| 日韩一区二区三区av| 精品国产sm最大网站免费看| 国产日韩欧美精品一区| 中文字幕一区二区三区蜜月| 亚洲精品国产无套在线观| 亚洲v中文字幕| 麻豆国产精品官网| 国产成人午夜99999| 91在线精品一区二区三区| 欧美视频在线观看一区| 欧美一区二区日韩| 国产亚洲精品福利| 亚洲欧美国产三级| 午夜伊人狠狠久久| 国产一区二区调教| 91在线观看一区二区| 欧美美女网站色| 久久美女艺术照精彩视频福利播放 | av一区二区三区四区| 欧美又粗又大又爽| 欧美大片日本大片免费观看| 中文欧美字幕免费| 一区二区久久久久久| 六月丁香综合在线视频| 成人开心网精品视频| 欧美性猛交xxxxxx富婆| 久久免费精品国产久精品久久久久| 国产精品不卡在线| 日韩av网站免费在线|