package eetsoft.com;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
//===========================================
//软件主窗体 EETSoftFrame.java
//程序编写:Wilbur
//联系QQ:75191817
//===========================================
class EETSoftFrame extends JFrame
{
//软件主体panel
MainPanel panel;
boolean isFullScreen = true; // 是否全屏
boolean lmenu_isopen = true ; // 左边二级菜单是否展开
String img_dir = "skin_black";//皮肤文件夹
Dimension fdm,sdm;//窗体大小:窗体|分辨率
ConfigGet con;//配置类
Vector<MenuButtonBox> menulist = new Vector<MenuButtonBox>();//菜单数组\
String reDoCommand ;
RepaintActionDo action;
//====================
//初始化
EETSoftFrame(String title)
{
super(title);
//初始化窗体
setWindow(this);
//更新窗口
updateWindow(this);
}
//===============================
//窗体初始化
//===============================
private void setWindow(EETSoftFrame f)
{
//=============================
//读取配置类
con = new ConfigGet();
con.setFrameUI();
action = new RepaintActionDo(f);
//启动时是否全屏
isFullScreen = con.openfull;
//初始化皮肤文件
img_dir = con.getSkinDir();
fdm = con.getFrameSmallSize(isFullScreen);
sdm = con.getScreenSize();
f.setSize(fdm);//设置窗体大小
addMainPanel(this,fdm.width,fdm.height,isFullScreen);//添加主面板
f.setLocation((sdm.width-f.getWidth())/2, (sdm.height-f.getHeight())/2);//位置
f.setIconImage(Toolkit.getDefaultToolkit().getImage(ExamServer.class.getResource(img_dir + "/icon.png")));//图标
f.setBackground(Color.WHITE);//设置背景色
}
//===============================
//更新窗口
//===============================
private void updateWindow(JFrame f)
{
f.setUndecorated(true);//设置没有边框
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//添加系统退出事件
f.validate();//有效
f.setVisible(true);//可见
}
//================================
//添加主面板
//================================
private void addMainPanel(final EETSoftFrame frame,int fwidth,int fheight,boolean iffull)
{
//=====================
//创建面板
panel = new MainPanel(frame,fwidth,fheight);
panel.setPreferredSize(new Dimension(this.getWidth(),this.getHeight()));
this.getContentPane().add(panel);
//=====================
//关闭按钮事件
panel.btn_close.setActionCommand("cmd_close");
panel.btn_close.addActionListener(new ActionDo(this,panel.btn_close));
//=====================
//大小化按钮事件
if(iffull)
{//如果是全屏显示
panel.btn_max.setIcon(con.getImgUrl("maxed.png"));
panel.btn_max.setRolloverIcon(con.getImgUrl("maxed_on.png"));
panel.btn_max.setActionCommand("cmd_normal");
panel.btn_max.addActionListener(new ActionDo(this,panel.btn_max));
}
else
{//正常模式
panel.btn_max.setActionCommand("cmd_max");
panel.btn_max.addActionListener(new ActionDo(this,panel.btn_max));
}
//=====================
//最小化
panel.btn_min.setActionCommand("cmd_min");
panel.btn_min.addActionListener(new ActionDo(this,panel.btn_min));
//=====================
//鼠标事件点击点
final Point point = new Point();
//=====================
//顶部panel点击事件,单击双击
panel.toppanel.addMouseListener (new MouseAdapter()
{
public void mousePressed(MouseEvent e) //点击,记录点击位置以便拖动时计算
{
point.x = e.getX();
point.y = e.getY();
}
public void mouseClicked(MouseEvent e)
{//点击
if(e.getClickCount() == 2)
{//双击
if(panel.btn_max.getActionCommand().equals("cmd_normal"))//正常大小
{
fdm = con.getFrameSmallSize(false);
con.resetFrameSize(frame,fdm.width,fdm.height);
validate(); //先更新,以便后面按正常更新
con.normalAllWaysTop(frame);//是否最前端显示,在Config.java里配置
isFullScreen = false;
//设置按钮
panel.btn_max.setIcon(con.getImgUrl("max.png"));
panel.btn_max.setRolloverIcon(con.getImgUrl("max_on.png"));
setLocation((sdm.width-getWidth())/2, (sdm.height-getHeight())/2);
panel.btn_max.setActionCommand("cmd_max");
panel.btn_max.setToolTipText("全屏模式");
action.repaintFrame();
//new SubMenuActionDo(frame).btnExamKindAction();
validate();
}
else//全屏模式
{
con.resetFrameSize(frame,sdm.width,sdm.height);
validate(); //先更新
con.fullAllWaysTop(frame);//是否最前端显示,在Config.java里配置
isFullScreen = true;
setLocation((sdm.width-getWidth())/2, (sdm.height-getHeight())/2);
//设置按钮
panel.btn_max.setIcon(con.getImgUrl("maxed.png"));
panel.btn_max.setRolloverIcon(con.getImgUrl("maxed_on.png"));
panel.btn_max.setActionCommand("cmd_normal");
panel.btn_max.setToolTipText("正常模式");
action.repaintFrame();
//new SubMenuActionDo(frame).btnExamKindAction();
validate();
}
}
}
});
//================
//顶部Panel拖动事件
panel.toppanel.addMouseMotionListener(new MouseMotionAdapter()
{
public void mouseDragged(MouseEvent e)
{
if(!isFullScreen)
{
Point tpoint = getLocation();
setLocation(tpoint.x + e.getX() - point.x, tpoint.y + e.getY() - point.y );
}
}
});
//================================
// 右下角的拖动按钮
//================================
panel.bottom_resize.addMouseMotionListener(new MouseMotionAdapter()
{
public void mouseDragged(MouseEvent e)
{
//根据各部分计算最小不能小于多少尺寸
int min_w = frame.panel.img_t_bg_w + frame.panel.img_t_mid_w + frame.panel.btn_close_img.getIconWidth() + frame.panel.btn_max_img.getIconWidth() + frame.panel.btn_min_img.getIconWidth();
int min_h = frame.panel.img_t_l.getIconHeight() + frame.panel.img_menu.getIconHeight() + frame.panel.img_info.getIconHeight() + frame.panel.img_b_l.getIconHeight() ;
//最大不能超过分辨率
int max_w = con.getScreenSize().width;
int max_h = con.getScreenSize().height;
int fw = frame.getWidth(); //窗体宽
int fh = frame.getHeight(); //窗体高
int ex = fw + e.getX() - panel.bottom_resize.getWidth(); //鼠标移动后的宽/
int ey = fh + e.getY() - panel.bottom_resize.getHeight(); // 鼠标移动后的高
if( ex < min_w ) ex = min_w ; //小于最小宽
if( ey < min_h ) ey = min_h ; //小于最高
if( ex > max_w ) ex = max_w ; //最大宽度不得超过分辨率宽
if( ey > max_h ) ey = max_h ; //最大高度不得超过分辨率高
//宽高都没达到最小
if(!isFullScreen)
{
//重画
con.resetFrameSize(frame, ex, ey);
frame.validate();
}
}
});
//窗体变大,右边容器也要对应变大小
panel.bottom_resize.addMouseListener (new MouseAdapter()
{
public void mouseReleased(MouseEvent e) //点击,记录点击位置以便拖动时计算
{
action.repaintFrame();
//new SubMenuActionDo(frame).btnExamKindAction();
}
});
}
//==========================
//打开左边菜单
//==========================
public void openLeftMenu()
{
int tw = this.panel.m_panel.p_left.getWidth() ;
this.panel.m_panel.p_left.setVisible(true);
this.panel.m_panel.p_right.setPreferredSize(new Dimension(this.panel.m_panel.p_right.getWidth() - tw -17 ,this.panel.m_panel.getHeight()));
this.panel.m_panel.scrollPane.setPreferredSize(new Dimension(this.panel.m_panel.scrollPane.getWidth() - tw,this.panel.m_panel.getHeight()));
this.lmenu_isopen = true;
this.panel.m_panel.btn_split.setIcon(con.getImgUrl("btn_split_l.png"));
this.panel.m_panel.btn_split.setActionCommand("lmenu_close");
this.panel.m_panel.btn_split.setToolTipText("关闭左边菜单面板");
this.validate();
//new SubMenuActionDo(this).btnExamKindAction();
action.repaintFrame();
this.validate();
}
//==========================
//关闭左边菜单
//==========================
public void closeLeftMenu()
{
if(!con.lmenucanclose) return; //如果不许关闭左菜单栏不
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
java swing漂亮界面 超酷 javaswing教程 (328个子文件)
EETSoftFrame.class 8KB
MainPanel.class 6KB
ConfigGet.class 6KB
ExamServer.class 5KB
SubMenuActionDo.class 5KB
MiddlePanel.class 3KB
ActionDo.class 3KB
EETSoftFrame$1.class 3KB
EETSoftFrame$3.class 2KB
MenuButtonBox.class 1KB
EETSoftFrame$2.class 1KB
RepaintActionDo.class 919B
ObjectResizeBox.class 875B
EETSoftFrame$4.class 814B
.classpath 232B
Thumbs.db 65KB
Thumbs.db 65KB
Thumbs.db 65KB
Thumbs.db 50KB
Thumbs.db 50KB
Thumbs.db 50KB
Thumbs.db 46KB
Thumbs.db 46KB
Thumbs.db 46KB
Thumbs.db 23KB
Thumbs.db 4KB
test2.jar 205KB
EETSoftFrame.java 11KB
MainPanel.java 11KB
ExamServer.java 8KB
ConfigGet.java 7KB
SubMenuActionDo.java 6KB
ActionDo.java 4KB
MiddlePanel.java 4KB
MenuButtonBox.java 904B
RepaintActionDo.java 834B
ObjectResizeBox.java 564B
exam.png 6KB
btn_subject_list_on.png 2KB
btn_subject_list_on.png 2KB
btn_subject_list_on.png 2KB
btn_paper_send_on.png 2KB
btn_paper_send_on.png 2KB
btn_paper_send_on.png 2KB
btn_system_parmeter_on.png 2KB
btn_system_parmeter_on.png 2KB
btn_system_parmeter_on.png 2KB
btn_paperscore_t_on.png 2KB
btn_paperscore_t_on.png 2KB
btn_paperscore_t_on.png 2KB
btn_stu_classlist_on.png 2KB
icon.png 2KB
btn_stu_classlist_on.png 2KB
icon.png 2KB
icon.png 2KB
icon.png 2KB
btn_stu_classlist_on.png 2KB
btn_score_noscored_on.png 2KB
btn_score_noscored_on.png 2KB
btn_score_noscored_on.png 2KB
btn_paperscore_search_on.png 2KB
btn_paperscore_search_on.png 2KB
btn_paperscore_search_on.png 2KB
btn_exam_kind_on.png 2KB
btn_exam_kind_on.png 2KB
btn_exam_kind_on.png 2KB
btn_score_login_on.png 2KB
btn_score_login_on.png 2KB
btn_stu_class_on.png 2KB
btn_stu_class_on.png 2KB
btn_score_login_on.png 2KB
btn_stu_class_on.png 2KB
btn_paper_received_on.png 2KB
btn_paper_received_on.png 2KB
btn_paper_received_on.png 2KB
btn_room_list_on.png 2KB
btn_room_list_on.png 2KB
btn_room_list_on.png 2KB
btn_subject_add_on.png 2KB
btn_subject_add_on.png 2KB
btn_subject_add_on.png 2KB
btn_room_add_on.png 2KB
btn_room_add_on.png 2KB
btn_room_add_on.png 2KB
btn_stu_search_on.png 2KB
btn_stu_search_on.png 2KB
btn_stu_search_on.png 2KB
btn_exam_list_on.png 2KB
btn_exam_list_on.png 2KB
btn_exam_list_on.png 2KB
btn_stu_list_on.png 2KB
btn_stu_list_on.png 2KB
btn_stu_list_on.png 2KB
btn_paper_design_on.png 2KB
btn_paper_design_on.png 2KB
btn_paper_design_on.png 2KB
btn_stu_add_on.png 2KB
btn_stu_add_on.png 2KB
btn_stu_add_on.png 2KB
btn_score_scored_on.png 2KB
共 328 条
- 1
- 2
- 3
- 4
资源评论
qq_36784544
- 粉丝: 81
- 资源: 224
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功