java实现图片充满整个窗体,没有标题栏;
实现无标题栏窗体的移动;
实现窗体始终显示在屏幕的中央位置
编译的软件是:Eclipse 3.6
源码:====================
import java.awt.Cursor;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import http://www.doczj.com/doc/5acf140716fc700abb68fcfe.html.URL;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Share extends JFrame {
private Point loc = null;
private Point tmp = null;
private boolean isDragged = false;
private JLabel pic;
public Share()
{
pic = new JLabel();
pic.setIcon(getIcon("tu/abc.jpg"));
pic.setBounds(0,0,510,290);
//初始化窗体
setResizable(false);
//将窗体设置成无标题栏的语句,setUndecorated();注意此语句一定要放在setVisible之前,否则会报错
setUndecorated(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(510,290);
setVisible(true);