Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. public void actionPerformed(ActionEvent e) {
  2. String x = t1.getText();
  3. String y = t3.getText();
  4. String o = t4.getText();
  5. if (x.isEmpty()) {
  6. JOptionPane.showMessageDialog(TestFibMethodRange.this, "This field cannot be empty", "Required Field", JOptionPane.ERROR_MESSAGE);
  7. } else if (y.isEmpty()) {
  8. JOptionPane.showMessageDialog(TestFibMethodRange.this, "This field cannot be empty", "Required Field", JOptionPane.ERROR_MESSAGE);
  9. } else if (o.isEmpty()) {
  10. JOptionPane.showMessageDialog(TestFibMethodRange.this, "This field cannot be empty", "Required Field", JOptionPane.ERROR_MESSAGE);
  11. } else {
  12. if (isInteger(x) && isInteger(y) && isInteger(o)) {
  13. int min = Integer.valueOf(x);
  14. int max = Integer.valueOf(y);
  15. int nSequence = Integer.valueOf(o);
  16. for (int i = min; i <= nSequence; i++) {
  17. if (x3 <= max) {
  18. if (x3 >= min) {
  19. t2.setText(t2.getText() + " " + x3);
  20. }
  21. x1 = x2;
  22. x2 = x3;
  23. x3 = x1 + x2;
  24. }
  25. }
  26. }
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement