public void changeLAF(int iLAFIndex) { try { // Change LAF if (iLAFIndex >= marrLaf.length) iLAFIndex = marrLaf.length - 1; UIManager.setLookAndFeel( (LookAndFeel) Class.forName(marrLaf[iLAFIndex].getClassName()).newInstance()); // Update UI ((JMenuItem) mvtLAFItem.elementAt(iLAFIndex)).setSelected(true); SwingUtilities.updateComponentTreeUI(this); SwingUtilities.updateComponentTreeUI(mnuMain); WindowManager.updateLookAndField(); // Store config try { Hashtable prt = Global.loadHashtable(Global.FILE_CONFIG); prt.put("LAF", String.valueOf(iLAFIndex)); Global.storeHashtable(prt, Global.FILE_CONFIG); } catch (Exception e) { } } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
public void updateUI() { super.updateUI(); if (pmn != null) { SwingUtilities.updateComponentTreeUI(pmn); Skin.applySkin(pmn); } }
public void login() { mbAutoLogIn = false; while (!mbAutoLogIn) { try { // Confirm logout if (isOpen()) { if (MessageBox.showConfirmDialog( this, MonitorDictionary.getString("Confirm.Exit"), Global.APP_NAME, MessageBox.YES_NO_OPTION) == MessageBox.NO_OPTION) return; // Disconnect from server disconnect(); } // Login DialogLogin dlgLogin = new DialogLogin(this); WindowManager.centeredWindow(dlgLogin); if (dlgLogin.miReturn == JOptionPane.OK_OPTION) { // Update UI SwingUtilities.updateComponentTreeUI(pnlUser); SwingUtilities.updateComponentTreeUI(pnlThread); // Request to connect Socket sck = new Socket(dlgLogin.mstrHost, Integer.parseInt(dlgLogin.mstrPort)); sck.setSoLinger(true, 0); // Start up a channel thread that reads messages from the server channel = new SocketTransmitter(sck) { public void close() { if (msckMain != null) { super.close(); closeAll(); if (mbAutoLogIn) login(); } } }; channel.setUserName(dlgLogin.mstrUserName); channel.setPackage("com.fss.thread."); channel.start(); // Request to Server DDTP request = new DDTP(); request.setRequestID(String.valueOf(System.currentTimeMillis())); request.setString("UserName", dlgLogin.mstrUserName); request.setString("Password", dlgLogin.mstrPassword); // Response from Server DDTP response = channel.sendRequest("ThreadProcessor", "login", request); mstrThreadAppName = response.getString("strThreadAppName"); mstrThreadAppVersion = response.getString("strThreadAppVersion"); mstrAppName = response.getString("strAppName"); mstrAppVersion = response.getString("strAppVersion"); if (response != null) { if (response.getString("PasswordExpired") != null) { DialogChangePassword frm = new DialogChangePassword(this, channel); WindowManager.centeredWindow(frm); if (frm.miReturnValue != JOptionPane.OK_OPTION) throw new AppException("FSS-10003"); } String strLog = StringUtil.nvl(response.getString("strLog"), ""); showResult(txtBoard, strLog); Vector vtThread = response.getVector("vtThread"); updateTabBar(vtThread); mstrChannel = response.getString("strChannel"); if (mstrChannel != null) removeUser(mstrChannel); } btnRefresh.doClick(); pnlThread.setVisible(true); pnlUser.setVisible(true); setResizeWeight(1); setDividerLocation((int) (getSize().getHeight() - 160)); } mbAutoLogIn = true; updateLanguage(); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); // Disconnect from server mstrChannel = null; disconnect(); } } }