Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void actionPerformed(ActionEvent e) {
- String x = t1.getText();
- String y = t3.getText();
- String o = t4.getText();
- if (x.isEmpty()) {
- JOptionPane.showMessageDialog(TestFibMethodRange.this, "This field cannot be empty", "Required Field", JOptionPane.ERROR_MESSAGE);
- } else if (y.isEmpty()) {
- JOptionPane.showMessageDialog(TestFibMethodRange.this, "This field cannot be empty", "Required Field", JOptionPane.ERROR_MESSAGE);
- } else if (o.isEmpty()) {
- JOptionPane.showMessageDialog(TestFibMethodRange.this, "This field cannot be empty", "Required Field", JOptionPane.ERROR_MESSAGE);
- } else {
- if (isInteger(x) && isInteger(y) && isInteger(o)) {
- int min = Integer.valueOf(x);
- int max = Integer.valueOf(y);
- int nSequence = Integer.valueOf(o);
- for (int i = min; i <= nSequence; i++) {
- if (x3 <= max) {
- if (x3 >= min) {
- t2.setText(t2.getText() + " " + x3);
- }
- x1 = x2;
- x2 = x3;
- x3 = x1 + x2;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement