import java.awt.BorderLayout
import java.awt.Dimension
import java.awt.FlowLayout
import java.awt.event.ActionEvent
import java.awt.event.ActionListener
import java.awt.event.ComponentAdapter
import java.awt.event.ComponentEvent
import java.awt.event.WindowAdapter
import java.awt.event.WindowEvent
import java.beans.PropertyVetoException
import java.text.SimpleDateFormat
import java.util.Calendarimport javax.swing.BorderFactory
import javax.swing.ImageIcon
import javax.swing.JButton
import javax.swing.JDesktopPane
import javax.swing.JFrame
import javax.swing.JInternalFrame
import javax.swing.JLabel
import javax.swing.JMenu
import javax.swing.JMenuBar
import javax.swing.JMenuItem
import javax.swing.JOptionPane
import javax.swing.JPanel
import javax.swing.JProgressBar
import javax.swing.JScrollPane
import javax.swing.JSeparator
import javax.swing.JToolBar
import javax.swing.Timer
import javax.swing.border.BevelBorderimport com.jb.cdjj.y2t027.flydream.hrms.pojo.UsersPojo
import com.jb.cdjj.y2t027.flydream.hrms.swing.component.JDesktopScrollPane
import com.jb.cdjj.y2t027.flydream.hrms.swing.utils.CharacterCommon/**
* <p>描述:FrmMain 主界面视窗UI类
* <p>作者:邓超
* <p>班级:Y2T027 FlyDream 小组
* <p>时间:2009-5-13
* <p>地点:宿舍
* <p>版本:1.0.0.1
*/
public class FrmMain extends JFrame { /**
* 序列化版本ID
*/
private static final long serialVersionUID = -6893438572255430328L{
// 设置UI感观效果(使用三方jar包:looks-2.1.4.jar)
try {
javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel")
} catch(Exception e) {
e.printStackTrace()
}
} /**
* UI组件
*/
private JMenuItem mnuItemHelpTopic
private JPanel pnlMain
private JMenu mnuHelp
private JMenuItem mnuItemDelete
private JPanel pnlTlb
private JSeparator septEdit
private JMenuItem mnuItemPaste
private JMenuItem mnuItemCopy
private JMenuItem mnuItemCut
private JMenu mnuEdit
private JMenuItem mnuItemLock
private JMenuItem mnuItemExit
private JSeparator septSystemBottom
private JMenuItem mnuItemAbout
private JMenuItem mnuItemLogout
private JSeparator septSystemTop
private JMenuItem mnuItemPermissions
private JMenuItem mnuItemParamConfig
private JLabel lblLoginUser
private JScrollPane pnlScrollContent
private JMenuItem mnuCloseAll
private JSeparator septWindow
private JMenuItem mnuItemCloseCurrent
private JMenuItem mnuItemSwitch
private JMenu mnuWindow
private JLabel lblTime
private JLabel lblProgressMsg
private JProgressBar progressOperation
private JDesktopPane pnlDsk
private JPanel pnlStatus
private JButton btnHelp
private JButton btnExit
private JButton btnLogout
private JButton btnLockScreen
private JToolBar tlbMain
private JMenu mnuSystem
private JMenuBar mnuBarMain
private JButton btnPermissions
private JButton btnParamConfig
private JLabel lblTlbSpliter2
private JLabel lblTlbSpliter1
private JMenuItem mnuModifyPwd
private static FrmLogin frmLogin
private JPanel pnlContent
private static UsersPojo currentLoginUser/**
* 获取当前登录用户
* @return 当前登录用户实体
*/
public static UsersPojo getCurrentLoginUser() {
return currentLoginUser
}
/**
* 设置当前登录用户
* @param currentLoginUser 当前登录用户实体
*/
public static void setCurrentLoginUser(UsersPojo currentLoginUser) {
FrmMain.currentLoginUser = currentLoginUser
} /**
* 参数化构造器
* @param loginWindow 登录UI实例
*/
public FrmMain(FrmLogin loginWindow) {
super()
frmLogin = loginWindow
initGUI()
this.addComponentListener(new ComponentAdapter(){ /**
* 组件显示事件方法
*/
@Override
public void componentShown(ComponentEvent e) {
lblLoginUser.setText("【"
+ (currentLoginUser != null
? (currentLoginUser.getLoginAccount() + "/" + currentLoginUser.getUsersName())
: "未登录")
+ "】")
super.componentShown(e)
}
})
}
/**
* UI组件初始化方法
*/
private void initGUI() {
try {
{
BorderLayout thisLayout = new BorderLayout()
getContentPane().setLayout(thisLayout)
}
{
mnuBarMain = new JMenuBar()
setJMenuBar(mnuBarMain)
{
mnuSystem = new JMenu()
mnuBarMain.add(mnuSystem)
mnuSystem.setText("系统(S)")
mnuSystem.setMnemonic(java.awt.event.KeyEvent.VK_S)
mnuSystem.setName("mnuSystem")
mnuSystem.setDoubleBuffered(false)
{
mnuItemParamConfig = new JMenuItem()
mnuSystem.add(mnuItemParamConfig)
mnuItemParamConfig.setText("参数设置(P)...")
mnuItemParamConfig.setToolTipText("前台系统字典及参数设置")
mnuItemParamConfig.setMnemonic(java.awt.event.KeyEvent.VK_P)
mnuItemParamConfig.setName("mnuItemParamConfig")
mnuItemParamConfig.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Param.png")))
mnuItemParamConfig.setDoubleBuffered(false)
mnuItemParamConfig.addActionListener(new ActionListener() {
/**
* 激活参数设置菜单项的事件方法
*/
public void actionPerformed(ActionEvent e) {
openOnlyOneInternalFrame(FrmInlParam.getInstance())
}
})
}
{
mnuItemPermissions = new JMenuItem()
mnuSystem.add(mnuItemPermissions)
mnuItemPermissions.setText("权限管理(E)...")
mnuItemPermissions.setToolTipText("系统用户及其授权管理")
mnuItemPermissions.setName("mnuItemPermissions")
mnuItemPermissions.setMnemonic(java.awt.event.KeyEvent.VK_E)
mnuItemPermissions.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/Permissions.png")))
mnuItemPermissions.setDoubleBuffered(false)
mnuItemPermissions.addActionListener(new ActionListener() {
/**
* 激活权限管理菜单项的事件方法
*/
public void actionPerformed(ActionEvent e) {
openOnlyOneInternalFrame(FrmInlPermissions.getInstance())
}
})
}
{
septSystemTop = new JSeparator()
mnuSystem.add(septSystemTop)
septSystemTop.setName("septSystemTop")
septSystemTop.setDoubleBuffered(false)
}
----------------------------------字数太多,只能分开发。
JInternalFrame inner = new JInternalFrame("11")inner.setVisible(true)
不知道不是这个内置窗口,可以把inner 添加到你的面板中,inner和jframe差不多的,布局话,可以先布局jpanel然后把这个窗口放到jpanel里面
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)