public UpdateAssetGUI() { try { PluginMgrClient.init(); mclient = new MasterMgrClient(); queue = new QueueMgrClient(); plug = PluginMgrClient.getInstance(); log = LogMgr.getInstance(); pAssetManager = new TreeMap<String, AssetInfo>(); project = "lr"; charList = new TreeMap<String, String>(); setsList = new TreeMap<String, String>(); propsList = new TreeMap<String, String>(); potentialUpdates = new TreeSet<String>(); pSubstituteFields = new TreeMap<String, LinkedList<JBooleanField>>(); /* load the look-and-feel */ { try { SynthLookAndFeel synth = new SynthLookAndFeel(); synth.load( LookAndFeelLoader.class.getResourceAsStream("synth.xml"), LookAndFeelLoader.class); UIManager.setLookAndFeel(synth); } catch (java.text.ParseException ex) { log.log( LogMgr.Kind.Ops, LogMgr.Level.Severe, "Unable to parse the look-and-feel XML file (synth.xml):\n" + " " + ex.getMessage()); System.exit(1); } catch (UnsupportedLookAndFeelException ex) { log.log( LogMgr.Kind.Ops, LogMgr.Level.Severe, "Unable to load the Pipeline look-and-feel:\n" + " " + ex.getMessage()); System.exit(1); } } /* application wide UI settings */ { JPopupMenu.setDefaultLightWeightPopupEnabled(false); ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); } } catch (PipelineException ex) { ex.printStackTrace(); } // end try/catch } // end constructor
public ReverseFlashCard() { // basic init setTitle("WayMemo -Reverse Flash Card Mode"); this.setSize(800, 600); paneCenter = new JPanel(new GridLayout(7, 1)); add(ln, "North"); add(paneCenter, "Center"); add(b2, "West"); add(bReset, "South"); add(b1, "East"); paneCenter.add(l1); paneCenter.add(l2); paneCenter.add(l3); paneCenter.add(l4); paneCenter.add(l5); paneCenter.add(b3); paneCenter.add(pMark); pMark.add(bMark); pMark.add(bUnMark); pMark.add(lt); // text area init Utility.initTextAreaView(l1); Utility.initTextAreaView(l2); Utility.initTextAreaView(l3); Utility.initTextAreaView(l4); Utility.initTextAreaView(l5); // action // Action actionNext = new AbstractAction() { public void actionPerformed(ActionEvent e) { num++; wordDisplay(); } }; b1.getInputMap().put(KeyStroke.getKeyStroke("C"), "pressed"); b1.getActionMap().put("released", actionNext); // Action actionBack = new AbstractAction() { public void actionPerformed(ActionEvent e) { num--; wordDisplay(); } }; b2.getInputMap().put(KeyStroke.getKeyStroke("Z"), "pressed"); b2.getActionMap().put("released", actionBack); // Action actionShow = new AbstractAction() { public void actionPerformed(ActionEvent e) { l1.setText(dtr[num]); l3.setText(d2[num]); l4.setText(d3[num]); l5.setText(d4[num]); } }; b3.getInputMap().put(KeyStroke.getKeyStroke("X"), "pressed"); b3.getActionMap().put("released", actionShow); // // Action actionMark = new AbstractAction() { public void actionPerformed(ActionEvent e) { d1[num] = "[MARKED*]" + d1[num]; l2.setText(d1[num]); } }; bMark.getInputMap().put(KeyStroke.getKeyStroke("S"), "pressed"); bMark.getActionMap().put("released", actionMark); // // // Action actionUnmark = new AbstractAction() { public void actionPerformed(ActionEvent e) { d1[num] = od1[num]; l2.setText(d1[num]); } }; bUnMark.getInputMap().put(KeyStroke.getKeyStroke("F2"), "pressed"); bUnMark.getActionMap().put("released", actionUnmark); // // Action actionReset = new AbstractAction() { public void actionPerformed(ActionEvent e) { num = 0; wordDisplay(); } }; bReset.getInputMap().put(KeyStroke.getKeyStroke("r"), "pressed"); bReset.getActionMap().put("released", actionReset); // // b1.setMnemonic(KeyEvent.VK_C); b2.setMnemonic(KeyEvent.VK_Z); b3.setMnemonic(KeyEvent.VK_X); bMark.setMnemonic(KeyEvent.VK_S); bUnMark.setMnemonic(KeyEvent.VK_D); bReset.setMnemonic(KeyEvent.VK_R); b1.addActionListener(actionNext); b2.addActionListener(actionBack); b3.addActionListener(actionShow); bReset.addActionListener(actionReset); bMark.addActionListener(actionMark); bUnMark.addActionListener(actionUnmark); // // try { this.fileScan(new OpenFileDTR().getPathDTR()); } catch (IOException e) { } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public Atm() // constructor // sets the customer array to that found in the file if the file exists { try { // Set cross-platform Java L&F (also called "Metal") UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } if (logFile.exists()) { try { adminLogs = returnLog("p2.log"); if (!adminLogs.isEmpty()) { // there may be customer data but perhaps no transactions yet. ArrayList<Integer> allTransactions = new ArrayList<>(100); for (AdminLog a : adminLogs) { int transaction = a.getTransactionID(); ; allTransactions.add(transaction); } transaction_counter = Collections.max(allTransactions) + 1; } } catch (ClassNotFoundException | IOException e) { e.printStackTrace(); } } if (DBfile.exists()) { try { cust = returnSavedData("p2.dat"); // sets the starting ID to the max of all the IDs stored in the file. allIDs = new ArrayList<Integer>(100); ArrayList<Integer> allAccounts = new ArrayList<>(); for (Customer customer : cust) { String idString = customer.returnID(); int id = Integer.parseInt(idString); allIDs.add(id); int accountNumber = customer.returnMaxAccount(); allAccounts.add(accountNumber); } // checks to see if the customer has even made any accounts, if not, max accounts will be // set at 1001 if (starting_account_number != 1) { starting_account_number = Collections.max(allAccounts) + 1; } starting_customer_number = Collections.max(allIDs) + 1; } catch (ClassNotFoundException | IOException e) { e.printStackTrace(); } } else { cust = new ArrayList<>(100); // creates the file if it does not exist try { saveFile(cust, DBfile); } catch (IOException e) { e.printStackTrace(); } } interest_rate = 5; }