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); } }
private void isEdit(Boolean isEdit) { if (isEdit) { try { Connection con = FrameLogin.getConnect(); String sql = "SELECT * FROM Persons WHERE personId = " + Id; Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql); if (rs.first()) { String firstname = rs.getString("FirstName"); String lastname = rs.getString("LastName"); String cellphone = rs.getString("CellPhoneNo"); String homephone = rs.getString("HomePhoneNo"); String gradyear = rs.getString("Graduation Year"); String Gender = rs.getString("Gender"); firstName.setText(firstname); lastName.setText(lastname); cellPhone.setText(cellphone); homePhone.setText(homephone); gradYear.setText(gradyear); gender.setSelectedItem(Gender); jLabel7.setVisible(false); studentId.setVisible(false); } else { MessageBox.infoBox("Error: ID not found", "Error"); } } catch (Exception e) { MessageBox.infoBox(e.toString(), "Error in isEdit"); } } FrameLogin.closeConnect(); }
private void handleNetworkException(Exception exception) { if (exception instanceof AuthenticationException) { MessageBox.Show( this, getString(R.string.authentication_error_title), getString(R.string.authentication_error), new Callback<Void>() { public void doStuff(Void param) { restart(); } }); } else if (exception instanceof ServerException) { MessageBox.Show( this, getString(R.string.server_error_title), getString(R.string.server_error), null); } else if (exception instanceof CryptoException) { MessageBox.Show( this, getString(R.string.decryption_error_title), getString(R.string.decryption_error), null); } else if (exception instanceof IOException) { return; } else { MessageBox.Show(this, "Error", "What happen", null); } }
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(ACT_VERIFICATION)) { try { this.m_collection = UareUGlobal.GetReaderCollection(); m_collection.GetReaders(); } catch (UareUException e1) { // TODO Auto-generated catch block JOptionPane.showMessageDialog(null, "Error getting collection"); return; } if (m_collection.size() == 0) { MessageBox.Warning("Reader is not selected"); return; } m_reader = m_collection.get(0); if (null == m_reader) { MessageBox.Warning("Reader is not selected"); } else { Verification.Run(m_reader, this.enrollmentFMD); } } else if (e.getActionCommand().equals(ACT_ENROLLMENT)) { try { this.m_collection = UareUGlobal.GetReaderCollection(); m_collection.GetReaders(); } catch (UareUException e1) { // TODO Auto-generated catch block JOptionPane.showMessageDialog(null, "Error getting collection"); return; } if (m_collection.size() == 0) { MessageBox.Warning("Reader is not selected"); return; } m_reader = m_collection.get(0); if (null == m_reader) { MessageBox.Warning("Reader is not selected"); } else { this.enrollmentFMD = Enrollment.Run(m_reader, "1234"); } } else if (e.getActionCommand().equals(ACT_EXIT)) { m_dlgParent.setVisible(false); } }
void searchName(String nameToMatch) { URI url; try { // We should look up the miITIS_TSN status, but since we don't // have any options there ... url = new URI("http", "www.google.com", "/search", "q=" + nameToMatch); // I think the URI handles the URL encoding? } catch (URISyntaxException e) { throw new RuntimeException(e); } try { Desktop desktop = Desktop.getDesktop(); desktop.browse(url); } catch (IOException e) { MessageBox.messageBox( mainFrame, "Could not open URL '" + url + "'", "The following error occurred while looking up URL '" + url + "': " + e.getMessage(), MessageBox.ERROR); } }
public static void closeConnect() { try { con.close(); } catch (SQLException e) { MessageBox.infoBox(e.toString(), "Error in closeConnect"); } }
private void updateTabBar(Vector vtThread) { pnlThread.removeAll(); for (int iThreadIndex = 0; iThreadIndex < vtThread.size(); iThreadIndex++) { try { Vector vtThreadInfo = (Vector) vtThread.elementAt(iThreadIndex); PanelThreadMonitor mntTemp = new PanelThreadMonitor(channel); String strThreadID = (String) vtThreadInfo.elementAt(0); String strThreadName = (String) vtThreadInfo.elementAt(1); int iThreadStatus = Integer.parseInt((String) vtThreadInfo.elementAt(2)); mntTemp.setThreadID(strThreadID); mntTemp.setThreadName(strThreadName); mntTemp.setThreadStatus(iThreadStatus); showResult(mntTemp.txtMonitor, (String) vtThreadInfo.elementAt(3)); mntTemp.addPropertyChangeListener(this); pnlThread.add(strThreadName, mntTemp); mntTemp.updateStatus(); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } } Skin.applySkin(this); }
/** * Load a file of a particular type. It's a pretty standard helper function, which uses DarwinCSV * and setCurrentCSV(...) to make file loading happen with messaging and whatnot. We can also * reset the display: just call loadFile(null). * * @param file The file to load. * @param type The type of file (see DarwinCSV's constants). */ private void loadFile(File file, short type) { // If the file was reset, reset the display and keep going. if (file == null) { mainFrame.setTitle(basicTitle); setCurrentCSV(null); return; } // Load up a new DarwinCSV and set current CSV. try { setCurrentCSV(new DarwinCSV(file, type)); } catch (IOException ex) { MessageBox.messageBox( mainFrame, "Could not read file '" + file + "'", "Unable to read file '" + file + "': " + ex); } // Set the main frame title, based on the filename and the index. mainFrame.setTitle( basicTitle + ": " + file.getName() + " (" + String.format("%,d", currentCSV.getRowIndex().getRowCount()) + " rows)"); }
void lookUpTaxonID(String taxonID) { URI url; try { // We should look up the miITIS_TSN status, but since we don't // have any options there ... url = new URI( "http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=" + taxonID); } catch (URISyntaxException e) { throw new RuntimeException(e); } try { Desktop desktop = Desktop.getDesktop(); desktop.browse(url); } catch (IOException e) { MessageBox.messageBox( mainFrame, "Could not open URL '" + url + "'", "The following error occurred while looking up URL '" + url + "': " + e.getMessage(), MessageBox.ERROR); } }
public boolean updateDatabase( String table_name, String table_column_giving, Object row_element, String table_column_giving2, Object row_element2, String table_column_need, Object update_element) { // DatabaseManager dbm = DatabaseManager.getDbCon(); try { dbm.insert( "UPDATE " + table_name + " SET " + table_column_need + " ='" + update_element + "' WHERE " + table_column_giving + "='" + row_element + "' AND " + table_column_giving2 + "='" + row_element2 + "'"); } catch (SQLException ex) { MessageBox.showMessage(ex.getMessage(), "SQL ERROR", "error"); return false; } return true; }
public SceneManager() { stage = new GLayeredPane(); stage.setBounds(0, 0, GameSetting.windowWidth, GameSetting.windowHeight); // add message dialog layer stage.setLayer(MessageBox.getDialogLayeredPane(), GLayeredPane.POPUP_LAYER); MessageBox.getDialogLayeredPane().setLocation(0, 0); MessageBox.getDialogLayeredPane().setSize(stage.getSize()); stage.add(MessageBox.getDialogLayeredPane()); // stage.addKeyListener(this); // stage.setFocusable(true); // stage.requestFocusInWindow(); // sceneMap = new HashMap<String, GScene>(); }
//////////////////////////////////////////////////////// // Purpose: send message stop server // Author: TrungDD // Date: 10/2003 //////////////////////////////////////////////////////// public void stopServer() { if (MessageBox.showConfirmDialog( this, MonitorDictionary.getString("Confirm.Shutdown"), Global.APP_NAME, MessageBox.YES_NO_OPTION) == MessageBox.NO_OPTION) return; try { DDTP request = new DDTP(); request.setRequestID(String.valueOf(System.currentTimeMillis())); channel.sendRequest("ThreadProcessor", "closeServer", request); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
public static void createAndShowGUI(String id) { try { UareUGlobal.DestroyReaderCollection(); } catch (UareUException e) { MessageBox.DpError("UareUGlobal.destroyReaderCollection()", e); } }
private void submitButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_submitButtonActionPerformed // TODO add your handling code here: Connection con = FrameLogin.getConnect(); String SQLInsert = "INSERT INTO `2761DB`.`Persons` (`FirstName`, `LastName`, `CellPhoneNo`, `HomePhoneNo`, " + "`SchoolId`, `Graduation Year`, `Gender`) VALUES ('" + firstName.getText() + "', '" + lastName.getText() + "', '" + cellPhone.getText() + "', '" + homePhone.getText() + "', '" + studentId.getText() + "', '" + gradYear.getText() + "', '" + (String) (gender.getSelectedItem()) + "');"; String SQLUpdate = "UPDATE `2761DB`.`Persons` SET `FirstName` = '" + firstName.getText() + "', `LastName` = '" + lastName.getText() + "', `CellPhoneNo` = ' " + cellPhone.getText() + "', `HomePhoneNo` = '" + homePhone.getText() + "', `Graduation Year` = '" + gradYear.getText() + "', `Gender` = '" + (String) (gender.getSelectedItem()) + "' WHERE `PersonId` = '" + Id + "';"; // UPDATE `2761DB`.`Persons` SET `FirstName`='Robbie', `LastName`='Tacescu', `CellPhoneNo`='', // `HomePhoneNo`='559300', `SchoolId`='15648916', `Graduation Year`='6545', `Gender`='males' // WHERE // `PersonId`='42'; try { if (isEdit) { Statement stmt = con.createStatement(); // System.out.println(SQLUpdate); stmt.executeUpdate(SQLUpdate); } else { Statement stmt = con.createStatement(); // System.out.println(SQLInsert); stmt.executeUpdate(SQLInsert); } } catch (SQLException err) { MessageBox.infoBox(err.toString(), "Error in AddUserForm submitButton"); } FrameLogin.closeConnect(); this.dispose(); } // GEN-LAST:event_submitButtonActionPerformed
public void changePassword() { try { DialogChangePassword dlgPass = new DialogChangePassword(this, channel); if (dlgPass != null) WindowManager.centeredWindow(dlgPass); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
private void formWindowClosing( java.awt.event.WindowEvent evt) { // GEN-FIRST:event_formWindowClosing // TODO add your handling code here: Connection con = getConnect(); try { // con.close(); } catch (Exception err) { MessageBox.infoBox(err.toString(), "Error closing connection in formWindowClosed"); } } // GEN-LAST:event_formWindowClosing
public static boolean isId(String id) { boolean isInt = true; try { Integer.parseInt(id); } catch (Error er) { isInt = false; MessageBox.infoBox("Error: ID incorrect", "Error"); } return isInt; }
public PanelThreadManager() { try { Global.APP_NAME = ThreadConstant.APP_NAME; Global.APP_VERSION = ThreadConstant.APP_VERSION; jbInit(); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
public static Config getInstance() { if (instance == null) { try { props = new Properties(); props.load(new FileInputStream("C://workspace//onlinemerge//src//config.properties")); return new Config(); } catch (Exception e) { MessageBox.showMessage("Config file not found", "File not found", MessageBox.ERROR_MESSAGE); System.exit(-1); } } return instance; }
private void onClick() { try { DialogTabularParameter dlg = new DialogTabularParameter(cmpCaller, mbModal, mstrTitle, mvtDefinition, mvtValue); // DialogTableParameter dlg = new // DialogTableParameter(cmpCaller,mbModal,mstrTitle,mvtDefinition,mvtValue); WindowManager.centeredWindow(dlg); cmpCaller.repaint(); setValue(mvtValue); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
private void logIn(int personId) { Connection con = getConnect(); try { // MessageBox.infoBox("You have successfully logged in", "Login"); // INSERT INTO LogInOut (PersonId, TimeIn) VALUES (1, NOW()) String SQLLogin = "******" + personId + ", NOW())"; Statement stmtLogin = con.createStatement(); stmtLogin.executeUpdate(SQLLogin); Update_table(); } catch (SQLException err) { MessageBox.infoBox(err.toString(), "Error"); } closeConnect(); }
public boolean fillDatabase( String table_name, String table_column_giving1, Object row_element1, String table_column_giving2, Object row_element2, String table_column_need, Object update_element) { // if (checkDataAvailability("prcr_margin_dates", "month", st, "division", division, // "margin")) { // updateDatabase("prcr_margin_dates", "month", st, "division", division, // "total", workingdays); // updateDatabase("prcr_margin_dates", "month", st, "division", division, // "margin", Math.floor(workingdays * 0.75)); // } else { // dbm.insert("INSERT INTO prcr_margin_dates(month,division,margin,total) // VALUES('" + st + "','" + division + "','" + Math.floor(workingdays * 0.75) + "','" + // workingdays + "')"); // } // // // DatabaseManager dbm = DatabaseManager.getDbCon(); try { dbm.insert( "UPDATE " + table_name + " SET " + table_column_need + " ='" + update_element + "' where " + table_column_giving1 + " LIKE '" + row_element1 + "' AND " + table_column_giving2 + " LIKE '" + row_element2 + "'"); } catch (SQLException ex) { MessageBox.showMessage(ex.getMessage(), "SQL ERROR", "error"); return false; } return true; }
public void gotoverification() { try { this.m_collection = UareUGlobal.GetReaderCollection(); m_collection.GetReaders(); } catch (UareUException e1) { // TODO Auto-generated catch block JOptionPane.showMessageDialog(null, "Error getting collection"); return; } if (m_collection.size() == 0) { MessageBox.Warning("Reader is not selected"); return; } m_reader = m_collection.get(0); if (null == m_reader) { MessageBox.Warning("Reader is not selected"); } else { Verification.Run(m_reader, this.enrollmentFMD); } }
public void manageThreads() { try { DDTP request = new DDTP(); request.setRequestID(String.valueOf(System.currentTimeMillis())); DDTP response = channel.sendRequest("ThreadProcessor", "manageThreadsLoad", request); if (response != null) { DialogThreadManager dlg = new DialogThreadManager(this, channel, response.getVector("vtTableData")); dlg.setComboStartupType(response.getVector("vtStartupType"), ""); WindowManager.centeredWindow(dlg); } } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
private void manualOutActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_manualOutActionPerformed String strId = manualInput.getText(); if (isId(strId)) { int id = getId(); if (isIdFound(id)) { int personId = getPersonId(id); if (!isLoggedIn(id)) { MessageBox.infoBox("Error: Already Logged In", "Error"); } else { logOut(personId); manualInput.setText(""); } } } } // GEN-LAST:event_manualOutActionPerformed
public void loadThread(String threadID, String threadName, String threadStatus) { try { PanelThreadMonitor mntTemp = new PanelThreadMonitor(channel); int iThreadStatus = Integer.parseInt(threadStatus); mntTemp.setThreadID(threadID); mntTemp.setThreadName(threadName); mntTemp.setThreadStatus(iThreadStatus); mntTemp.addPropertyChangeListener(this); pnlThread.add(threadName, mntTemp); mntTemp.updateStatus(); Skin.applySkin(mntTemp); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
private synchronized void closeAll() { try { // Close all child window WindowManager.closeAll(); // Remove all child component pnlThread.setVisible(false); pnlUser.setVisible(false); pnlThread.removeAll(); clearAll(txtBoard); tblUser.setData(new Vector()); Thread.sleep(500); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
private void logOut(int personId) { Connection con = getConnect(); try { // MessageBox.infoBox("You have successfully logged out", "Logout"); // UPDATE LogInOut SET TimeOut = NOW() WHERE PersonId = 1 AND TimeOut IS NULL String SQLLogin = "******" + personId + " AND TimeOut IS NULL"; Statement stmtLogin = con.createStatement(); stmtLogin.executeUpdate(SQLLogin); Update_table(); } catch (SQLException err) { System.out.println(err); MessageBox.infoBox(err.toString(), "Error"); } closeConnect(); }
private boolean isLoggedIn(int id) { boolean isLoggedIn = false; Connection con = getConnect(); int personId = getPersonId(id); try { String SQL = "SELECT * FROM LogInOut WHERE personId = " + personId + " AND TimeOut IS NULL"; Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(SQL); if (rs != null && rs.next()) { rs.last(); isLoggedIn = true; } } catch (Exception err) { MessageBox.infoBox(err.toString(), "Error from isLoggedIn"); System.out.println(err); } closeConnect(); return isLoggedIn; // SELECT * FROM LogInOut WHERE personId = 1 AND TimeOut IS NULL }
public static int getPersonId(int id) { Connection con = getConnect(); ResultSet rs = null; int personId = 0; try { String SQL = "SELECT PersonId FROM 2761DB.Persons WHERE SchoolId = " + id; Statement stmt = con.createStatement(); rs = stmt.executeQuery(SQL); if (rs.next()) { rs.first(); personId = rs.getInt("PersonId"); } else { AddUserQuery addUserQuery = new AddUserQuery(); addUserQuery.setVisible(true); } } catch (Exception err) { MessageBox.infoBox(err.toString(), "Error in getPersonId"); } closeConnect(); return personId; }