aboutsummaryrefslogtreecommitdiff
path: root/src/TableSetter.java
blob: efa1bdd0a3fa0adf81532de179b59ebaafdbc239 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*    */ import java.awt.FlowLayout;
/*    */ import java.awt.Toolkit;
/*    */ import java.awt.event.ActionEvent;
/*    */ import java.awt.event.ActionListener;
/*    */ import javax.swing.BoxLayout;
/*    */ import javax.swing.JButton;
/*    */ import javax.swing.JFrame;
/*    */ import javax.swing.JLabel;
/*    */ import javax.swing.JPanel;
/*    */ import javax.swing.JTextField;
/*    */ 
/*    */ public class TableSetter extends JFrame
/*    */   implements ActionListener
/*    */ {
/*    */   private JButton OK;
/*    */   private JButton cancel;
/*    */   private ActionListener flg;
/*    */   private JPanel main;
/* 19 */   private JTextField[] fields = { 
/* 20 */     new JTextField(5), 
/* 21 */     new JTextField(5) };
/*    */ 
/* 23 */   private JLabel[] lbls = { 
/* 24 */     new JLabel("TblStart"), 
/* 25 */     new JLabel("TblStep") };
/*    */ 
/*    */   public TableSetter(ActionListener caller, String[] originals)
/*    */   {
/* 28 */     this.flg = caller;
/* 29 */     this.OK = new JButton("Set");
/* 30 */     this.cancel = new JButton("Cancel");
/* 31 */     for (int i = 0; (i < originals.length) && (i < this.fields.length); i++) {
/* 32 */       this.fields[i].setText(originals[i]);
/*    */     }
/* 34 */     this.OK.addActionListener(this);
/* 35 */     this.cancel.addActionListener(this);
/* 36 */     this.main = new JPanel();
/* 37 */     this.main.setLayout(new BoxLayout(this.main, 1));
/*    */ 
/* 39 */     for (int i = 0; i < this.fields.length; i++) {
/* 40 */       JPanel temp = new JPanel(new FlowLayout());
/* 41 */       temp.add(this.lbls[i]);
/* 42 */       temp.add(this.fields[i]);
/* 43 */       this.main.add(temp);
/*    */     }
/*    */ 
/* 46 */     JPanel temp = new JPanel(new FlowLayout());
/* 47 */     temp.add(this.OK);
/* 48 */     temp.add(this.cancel);
/* 49 */     this.main.add(temp);
/* 50 */     add(this.main);
/* 51 */     setIconImage(Toolkit.getDefaultToolkit().getImage("modulus_symbol.png"));
/* 52 */     pack();
/*    */   }
/*    */ 
/*    */   public String[] getText() {
/* 56 */     return new String[] { 
/* 57 */       this.fields[0].getText(), 
/* 58 */       this.fields[1].getText() };
/*    */   }
/*    */ 
/*    */   public void actionPerformed(ActionEvent e) {
/* 62 */     if (e.getSource() == this.OK) {
/* 63 */       e.setSource(this);
/* 64 */       this.flg.actionPerformed(e);
/*    */     }
/* 66 */     setVisible(false);
/*    */   }
/*    */ }

/* Location:           Modulus.jar
 * Qualified Name:     TableSetter
 * JD-Core Version:    0.6.2
 */