// 更新背景图片的方法
private void updateBackImage()  {
if (backLabel != null) {
int backw = JXCFrame.this.frame.getWidth();
int backh = JXCFrame.this.frame.getHeight();
backLabel.setSize(backw, backh);
backLabel.setText("<html><body><image width='" + backw
+ "' height='" + (backh - 110) + "' src="
+ JXCFrame.this.getClass().getResource("/welcome.jpg")
+ "'></img></body></html>");
}

}
/**
 * 为内部窗体添加Action的方法
 */
public JButton createFrameButton(String fName, String cname) {
String imgUrl = "res/ActionIcon/" + fName + ".png";
String imgUrl_roll = "res/ActionIcon/" + fName + "_roll.png";
String imgUrl_down = "res/ActionIcon/" + fName + "_down.png";
Icon icon = new ImageIcon(imgUrl); Icon icon_roll = null;
if (imgUrl_roll != null)
icon_roll = new ImageIcon(imgUrl_roll);
Icon icon_down = null;
if (imgUrl_down != null)
icon_down = new ImageIcon(imgUrl_down);
Action action = new openFrameAction(fName, cname, icon);
JButton button = new JButton(action);
button.setMargin(new Insets(0, 0, 0, 0));
button.setHideActionText(true);
button.setFocusPainted(false);
button.setBorderPainted(false);
button.setContentAreaFilled(false);
if (icon_roll != null)
button.setRolloverIcon(icon_roll);
if (icon_down != null)
button.setPressedIcon(icon_down); return button; }
// 窗体监听器
private final class FrameListener extends ComponentAdapter {
public void componentResized(final ComponentEvent e) {
updateBackImage();
}
} // 主窗体菜单项的单击事件监听器
protected final class openFrameAction extends AbstractAction {
private String frameName = null; private openFrameAction() {
} public openFrameAction(String cname, String frameName, Icon icon) {
this.frameName = frameName;
putValue(Action.NAME, cname); // 设置Action名称
putValue(Action.SHORT_DESCRIPTION, cname); // 设置Action的提示文本信息
putValue(Action.SMALL_ICON, icon); // 设置Action的图标
} public void actionPerformed(final ActionEvent e) {
JInternalFrame jf = getIFrame(frameName); // 调用getFrame()方法
// 在内部窗体闭关时,从内部窗体容器ifs对象中清除该窗体。
jf.addInternalFrameListener(new InternalFrameAdapter() {
public void internalFrameClosed(InternalFrameEvent e) {
ifs.remove(frameName);
}
});
if (jf.getDesktopPane() == null) {
desktopPane.add(jf); // 讲窗体添加到主窗体中
jf.setVisible(true); // 显示窗体
}
try {
jf.setSelected(true); // 使窗体处于被选择状态
} catch (PropertyVetoException e1) {
e1.printStackTrace();
}
}
}