📄 simplebasisamsborder.java
字号:
/* * Portions Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. *//** * Copyright(c) 1997 DTAI, Incorporated (http://www.dtai.com) * * All rights reserved * * Permission to use, copy, modify and distribute this material for * any purpose and without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies, and that the name of DTAI, Incorporated not be used in * advertising or publicity pertaining to this material without the * specific, prior written permission of an authorized representative of * DTAI, Incorporated. * * DTAI, INCORPORATED MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, * EXPRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST * INFRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS. THE * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL DTAI, INCORPORATED OR * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELATING * TO THE SOFTWARE. */package com.sun.jumpimpl.presentation.simplebasis;import java.awt.Color;import java.awt.Graphics;import java.awt.Insets;public class SimpleBasisAMSBorder implements Cloneable { public static final int NONE = 0; public static final int LINE = 1; public static final int THREED_IN = 2; public static final int THREED_OUT = 3; public static final int ETCHED_IN = 4; public static final int EMBOSSED_OUT = 5; public static final int ROUND_RECT = 6; private int type = NONE; private Color JUMPGuiAMSBorder = null; private int topMargin = 0; private int leftMargin = 0; private int bottomMargin = 0; private int rightMargin = 0; private int minMargin = 0; private int maxMargin = 0; private int JUMPGuiAMSBorderThickness = 0; private static final double BRIGHTER_FACTOR = 0.8; private static final double DARKER_FACTOR = 0.65; /** * Returns a brighter version of this color. * Replaces the "awt.Color" function brighter to use, in my opinion, * a better factor (awt used FACTOR = 0.7) * * @param color the color to which to apply the factor * @return the new, brighter color */ public static Color brighter(Color color) { Color newcolor = new Color(Math.min( (int) (color.getRed() * (1 / BRIGHTER_FACTOR)), 255), Math.min( (int) (color.getGreen() * (1 / BRIGHTER_FACTOR)), 255), Math.min( (int) (color.getBlue() * (1 / BRIGHTER_FACTOR)), 255)); if (newcolor.equals(color)) { return Color.white; } return newcolor; } /** * Returns a darker version of this color. * Replaces the "awt.Color" function brighter to use, in my opinion, * a better factor (awt used FACTOR = 0.7) * * @param color the color to which to apply the factor * @return the new, darker color */ public static Color darker(Color color) { Color newcolor = new Color(Math.max( (int) (color.getRed() * DARKER_FACTOR), 0), Math.max( (int) (color.getGreen() * DARKER_FACTOR), 0), Math.max( (int) (color.getBlue() * DARKER_FACTOR), 0)); if (newcolor.equals(color)) { return Color.black; } return newcolor; } /** * Returns a clone of this JUMPGuiAMSBorder * * @return the new, identical JUMPGuiAMSBorder *//* public Object clone() { SimpleBasisAMSBorder newJUMPGuiAMSBorder = new SimpleBasisAMSBorder(); newJUMPGuiAMSBorder.type = type; newJUMPGuiAMSBorder.SimpleBasisAMSBorder = SimpleBasisAMSBorder; newJUMPGuiAMSBorder.topMargin = topMargin; newJUMPGuiAMSBorder.leftMargin = leftMargin; newJUMPGuiAMSBorder.bottomMargin = bottomMargin; newJUMPGuiAMSBorder.rightMargin = rightMargin; newJUMPGuiAMSBorder.minMargin = minMargin; newJUMPGuiAMSBorder.maxMargin = maxMargin; newJUMPGuiAMSBorder.JUMPGuiAMSBorderThickness = JUMPGuiAMSBorderThickness; return newJUMPGuiAMSBorder; }*/ /** * sets all margins and thicknesses to zero *//* public void setNoInsets() { topMargin = 0; leftMargin = 0; bottomMargin = 0; rightMargin = 0; minMargin = 0; maxMargin = 0; JUMPGuiAMSBorderThickness = 0; }*/ /** * Returns the JUMPGuiAMSBorder type (e.g., JUMPGuiAMSBorder.LINE) * * @return the JUMPGuiAMSBorder type id *//* public int getType() { return type; }*/ /** * Sets the SimpleBasisAMSBorder type (e.g., to SimpleBasisAMSBorder.LINE) * * @param type the SimpleBasisAMSBorder type */ public synchronized void setType(int type) { this.type = type; } /** * Returns the current JUMPGuiAMSBorder color. If null (the default), a JUMPGuiAMSBorder color is * dynamically derived from the current background (passed to the "paint" function). * * @return the current Color value for the JUMPGuiAMSBorder *//* public Color getJUMPGuiAMSBorder() { return SimpleBasisAMSBorder; }*/ /** * Sets the current JUMPGuiAMSBorder color. If null (the default), a JUMPGuiAMSBorder color is * dynamically derived from the current background (passed to the "paint" function). * * @param JUMPGuiAMSBorder the new JUMPGuiAMSBorder color *//* public synchronized void setJUMPGuiAMSBorder(Color SimpleBasisAMSBorder) { this.SimpleBasisAMSBorder = SimpleBasisAMSBorder; }*/ /** * Returns the top margin. * * @return the top margin *//* public int getTopMargin() { return topMargin; }*/ /** * Returns the left margin. * * @return the left margin *//* public int getLeftMargin() { return leftMargin; }*/ /** * Returns the bottom margin. * * @return the bottom margin *//* public int getBottomMargin() { return bottomMargin; } */ /** * Returns the right margin. * * @return the right margin */ public int getRightMargin() { return rightMargin; } /** * Used internally to calculate the minimum/maximum margin values. */ private void resetMinMaxMargin() { maxMargin = topMargin; maxMargin = Math.max(maxMargin, leftMargin); maxMargin = Math.max(maxMargin, bottomMargin); maxMargin = Math.max(maxMargin, rightMargin); minMargin = topMargin; minMargin = Math.min(minMargin, leftMargin); minMargin = Math.min(minMargin, bottomMargin);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -