用java实现的Status Bar(zz)

/*===============================================================================

 * SlightBevelBorder.java<o:p></o:p><o:p></o:p>

 *===============================================================================<o:p></o:p>

 * auth:     Jason<o:p></o:p>

 * CSDN ID:  Unagain<o:p></o:p>

 * Email:    tl21cen@hotmail.com<o:p></o:p>

 * date:    2006-4-11<o:p></o:p>

 *===============================================================================<o:p></o:p>

 */<o:p></o:p>

package tl.util;<o:p></o:p>

 <o:p></o:p>

import java.awt.Color;<o:p></o:p>

import java.awt.Component;<o:p></o:p>

import java.awt.Graphics;<o:p></o:p>

 <o:p></o:p>

import javax.swing.border.SoftBevelBorder;<o:p></o:p>

 <o:p></o:p>

public class SlightBevelBorder extends SoftBevelBorder {<o:p></o:p>

    private static final long serialVersionUID = 1L;<o:p></o:p>

 <o:p></o:p>

    public SlightBevelBorder(int bevelType) {<o:p></o:p>

        super(bevelType);<o:p></o:p>

    }<o:p></o:p>

 <o:p></o:p>

    public SlightBevelBorder(int bevelType, Color highlight, Color shadow) {<o:p></o:p>

        super(bevelType, highlight, shadow);<o:p></o:p>

    }<o:p></o:p>

 <o:p></o:p>

    /**<o:p></o:p>

     * Paints the border for the specified component with the specified<o:p></o:p>

     * position and size.<o:p></o:p>

     * @param c the component for which this border is being painted<o:p></o:p>

     * @param g the paint graphics<o:p></o:p>

     * @param x the x position of the painted border<o:p></o:p>

     * @param y the y position of the painted border<o:p></o:p>

     * @param width the width of the painted border<o:p></o:p>

     * @param height the height of the painted border<o:p></o:p>

     */<o:p></o:p>

    public void paintBorder(Component c, Graphics g, int x, int y, int width,<o:p></o:p>

           int height) {<o:p></o:p>

       Color oldColor = g.getColor();<o:p></o:p>

        g.translate(x, y);<o:p></o:p>

 <o:p></o:p>

       if (bevelType == RAISED) {<o:p></o:p>

           g.setColor(getHighlightOuterColor(c));<o:p></o:p>

           g.drawLine(0, 0, width - 2, 0);<o:p></o:p>

           g.drawLine(0, 1, 0, height - 2);<o:p></o:p>

 <o:p></o:p>

           g.setColor(getShadowOuterColor(c));<o:p></o:p>

           g.drawLine(0, height - 1, width - 1, height - 1);<o:p></o:p>

           g.drawLine(width - 1, 0, width - 1, height - 1);<o:p></o:p>

           <o:p></o:p>

       } else if (bevelType == LOWERED) {<o:p></o:p>

           g.setColor(getShadowOuterColor(c));<o:p></o:p>

           g.drawLine(0, 0, width - 2, 0);<o:p></o:p>

           g.drawLine(0, 0, 0, height - 2);<o:p></o:p>

           <o:p></o:p>

           g.setColor(getHighlightOuterColor(c));<o:p></o:p>

           g.drawLine(0, height - 1, width - 1, height - 1);<o:p></o:p>

           g.drawLine(width - 1, 0, width - 1, height);<o:p></o:p>

       }<o:p></o:p>

        g.translate(-x, -y);<o:p></o:p>

        g.setColor(oldColor);<o:p></o:p>

    }<o:p></o:p>

}

/*===============================================================================<o:p></o:p>

 * StatusbarBuilder.java<o:p></o:p>

 *===============================================================================<o:p></o:p>

 *  This program is free software; you can redistribute it and/or modify<o:p></o:p>

 *  it under the terms of the GNU General Public License as published by<o:p></o:p>

 *  the Free Software Foundation; either version 2 of the License, or<o:p></o:p>

 *  (at your option) any later version.<o:p></o:p>

 *  <o:p></o:p>

 *  This program is distributed in the hope that it will be useful,<o:p></o:p>

 *  but WITHOUT ANY WARRANTY; without even the implied warranty of<o:p></o:p>

 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<o:p></o:p>

 *  GNU General Public License for more details.<o:p></o:p>

 *  <o:p></o:p>

 *  You should have received a copy of the GNU General Public License<o:p></o:p>

 *  along with this program; if not, write to the Free Software<o:p></o:p>

 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA<o:p></o:p>

 *===============================================================================<o:p></o:p>

 * auth:    Jason<o:p></o:p>

 * CSDN ID:    Unagain<o:p></o:p>

 * Email:    tl21cen@hotmail.com<o:p></o:p>

 * date:    2006-4-11<o:p></o:p>

 *===============================================================================<o:p></o:p>

 */<o:p></o:p>

package tl.util;<o:p></o:p>

 <o:p></o:p>

import java.awt.BorderLayout;<o:p></o:p>

import java.awt.Color;<o:p></o:p>

import java.awt.Component;<o:p></o:p>

import java.awt.Cursor;<o:p></o:p>

import java.awt.Dimension;<o:p></o:p>

import java.awt.Graphics;<o:p></o:p>

import java.awt.Point;<o:p></o:p>

import java.awt.Rectangle;<o:p></o:p>

import java.awt.Window;<o:p></o:p>

import java.awt.event.MouseEvent;<o:p></o:p>

import java.awt.event.WindowAdapter;<o:p></o:p>

import java.awt.event.WindowEvent;<o:p></o:p>

import java.util.Hashtable;<o:p></o:p>

 <o:p></o:p>

import javax.swing.Box;<o:p></o:p>

import javax.swing.BoxLayout;<o:p></o:p>

import javax.swing.JComponent;<o:p></o:p>

import javax.swing.JFrame;<o:p></o:p>

import javax.swing.JLabel;<o:p></o:p>

import javax.swing.JPanel;<o:p></o:p>

import javax.swing.border.AbstractBorder;<o:p></o:p>

import javax.swing.border.BevelBorder;<o:p></o:p>

import javax.swing.border.EmptyBorder;<o:p></o:p>

import javax.swing.event.MouseInputAdapter;<o:p></o:p>

import javax.swing.text.JTextComponent;<o:p></o:p>

 <o:p></o:p>

//class StatusBar extends JComponent {<o:p></o:p>

public class StatusbarBuilder {<o:p></o:p>

    //final static Dimension XGAP = new Dimension(2, 0);<o:p></o:p>

 <o:p></o:p>

    private JPanel bar;<o:p></o:p>

 <o:p></o:p>

    /**<o:p></o:p>

     * matains all instances created, each instance associate<o:p></o:p>

     * with an existing window object.<br><o:p></o:p>

     * you can create and to obtain a instance using newInstance<o:p></o:p>

     * method with a specified window object.<o:p></o:p>

     */<o:p></o:p>

    private static <o:p></o:p>

    Hashtable<Window, StatusbarBuilder> instances = <o:p></o:p>

       new Hashtable<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值