metacitybluecurve.java

来自「java jdk 1.4的源码」· Java 代码 · 共 1,134 行 · 第 1/3 页

JAVA
1,134
字号
			alpha="0.7"			x="(width - object_width - 1) / 2"			y="(height - object_height) / 2"			width="object_width"			height="object_height"/>	*/	Image object = getImage("menu", getColor(ENABLED, GTKColorType.FOREGROUND));	drawImage(g, object,		  getColor(ENABLED, GTKColorType.FOREGROUND),		  0.7F,		  (width - object.getWidth(null) - 1) / 2,		  (height - object.getHeight(null)) / 2);    }    private void maximize_icon(Graphics g, int width, int height) {	/*		<image filename="maximize.png"			colorize="gtk:fg[NORMAL]"			alpha="0.7"			x="(width - object_width) / 2"			y="(height - object_height) / 2"			width="object_width"			height="object_height"/>	*/	Image object = getImage("maximize", getColor(ENABLED, GTKColorType.FOREGROUND));	drawImage(g, object,		  getColor(ENABLED, GTKColorType.FOREGROUND),		  0.7F,		  (width - object.getWidth(null)) / 2,		  (height - object.getHeight(null)) / 2);    }    private void close_icon(Graphics g, int width, int height) {	/*		<image filename="close.png"			colorize="gtk:fg[NORMAL]"			alpha="0.7"			x="(width - object_width) / 2"			y="(height - object_height) / 2"			width="object_width"			height="object_height"/>	*/	Image object = getImage("close", getColor(ENABLED, GTKColorType.FOREGROUND));	drawImage(g, object,		  getColor(ENABLED, GTKColorType.FOREGROUND),		  0.7F,		  (width - object.getWidth(null)) / 2,		  (height - object.getHeight(null)) / 2);    }    private void close_button(Graphics g, int width, int height) {	/*	  <include name="right_corner_button_bg"/>	  <include name="close_icon"/>	*/	right_corner_button_bg(g, width, height);	close_icon(g, width, height);    }    private void close_button_prelight(Graphics g, int width, int height) {	/*	  <include name="right_corner_button_bg"/>	  <include name="prelight_tint"/>	  <include name="close_icon"/>	  <include name="close_icon"/>	  <include name="right_corner_outline"/>	*/	right_corner_button_bg(g, width, height);	prelight_tint(g, width, height);	close_icon(g, width, height);	right_corner_outline(g, width, height);    }    private void close_button_pressed(Graphics g, int width, int height) {	/*	  <include name="right_corner_button_bg"/>	  <include name="darken_tint"/>	  <include name="close_icon"/>	*/	right_corner_button_bg(g, width, height);	darken_tint(g, width, height);	close_icon(g, width, height);    }    private void menu_button(Graphics g, int width, int height) {	/*	  <include name="left_corner_button_bg"/>	  <include name="menu_icon" x="2"/>	*/	left_corner_button_bg(g, width, height);	g.translate(2, 0);	menu_icon(g, width, height);	g.translate(-2, 0);    }    private void menu_button_prelight(Graphics g, int width, int height) {	/*	  <include name="left_corner_button_bg"/>	  <include name="prelight_tint"/>	  <include name="menu_icon" x="2"/>	  <include name="menu_icon" x="2"/>	  <include name="left_corner_outline"/>	*/	left_corner_button_bg(g, width, height);	prelight_tint(g, width, height);	g.translate(2, 0);	menu_icon(g, width, height);	g.translate(-2, 0);	left_corner_outline(g, width, height);    }    private void menu_button_pressed(Graphics g, int width, int height) {	/*	  <include name="left_corner_button_bg"/>	  <include name="darken_tint"/>	  <include name="menu_icon" x="2"/>	*/	left_corner_button_bg(g, width, height);	darken_tint(g, width, height);	g.translate(2, 0);	menu_icon(g, width, height);	g.translate(-2, 0);    }    private void minimize_button(Graphics g, int width, int height, boolean corner) {	/*	  <include name="center_button_bg"/>	  <include name="minimize_icon"/>	*/	if (corner) {	    right_corner_button_bg(g, width, height);	} else {	    center_button_bg(g, width, height);	}	minimize_icon(g, width, height);    }    private void minimize_button_prelight(Graphics g, int width, int height, boolean corner) {	/*	  <include name="center_button_bg"/>	  <include name="prelight_tint"/>	  <include name="minimize_icon"/>	  <include name="minimize_icon"/>	*/	if (corner) {	    right_corner_button_bg(g, width, height);	} else {	    center_button_bg(g, width, height);	}	prelight_tint(g, width, height);	minimize_icon(g, width, height);    }    private void minimize_button_pressed(Graphics g, int width, int height, boolean corner) {	/*	  <include name="center_button_bg"/>	  <include name="darken_tint"/>	  <include name="minimize_icon"/>	*/	if (corner) {	    right_corner_button_bg(g, width, height);	} else {	    center_button_bg(g, width, height);	}	darken_tint(g, width, height);	minimize_icon(g, width, height);    }    private void maximize_button(Graphics g, int width, int height, boolean corner) {	/*	  <include name="center_button_bg"/>	  <include name="maximize_icon"/>	*/	if (corner) {	    right_corner_button_bg(g, width, height);	} else {	    center_button_bg(g, width, height);	}	maximize_icon(g, width, height);    }    private void maximize_button_prelight(Graphics g, int width, int height, boolean corner) {	/*	  <include name="center_button_bg"/>	  <include name="prelight_tint"/>	  <include name="maximize_icon"/>	  <include name="maximize_icon"/>	*/	if (corner) {	    right_corner_button_bg(g, width, height);	} else {	    center_button_bg(g, width, height);	}	prelight_tint(g, width, height);	maximize_icon(g, width, height);    }    private void maximize_button_pressed(Graphics g, int width, int height, boolean corner) {	/*	  <include name="center_button_bg"/>	  <include name="darken_tint"/>	  <include name="maximize_icon"/>	*/	if (corner) {	    right_corner_button_bg(g, width, height);	} else {	    center_button_bg(g, width, height);	}	darken_tint(g, width, height);	maximize_icon(g, width, height);    }    void paintButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {	this.context = context;	JButton button = (JButton)context.getComponent();	String buttonName = button.getName();	int buttonState = context.getComponentState();	JComponent titlePane = (JComponent)button.getParent();	Container titlePaneParent = titlePane.getParent();	JInternalFrame frame;	if (titlePaneParent instanceof JInternalFrame) {	    frame = (JInternalFrame)titlePaneParent;	} else if (titlePaneParent instanceof JInternalFrame.JDesktopIcon) {	    frame = ((JInternalFrame.JDesktopIcon)titlePaneParent).getInternalFrame();	} else {	    return;	}	boolean active = frame.isSelected();	setFrameGeometry(titlePane, frame.isMaximum() ? normalMaximizedFrameGeometry						      : normalFrameGeometry);	if (buttonName.equals("InternalFrameTitlePane.menuButton")) {	    if ((buttonState & PRESSED) != 0) {		menu_button_pressed(g, w, h);	    } else if ((buttonState & MOUSE_OVER) != 0) {		menu_button_prelight(g, w, h);	    } else {		menu_button(g, w, h);	    }	} else if (buttonName.equals("InternalFrameTitlePane.iconifyButton")) {	    boolean corner = !(frame.isClosable() || frame.isMaximizable());	    if ((buttonState & PRESSED) != 0) {		minimize_button_pressed(g, w, h, corner);	    } else if ((buttonState & MOUSE_OVER) != 0) {		minimize_button_prelight(g, w, h, corner);	    } else {		minimize_button(g, w, h, corner);	    }	} else if (buttonName.equals("InternalFrameTitlePane.maximizeButton")) {	    boolean corner = !frame.isClosable();	    if ((buttonState & PRESSED) != 0) {		maximize_button_pressed(g, w, h, corner);	    } else if ((buttonState & MOUSE_OVER) != 0) {		maximize_button_prelight(g, w, h, corner);	    } else {		maximize_button(g, w, h, corner);	    }	} else if (buttonName.equals("InternalFrameTitlePane.closeButton")) {	    if ((buttonState & PRESSED) != 0) {		close_button_pressed(g, w, h);	    } else if ((buttonState & MOUSE_OVER) != 0) {		close_button_prelight(g, w, h);	    } else {		close_button(g, w, h);	    }	}    }    private void outer_bevel(Graphics g, int width, int height) {	FrameGeometry gm = getFrameGeometry();	/*	  <draw_ops name="outer_bevel">		<!-- black edging -->		<rectangle color="#000000" x="0" y="0" width="width-1" height="height-1"/>	*/	g.setColor(Color.black);	//g.drawRect(0, 0, width-1, height-1);	//Adjusted because we have no clipping set	g.drawLine(5,       0,        width-6, 0);	g.drawLine(5,       height-1, width-6, height-1);	g.drawLine(0,       5,        0,       height-6);	g.drawLine(width-1, 5,        width-1, height-6);	/*		<!-- left outside -->		<line color="blend/gtk:light[NORMAL]/#FFFFFF/0.7" x1="1" y1="1" x2="1" y2="height-2"/>	*/	g.setColor(blendColor(getColor(ENABLED, GTKColorType.LIGHT), Color.white, 0.7F));	//g.drawLine(1, 1, 1, height-2);	g.drawLine(1, 3, 1, height-4);	/*		<!-- left inside -->		<line color="gtk:dark[NORMAL]"			x1="left_width-1" y1="top_height-1" x2="left_width-1" y2="height-bottom_height"/>	*/	g.setColor(getColor(ENABLED, GTKColorType.DARK));	g.drawLine(gm.left_width-1, gm.top_height-1, gm.left_width-1, height-gm.bottom_height);	/*		<!-- outside of bottom -->		<line color="blend/gtk:bg[NORMAL]/#000000/0.2" x1="2" y1="height-2" x2="width-2" y2="height-2"/>	*/	g.setColor(blendColor(getColor(ENABLED, GTKColorType.BACKGROUND), Color.black, 0.2F));	//g.drawLine(2, height-2, width-2, height-2);	g.drawLine(3, height-2, width-4, height-2);	/*		<!-- inside of bottom (in two lines, one dark one light) -->		<line color="gtk:dark[NORMAL]"			x1="left_width" y1="height-bottom_height" x2="width-right_width" y2="height-bottom_height"/>		<line color="blend/gtk:light[NORMAL]/#FFFFFF/0.7"			x1="left_width" y1="height-bottom_height+1" x2="width-right_width" y2="height-bottom_height+1"/>	*/	g.setColor(getColor(ENABLED, GTKColorType.DARK));	g.drawLine(gm.left_width, height-gm.bottom_height, width-gm.right_width, height-gm.bottom_height);	g.setColor(blendColor(getColor(ENABLED, GTKColorType.LIGHT), Color.white, 0.7F));	g.drawLine(gm.left_width, height-gm.bottom_height+1, width-gm.right_width, height-gm.bottom_height+1);	/*		<!-- right inside, again in two lines -->		<line color="gtk:dark[NORMAL]"			x1="width-right_width" y1="top_height-1" x2="width-right_width" y2="height-bottom_height"/>		<line color="blend/gtk:light[NORMAL]/#FFFFFF/0.7"			x1="width-right_width+1" y1="top_height-1" x2="width-right_width+1" y2="height-bottom_height+1"/>	*/	g.setColor(getColor(ENABLED, GTKColorType.DARK));	g.drawLine(width-gm.right_width,   gm.top_height-1, width-gm.right_width,   height-gm.bottom_height);	g.setColor(blendColor(getColor(ENABLED, GTKColorType.LIGHT), Color.white, 0.7F));	g.drawLine(width-gm.right_width+1, gm.top_height-1, width-gm.right_width+1, height-gm.bottom_height+1);	/*		<!-- right outside -->		<line color="blend/gtk:bg[NORMAL]/#000000/0.2" x1="width-2" y1="top_height-1" x2="width-2" y2="height-2"/>	    </draw_ops>	*/	g.setColor(blendColor(getColor(ENABLED, GTKColorType.BACKGROUND), Color.black, 0.2F));	//g.drawLine(width-2, top_height-1, width-2, height-2);	g.drawLine(width-2, 3, width-2, height-4);    }	    private void corners_unfocused(Graphics g, int width, int height) {	Image object;	/*	  <!-- corners (unfocused) -->	  <image filename="bottom_left.png" colorize="shade/gtk:bg[INSENSITIVE]/0.8" x="0" y="height-object_height" width="object_width" height="object_height"/> 	  <image filename="bottom_right.png" colorize="shade/gtk:bg[INSENSITIVE]/0.8" x="width-object_width" y="height-object_height" width="object_width" height="object_height"/>	*/	Color c = shadeColor(getColor(DISABLED, GTKColorType.BACKGROUND), 0.8F);	object = getImage("bottom_left", c);	g.drawImage(object, 0, height-object.getHeight(null), null);	object = getImage("bottom_right", c);	g.drawImage(object, width-object.getWidth(null), height-object.getHeight(null), null);    }    private void corners_focused(Graphics g, int width, int height) {	Image object;	/*	  <!-- corners -->	  <image filename="bottom_left.png" colorize="shade/gtk:bg[SELECTED]/1.0" x="0" y="height-object_height" width="object_width" height="object_height"/> 	  <image filename="bottom_right.png" colorize="shade/gtk:bg[SELECTED]/1.0" x="width-object_width" y="height-object_height" width="object_width" height="object_height"/>	*/	Color c = shadeColor(getColor(SELECTED, GTKColorType.BACKGROUND), 1.0F);	object = getImage("bottom_left", c);	g.drawImage(object, 0, height-object.getHeight(null), null);	object = getImage("bottom_right", c);	g.drawImage(object, width-object.getWidth(null), height-object.getHeight(null), null);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?