如题~~谢谢大家

解决方案 »

  1.   

    frame.setUndecorated(true);
    自己绘制标题栏,并实现鼠标拖动功能 [在标题栏区域内]。 
      

  2.   

    上面的那个代码是显示标题栏,那如何绘制标题栏?请稍微具体一点~~谢谢nj_dobetter 
      

  3.   

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.MouseInputListener;public class MyFrame extends JFrame implements MouseInputListener {
      private java.awt.Point oldP;
      private static final int BAR_HEIGHT = 35;
      public MyFrame() {
        this.addMouseListener(this);
        this.addMouseMotionListener(this);
        this.setUndecorated(true);
        this.setSize(600, 500);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setVisible(true);
      }  public static void main(String[] args) {
        MyFrame mainframe = new MyFrame();
      }  public void mouseMoved(MouseEvent mouseevent) {
      }  public void mouseReleased(MouseEvent e) {
      }  public void mouseEntered(MouseEvent mouseevent) {
      }  public void mouseExited(MouseEvent mouseevent) {
      }  public void mouseClicked(MouseEvent mouseevent) {
      }  public void mousePressed(MouseEvent e) {
        if (e.getY() > BAR_HEIGHT) {
          oldP = null;
          return;
        }
        oldP = e.getPoint();
      }  public void mouseDragged(MouseEvent e) {
        if (oldP == null) {
          return;
        }
        java.awt.Point newP = e.getPoint();
        int x = getX() + (newP.x - oldP.x);
        int y = getY() + (newP.y - oldP.y);
        if (x >= MainFrame.Width - 85 || y >= MainFrame.Height - 45) {
          return;
        }
        setLocation(x, y);
      }  public void paint(Graphics g) {
        super.paint(g);
        g.setColor(Color.pink);
        g.fillRect(0, 0, getWidth(), BAR_HEIGHT);
      }}
      

  4.   

    http://java.ccidnet.com/art/3737/20060309/457211_1.html