自定义JProgressBar的外观

public class MyMetalProgressBarUI extends MetalProgressBarUI {

    private final static MyMetalProgressBarUI cornerButtonUI = new MyMetalProgressBarUI();
    
    public static ComponentUI createUI(JComponent c) {
        return cornerButtonUI;
    }

    @Override
    public void paint(Graphics g, JComponent c) {
        super.paint(g, c);
        g.setColor(Color.BLACK);
        int width = c.getWidth();
        int height = c.getHeight();
        g.drawRect(3, 3, width-6, height-6);
    }

}

 

你可能感兴趣的:(C++,c,C#)