/Users/lyon/j4p/src/ip/gui/dialog/DoubleLog.java
|
1 package ip.gui.dialog;
2
3 import java.awt.*;
4
5 public class DoubleLog extends
6 ExpandoLog {
7
8 private String defaultStr[];
9
10 public DoubleLog(
11 Frame frame,
12 String title,
13 String prompts[],
14 String defaults[],
15 int fieldSize) {
16 super(frame, title, prompts, defaults, fieldSize);
17 }
18
19 public static void main(String args[]) {
20 String title = "Double Dialog";
21 int fieldSize = 6;
22 String prompts[] = {
23 "X (degs):",
24 "Y (degs):",
25 "Z (degs):"
26 };
27
28 String defaults[] = {
29 "1.0",
30 "2.0",
31 "3.0"
32 };
33
34 DoubleLog dl = new
35 DoubleLog(
36 new Frame(),
37 title,
38 prompts,
39 defaults,
40 fieldSize);
41
42 }
43
44 public double[] getUserInputAsDouble() {
45 String userInput[] = super.getUserInput();
46 double dui[] = new double[userInput.length];
47 int i = 0;
48 try {
49 for (i = 0; i < userInput.length; i++) {
50 Double d = Double.valueOf(userInput[i]);
51 dui[i] = d.doubleValue();
52 }
53 } catch (NumberFormatException e) {
54 MessLog ml =
55 new MessLog(
56 null,
57 "Input Error:",
58 "Could not convert to Double");
59 }
60 return dui;
61 }
62
63 }
64