Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. public String highestBid(String paintingID) {
  2. int x = 1;
  3. int count = 0;
  4. try {
  5. for (Bid b : bid) {
  6. if (paintingID.equals(b.getPaintingID())) {
  7. x = b.getPrice();
  8. count++;
  9. }
  10. }
  11. } catch (Exception ex) {
  12. return ex.getMessage();
  13. }
  14. if (count == 0) {
  15. return "n" + "Invalid Painting ID. There is no Painting with this ID!";
  16. } else {
  17. return paintingID;
  18. }
  19. }
  20.  
  21. public void actionPerformed(ActionEvent e) {
  22. if (e.getSource() == tfPid)
  23. taText.setText("");
  24. String paintingID = tfPid.getText();
  25. taText.setText(taText.getText()+a.highestBid(paintingID));
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement