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

📄 smoothgradientborders.java

📁 eq跨平台查询工具源码 eq跨平台查询工具源码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                g.drawLine( w-2, corner+1, w-2, h-corner);                g.drawLine( corner+1, h-2, w-corner, h-2);                                g.setColor(shadow);                // Draw the Long shadow lines                g.drawLine( corner, 2, w-corner-1, 2);                g.drawLine( 2, corner, 2, h-corner-1);                g.drawLine( w-3, corner, w-3, h-corner-1);                g.drawLine( corner, h-3, w-corner-1, h-3);            }/*            JInternalFrame frame = (JInternalFrame) c;            if (frame.isMaximum())                SmoothGradientUtils.drawFlush3DBorder(g, x, y, w, h);            else                paintShadowedBorder(g, x, y, w, h); */        }                private void paintShadowedBorder(Graphics g, int x, int y, int w, int h) {                                    /*            Color background	= UIManager.getColor("desktop");            Color highlight		= UIManager.getColor("controlLtHighlight");            Color darkShadow    = UIManager.getColor("controlDkShadow");            Color lightShadow   = new Color(darkShadow.getRed(),                                            darkShadow.getGreen(),                                            darkShadow.getBlue(),                                            ALPHA1);            Color lighterShadow = new Color(darkShadow.getRed(),                                            darkShadow.getGreen(),                                            darkShadow.getBlue(),                                            ALPHA2);            g.translate(x, y);            // Dark border            g.setColor(darkShadow);            g.drawRect(0,   0, w-3, h-3);            // Highlight top and left            g.setColor(highlight);            g.drawLine(1, 1, w - 4, 1);            g.drawLine(1, 1, 1, h - 4);            // Paint background before painting the shadow            g.setColor(background);            g.fillRect(w - 2, 0, 2, h);            g.fillRect(0, h-2, w, 2);            // Shadow line 1            g.setColor(lightShadow);            g.drawLine(w - 2, 1, w - 2, h - 2);            g.drawLine(1, h - 2, w - 3, h - 2);            // Shadow line2            g.setColor(lighterShadow);            g.drawLine(w - 1, 2, w - 1, h - 2);            g.drawLine(2, h - 1, w - 2, h - 1);            g.translate(-x, -y);             **/        }                public Insets getBorderInsets(Component c) {            return ((JInternalFrame) c).isMaximum() ? MAXIMIZED_INSETS : NORMAL_INSETS;        }    }            /**     * A border used for the palette of <code>JInternalFrame</code>s.     */    private static class PaletteBorder extends AbstractBorder implements UIResource {                private static final Insets INSETS = new Insets(1, 1, 1, 1);                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h ) {            g.translate(x,y);            g.setColor(SmoothGradientLookAndFeel.getControlDarkShadow());            g.drawRect(0, 0, w-1, h-1);            g.translate(-x,-y);        }                public Insets getBorderInsets(Component c) { return INSETS; }    }            /**     * A border that looks like a separator line; used for menu bars     * and tool bars.     */    private static class SeparatorBorder extends AbstractBorder implements UIResource {                private static final Insets INSETS = new Insets(0, 0, 2, 1);                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            g.translate(x, y);            g.setColor( UIManager.getColor("Separator.foreground"));            g.drawLine( 0, h - 2, w - 1, h - 2 );                        g.setColor( UIManager.getColor("Separator.background"));            g.drawLine( 0, h - 1, w - 1, h - 1 );            g.translate(-x, -y);        }        public Insets getBorderInsets(Component c) { return INSETS; }    }            private static class ThinRaisedBorder extends AbstractBorder implements UIResource {        private static final Insets INSETS = new Insets(2, 2, 2, 2);                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            SmoothGradientUtils.drawThinFlush3DBorder(g, x, y, w, h);        }                public Insets getBorderInsets(Component c) { return INSETS; }    }            private static class ThinLoweredBorder extends AbstractBorder implements UIResource {        private static final Insets INSETS = new Insets(2, 2, 2, 2);                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            SmoothGradientUtils.drawThinPressed3DBorder(g, x, y, w, h);        }                public Insets getBorderInsets(Component c) { return INSETS; }    }            /**     * A border used for menu bars and tool bars in     * <code>HeaderStyle.SINGLE</code>. The bar is wrapped by an inner thin     * raised border, which in turn is wrapped by an outer thin lowered     * border.     */    private static class EtchedBorder extends AbstractBorder implements UIResource {                private static final Insets INSETS = new Insets(2, 2, 2, 2);                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            SmoothGradientUtils.drawThinPressed3DBorder(g, x, y, w, h);            SmoothGradientUtils.drawThinFlush3DBorder  (g, x + 1, y + 1, w - 2, h - 2);        }                public Insets getBorderInsets(Component c) { return INSETS; }    }            /**     * A border used for menu bars in <code>HeaderStyle.BOTH</code>.     * The menu bar and tool bar are wrapped by a thin raised border,     * both together are wrapped by a thin lowered border.     */    private static class MenuBarHeaderBorder extends AbstractBorder implements UIResource {                private static final Insets INSETS = new Insets(2, 2, 1, 2);                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            SmoothGradientUtils.drawThinPressed3DBorder(g, x, y, w, h + 1);            SmoothGradientUtils.drawThinFlush3DBorder  (g, x + 1, y + 1, w - 2, h - 1);        }                public Insets getBorderInsets(Component c) { return INSETS; }    }            /**     * A border used for tool bars in <code>HeaderStyle.BOTH</code>.     * The menu bar and tool bar are wrapped by a thin raised border,     * both together are wrapped by a thin lowered border.     */    private static class ToolBarHeaderBorder extends AbstractBorder implements UIResource {                private static final Insets INSETS = new Insets(1, 2, 2, 2);                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            SmoothGradientUtils.drawThinPressed3DBorder(g, x, y - 1, w, h + 1);            SmoothGradientUtils.drawThinFlush3DBorder  (g, x + 1, y, w - 2, h - 1);        }                public Insets getBorderInsets(Component c) { return INSETS; }    }            private static class MenuBorder extends AbstractBorder implements UIResource {        private static final Insets INSETS = new Insets( 2, 2, 2, 2 );                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            JMenuItem b = (JMenuItem) c;            ButtonModel model = b.getModel();                        if (model.isArmed() || model.isSelected()) {                g.setColor(SmoothGradientLookAndFeel.getControlDarkShadow());                g.drawLine(0, 0, w - 2, 0 );                g.drawLine(0, 0, 0, h - 1 );                //g.drawLine(w - 2, 2, w - 2, h - 1 );                                g.setColor(SmoothGradientLookAndFeel.getPrimaryControlHighlight());                g.drawLine(w - 1, 0, w - 1, h - 1 );            } else if (model.isRollover()) {                g.translate(x, y);                SmoothGradientUtils.drawFlush3DBorder(g, x, y, w, h);                g.translate(-x, -y);            }        }                public Insets getBorderInsets(Component c) { return INSETS; }                public Insets getBorderInsets(Component c, Insets newInsets) {            newInsets.top	 = INSETS.top;            newInsets.left	 = INSETS.left;            newInsets.bottom = INSETS.bottom;            newInsets.right	 = INSETS.right;            return newInsets;        }    }            private static class PopupMenuBorder extends AbstractBorder implements UIResource {        private static final Insets INSETS = new Insets(3, 3, 3, 3);                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            g.translate(x, y);            g.setColor(SmoothGradientLookAndFeel.getControlDarkShadow());            g.drawRect(0, 0, w-1, h-1);            g.setColor(SmoothGradientLookAndFeel.getPrimaryControlHighlight());            g.drawLine(1, 1, w-2, 1);            g.drawLine(1, 1, 1, h-2);            g.setColor(SmoothGradientLookAndFeel.getMenuBackground());            g.drawRect(2, 2, w-5, h-5);            g.translate(-x, -y);        }                public Insets getBorderInsets(Component c) { return INSETS; }    }            private static class RolloverButtonBorder extends ButtonBorder {        private static final Insets INSETS_3 = new Insets(3, 3, 3, 3);                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            AbstractButton b = (AbstractButton) c;            ButtonModel model = b.getModel();                        if (!model.isEnabled())                return;                        if (!(c instanceof JToggleButton)) {                if ( model.isRollover() && !( model.isPressed() && !model.isArmed() ) ) {                    super.paintBorder( c, g, x, y, w, h );                }                return;            }                        //if ( model.isRollover() && !( model.isPressed() && !model.isArmed() ) ) {            //super.paintBorder( c, g, x, y, w, h );            //}                        if (model.isRollover()) {                if (model.isPressed() && model.isArmed()) {                    SmoothGradientUtils.drawPressed3DBorder(g, x, y, w, h);                } else {                    SmoothGradientUtils.drawFlush3DBorder(g, x, y, w, h);                }            } else if (model.isSelected())                SmoothGradientUtils.drawDark3DBorder(g, x, y, w, h);        }        public Insets getBorderInsets(Component c) { return INSETS_3; }    }            /**     * Unlike Metal we don't paint the (misplaced) control color edges.     * Being a subclass of MetalBorders.ScrollPaneBorders ensures that     * the ScrollPaneUI will update the ScrollbarsFreeStanding property.     */    private static class ScrollPaneBorder extends MetalBorders.ScrollPaneBorder {                public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            g.translate(x, y);                        g.setColor(SmoothGradientLookAndFeel.getControlDarkShadow());            g.drawRect(0, 0, w - 2, h - 2);            g.setColor(SmoothGradientLookAndFeel.getControlHighlight());            g.drawLine(w - 1, 0, w - 1, h - 1);            g.drawLine(0, h - 1, w - 1, h - 1);                        g.translate(-x, -y);        }    }            private static class TextFieldBorder extends Flush3DBorder {        public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {                        if (!(c instanceof JTextComponent)) {                // special case for non-text components (bug ID 4144840)                if (c.isEnabled()) {                    SmoothGradientUtils.drawFlush3DBorder(g, x, y, w, h);                } else {                    SmoothGradientUtils.drawDisabledBorder(g, x, y, w, h);                }                return;            }                        if (c.isEnabled() && ((JTextComponent) c).isEditable())                SmoothGradientUtils.drawFlush3DBorder(g, x, y, w, h);            else                SmoothGradientUtils.drawDisabledBorder(g, x, y, w, h);        }    }            private static class ToggleButtonBorder extends ButtonBorder {        public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {            if (!c.isEnabled()) {                SmoothGradientUtils.drawDisabledBorder(g, x, y, w - 1, h - 1);            } else {                AbstractButton button = (AbstractButton) c;                ButtonModel    model  = button.getModel();                if (model.isPressed() && model.isArmed())                    SmoothGradientUtils.drawPressed3DBorder(g, x, y, w, h);                else if (model.isSelected())                    SmoothGradientUtils.drawDark3DBorder(g, x, y, w, h);                else                    SmoothGradientUtils.drawFlush3DBorder(g, x, y, w, h);            }        }    }        }

⌨️ 快捷键说明

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