private void addItem() { if (!searchName.getText().isEmpty() && !item.getText().isEmpty()) { try { Main.setItem( searchName.getText(), "http://www.reddit.com/r/hardwareswap/search?q=" + item.getText() + "&sort=new&restrict_sr=on"); results.setText("Current Items"); displayInformation(); } catch (IOException e1) { e1.printStackTrace(); } searchName.setText(""); item.setText(""); } else { results.setText("Please provide all info for Item Name, Keyword, and Website"); } }
private void removePhone() { String s = JOptionPane.showInputDialog("Index of cell phone to be removed."); try { int index = Integer.parseInt(s) - 1; Main.removePhone(index); saveCurrent(); displayInformation(); } catch (NumberFormatException nfe) { results.setText("Please type in the index number of the cell phone."); } }
private void addPhone() { if (phone.getText().length() == 10) { if (carriers.getSelectedIndex() == 0) { Main.addPhone(phone.getText() + "@txt.att.net"); } if (carriers.getSelectedIndex() == 1) { Main.addPhone(phone.getText() + "@myboostmobile.com"); } if (carriers.getSelectedIndex() == 2) { Main.addPhone(phone.getText() + "@mobile.celloneusa.com"); } if (carriers.getSelectedIndex() == 3) { Main.addPhone(phone.getText() + "@messaging.nextel.com"); } if (carriers.getSelectedIndex() == 4) { Main.addPhone(phone.getText() + "@tmomail.net"); } if (carriers.getSelectedIndex() == 5) { Main.addPhone(phone.getText() + "@txt.att.net"); } if (carriers.getSelectedIndex() == 6) { Main.addPhone(phone.getText() + "@email.uscc.net"); } if (carriers.getSelectedIndex() == 7) { Main.addPhone(phone.getText() + "@messaging.sprintpcs.com"); } if (carriers.getSelectedIndex() == 8) { Main.addPhone(phone.getText() + "@vtext.com"); } if (carriers.getSelectedIndex() == 9) { Main.addPhone(phone.getText() + "@vmobl.com"); } displayInformation(); phone.setText(""); carriers.setSelectedIndex(0); } else { results.setText("Please add 10 digit cell number."); } }