我想替换java应用程序的系统窗口边框,把它换成我设计的图形,应该如何设置??
请说的详细一些。
    系统窗口边框就是窗口上面的那个蓝条,4条边。
    还有里面的填充图形
    这些都要换,谢谢~~
    分不够可以加

解决方案 »

  1.   

    import java.awt.*;
    import java.awt.event.MouseEvent;import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.event.MouseInputAdapter;public class UndecoratedFrame extends JFrame
    {
    private static final int TITLE_HEIGHT = 20; public UndecoratedFrame() throws HeadlessException
    {
    super();
    setUndecorated(true); MouseHandler ml = new MouseHandler();
    addMouseListener(ml);
    addMouseMotionListener(ml);
    } public UndecoratedFrame(String title) throws HeadlessException
    {
    super(title);
    setUndecorated(true); MouseHandler ml = new MouseHandler();
    addMouseListener(ml);
    addMouseMotionListener(ml);
    } public Insets getInsets()
    {
    return new Insets(TITLE_HEIGHT, 1, 1, 1);
    }

    public void paint(Graphics g)
    {
    super.paint(g);
    g.setColor(new Color(0, 0, 128));
    g.drawRect(0, 0, getWidth()-1, getHeight()-1);
    g.fillRect(0, 0, getWidth(), TITLE_HEIGHT); FontMetrics fm = g.getFontMetrics();
    g.setColor(Color.white);
    g.drawString(getTitle(), 2, (TITLE_HEIGHT - fm.getHeight()) / 2 + fm.getAscent());
    }

    private class MouseHandler extends MouseInputAdapter
    {
    private Point point; public void mousePressed(MouseEvent e)
    {
    if (e.getY() <= TITLE_HEIGHT) {
    this.point = e.getPoint();
    }
    }

    public void mouseDragged(MouseEvent e)
    {
    if (point != null) {
    setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); Point p = e.getPoint();
    int dx = p.x - point.x;
    int dy = p.y - point.y;

    int x = getX();
    int y = getY();
    setLocation(x + dx, y + dy);
    }
    }

    public void mouseReleased(MouseEvent e)
    {
    point = null;
    setCursor(Cursor.getDefaultCursor());
    }
    } public static void main(String[] args)
    {
    JFrame f = new UndecoratedFrame("Undecorated Frame");
    f.getContentPane().add(new JLabel("Hello World!", JLabel.CENTER), BorderLayout.CENTER);
    f.setSize(400, 400);
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
    }}
      

  2.   

    试过楼上的,果然行。
    其实楼主也可以用IBM的SWT包
      

  3.   

    1、换图片可以吗??
    2、渐变效果??
    3、jre包可以压缩成多小,怎么删?怎么压?
    谢谢~~~
    我会继续加50分
      

  4.   

    前两个问题解决了,谁能帮我解决缩小jre的问题啊~~~要缩小在5m以内~~谢谢大家拉