⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultbutton.java

📁 Skin Look And Feel 1.2.10, 给你的java程序换肤, 支持大量通用皮肤文件.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		b.bottomHeight = topHeight;
		b.bottom_fill = top_fill;

		b.left = ImageUtils.flipHorizontally(left);
		b.leftWidth = leftWidth;
		b.left_fill = left_fill;

		b.right = ImageUtils.flipHorizontally(right);
		b.rightWidth = rightWidth;
		b.right_fill = right_fill;

		b.center = ImageUtils.flipHorizontally(center);
		b.center_fill = center_fill;

		b.imageWidth = imageWidth;
		b.imageHeight = imageHeight;
		b.tile = tile;
		b.insets = new Insets(insets.bottom, insets.left, insets.top, insets.right);
		return b;
	}

	/**
	 * Description of the Method
	 *
	 * @return   Description of the Returned Value
	 */
	public DefaultButton rotateCounterClockWise() {
		DefaultButton b = new DefaultButton();
		b.top = ImageUtils.rotateLeft(right);
		b.topHeight = rightWidth;
		b.top_fill = right_fill;

		b.topleft = ImageUtils.rotateLeft(topright);

		b.bottomleft = ImageUtils.rotateLeft(topleft);

		b.topright = ImageUtils.rotateLeft(bottomright);

		b.bottomright = ImageUtils.rotateLeft(bottomleft);

		b.bottom = ImageUtils.rotateLeft(left);
		b.bottomHeight = leftWidth;
		b.bottom_fill = left_fill;

		b.left = ImageUtils.rotateLeft(top);
		b.leftWidth = topHeight;
		b.left_fill = top_fill;

		b.right = ImageUtils.rotateLeft(bottom);
		b.rightWidth = bottomHeight;
		b.right_fill = bottom_fill;

		b.center = ImageUtils.rotateLeft(center);
		b.center_fill = center_fill;

		b.imageWidth = imageHeight;
		b.imageHeight = imageWidth;
		b.tile = tile;
		b.insets = new Insets(insets.left, insets.top, insets.right, insets.bottom);
		return b;
	}

	public DefaultButton rotateClockWise() {
		DefaultButton b = new DefaultButton();

		b.center = ImageUtils.rotateRight(center);
		b.center_fill = center_fill;

		b.top = ImageUtils.rotateRight(left);
		b.topHeight = leftWidth;
		b.top_fill = left_fill;

		b.right = ImageUtils.rotateRight(top);
		b.rightWidth = topHeight;
		b.right_fill = top_fill;

		b.bottom = ImageUtils.rotateRight(right);
		b.bottomHeight = rightWidth;
		b.bottom_fill = right_fill;

		b.left = ImageUtils.rotateRight(bottom);
		b.leftWidth = bottomHeight;
		b.left_fill = bottom_fill;

		b.topleft = ImageUtils.rotateRight(bottomleft);
		b.topright = ImageUtils.rotateRight(topleft);
		b.bottomleft = ImageUtils.rotateRight(bottomright);
		b.bottomright = ImageUtils.rotateRight(topright);

		b.imageWidth = imageHeight;
		b.imageHeight = imageWidth;
		b.tile = tile;
		b.insets = new Insets(leftWidth, bottomHeight, rightWidth, topHeight);

		return b;
	}

	/**
	 * Gets the MinimumSize attribute of the DefaultButton object
	 *
	 * @return   The MinimumSize value
	 */
	public Dimension getMinimumSize() {
		return new Dimension(imageWidth, imageHeight);
	}

	/**
	 * Gets the PreferredSize attribute of the DefaultButton object
	 *
	 * @return   The PreferredSize value
	 */
	public Dimension getPreferredSize() {
		return getMinimumSize();
	}

	/**
	 * Gets the Width attribute of the DefaultButton object
	 *
	 * @return   The Width value
	 */
	public int getWidth() {
		return imageWidth;
	}

	/**
	 * Gets the IconWidth attribute of the DefaultButton object
	 *
	 * @return   The IconWidth value
	 */
	public int getIconWidth() {
		return getWidth();
	}

	/**
	 * Gets the Height attribute of the DefaultButton object
	 *
	 * @return   The Height value
	 */
	public int getHeight() {
		return imageHeight;
	}

	/**
	 * Gets the IconHeight attribute of the DefaultButton object
	 *
	 * @return   The IconHeight value
	 */
	public int getIconHeight() {
		return getHeight();
	}

	/**
	 * Gets the Insets attribute of the DefaultButton object
	 *
	 * @return   The Insets value
	 */
	public Insets getInsets() {
		return insets;
	}

	// Implements BORDER

	/**
	 * Gets the BorderInsets attribute of the DefaultButton object
	 *
	 * @param c  Description of Parameter
	 * @return   The BorderInsets value
	 */
	public Insets getBorderInsets(Component c) {
		return insets;
	}

	/**
	 * Gets the BorderOpaque attribute of the DefaultButton object
	 *
	 * @return   The BorderOpaque value
	 */
	public boolean isBorderOpaque() {
		return false;
	}

	/**
	 * Description of the Method
	 *
	 * @return   Description of the Returned Value
	 */
	public String toString() {
		return "DefaultButton(" + getWidth() + "x" + getHeight() + ",center_fill=" + center_fill + ")";
	}

	/**
	 * Description of the Method
	 *
	 * @param c  Description of Parameter
	 * @param g  Description of Parameter
	 * @param x  Description of Parameter
	 * @param y  Description of Parameter
	 */
	public void paintIcon(Component c, Graphics g, int x, int y) {
		if (center != null) {
			g.drawImage(center, x, y, c);
		}
		//	paint(g, x, y, c);
	}

	/**
	 * Description of the Method
	 *
	 * @param g  Description of Parameter
	 * @param b  Description of Parameter
	 */
	public void paint(Graphics g, Component b) {
		paint(g, 0, 0, b);
	}

	/**
	 * Description of the Method
	 *
	 * @param g  Description of Parameter
	 * @param x  Description of Parameter
	 * @param y  Description of Parameter
	 * @param b  Description of Parameter
	 */
	public void paint(Graphics g, int x, int y, Component b) {
		paint(g, x, y, ((JComponent)b).getWidth(), ((JComponent)b).getHeight(), b);
	}

	/**
	 * Description of the Method
	 *
	 * @param b       Description of Parameter
	 * @param g       Description of Parameter
	 * @param x       Description of Parameter
	 * @param y       Description of Parameter
	 * @param width   Description of Parameter
	 * @param height  Description of Parameter
	 */
	public void paintBorder(Component b, Graphics g, int x, int y, int width, int height) {

		// PENDING(fred): borders and center should be drawn as tiles!!!
		// borders
		// center
		if (top != null) {
			ImageUtils.paint(b, g, top, x + (topleft != null ? leftWidth : 0), y, width - (topleft != null ? leftWidth : 0) - (topright != null ? rightWidth : 0), topHeight, false, top_fill);
		}

		if (right != null) {
			ImageUtils.paint(b, g, right, x + width - rightWidth, y + topHeight, rightWidth, height - topHeight - bottomHeight, false, right_fill);
		}

		if (bottom != null) {
			ImageUtils.paint(b, g, bottom, x + (topleft != null ? leftWidth : 0), y + height - bottomHeight, width - (topleft != null ? leftWidth : 0) - (topright != null ? rightWidth : 0), bottomHeight, false, bottom_fill);
		}

		if (left != null) {
			ImageUtils.paint(b, g, left, x, y + topHeight, leftWidth, height - topHeight - bottomHeight, false, left_fill);
		}

		// finally, draw corners
		if (topleft != null) {
			ImageUtils.paint(b, g, topleft, x, y, 0, 0, false, ImageUtils.PAINT_NORMAL);
		}
		if (topright != null) {
			ImageUtils.paint(b, g, topright, x + width - topright.getWidth(null), y, 0, 0, false, ImageUtils.PAINT_NORMAL);
		}
		if (bottomleft != null) {
			ImageUtils.paint(b, g, bottomleft, x, y + height - bottomleft.getHeight(null), 0, 0, false, ImageUtils.PAINT_NORMAL);
		}
		if (bottomright != null) {
			ImageUtils.paint(b, g, bottomright, x + width - bottomright.getWidth(null), y + height - bottomright.getHeight(null), 0, 0, false, ImageUtils.PAINT_NORMAL);
		}
	}


	public void paintWindow(Graphics g, int width, int height, int windowX, int windowY, int windowWidth, int windowHeight, Component b) {

		ImageUtils.paintWindow(b, g, center, leftWidth, topHeight, width - leftWidth - rightWidth, height - topHeight - bottomHeight ,windowX, windowY, windowWidth, windowHeight,false,center_fill);
		paintBorder(b, g,0,0, width, height);

	}

}

⌨️ 快捷键说明

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