資源簡介
包括java后臺服務器端和web前端,后臺用的Apache Tomocat服務器,包括注冊,登錄,連接數據庫,以及進、銷、存功能。
代碼片段和文件信息
package?com.lzw;
import?java.awt.*;
import?java.net.URL;
import?javax.swing.*;
public?class?DesktopPanel?extends?JDesktopPane?{//?桌面面板
private?static?final?long?serialVersionUID?=?1L;
private?final?Image?backImage;//?背景圖片
public?DesktopPanel()?{//?桌面面板的構造方法
super();//?調用父類JDesktopPane的構造器
URL?url?=?DesktopPanel.class.getResource(“/res/back.jpg“);//?獲得背景圖片的路徑
backImage?=?new?ImageIcon(url).getImage();//?獲得背景圖片
}
@Override
protected?void?paintComponent(Graphics?g)?{//?重寫繪制組件的方法
int?width?=?getWidth();//?定義桌面面板的寬度
int?height?=?this.getHeight();//?定義桌面面板的高度
g.drawImage(backImage?0?0?width?height?this);//?繪制背景圖片
}
}
評論
共有 條評論