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

📄 syntharrowbutton.java

📁 JAVA的一些源码 JAVA2 STANDARD EDITION DEVELOPMENT KIT 5.0
💻 JAVA
字号:
/* * @(#)SynthArrowButton.java	1.15 03/12/19 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package javax.swing.plaf.synth;import java.awt.*;import javax.swing.*;import javax.swing.plaf.UIResource;/** * JButton object that draws a scaled Arrow in one of the cardinal directions. * * @version 1.15, 12/19/03 * @author Scott Violet */class SynthArrowButton extends JButton implements SwingConstants, UIResource {    private int direction;    public SynthArrowButton(int direction) {        super();        setFocusable(false);        setDirection(direction);        setDefaultCapable(false);    }    public String getUIClassID() {        return "ArrowButtonUI";    }    public void updateUI() {        setUI(new SynthArrowButtonUI());    }    public void setDirection(int dir) {        direction = dir;        putClientProperty("__arrow_direction__", new Integer(dir));        repaint();    }    public int getDirection() {        return direction;    }    private static class SynthArrowButtonUI extends SynthButtonUI {        protected void installDefaults(AbstractButton b) {            super.installDefaults(b);            updateStyle(b);        }        protected void paint(SynthContext context, Graphics g) {            SynthArrowButton button = (SynthArrowButton)context.                                      getComponent();            context.getPainter().paintArrowButtonForeground(                context, g, 0, 0, button.getWidth(), button.getHeight(),                button.getDirection());        }        void paintBackground(SynthContext context, Graphics g, JComponent c) {            context.getPainter().paintArrowButtonBackground(context, g, 0, 0,                                                c.getWidth(), c.getHeight());        }        public void paintBorder(SynthContext context, Graphics g, int x,                                int y, int w, int h) {            context.getPainter().paintArrowButtonBorder(context, g, x, y, w,h);        }        public Dimension getMinimumSize() {            return new Dimension(5, 5);        }        public Dimension getMaximumSize() {            return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);        }        public Dimension getPreferredSize(JComponent c) {            SynthContext context = getContext(c);            int size = context.getStyle().getInt(context, "ArrowButton.size",                                                 16);            context.dispose();            return new Dimension(size, size);        }    }}

⌨️ 快捷键说明

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