/Users/lyon/j4p/src/classUtils/reflection/GuiForCompObj.java
|
1 //Ryan Metz
2
3
4 package classUtils.reflection;
5
6 import gui.run.RunList;
7 import gui.run.RunButton;
8
9 import javax.swing.*;
10 import java.awt.*;
11
12 public class GuiForCompObj {
13 private static Class classToBeComputed[];
14
15 public static void main(String args[]) {
16 FindCompObj.getCompObjList();
17 JFrame j = new JFrame();
18 j.setSize(500, 150);
19 j.getContentPane().setLayout(new BorderLayout());
20 j.getContentPane().add(getButtonPane(), BorderLayout.CENTER);
21 j.getContentPane().add(getClassListPane(), BorderLayout.NORTH);
22 j.show();
23 }
24
25 private static JPanel getClassListPane() {
26 JPanel jp = new JPanel();
27 jp.setLayout(new FlowLayout());
28 jp.add(new RunList(FindCompObj.getClassVector()) {
29 public void run() {
30 Object o[] = getSelectedValues();
31 classToBeComputed = new Class[o.length];
32 for (int i = 0; i < o.length; i++) {
33 classToBeComputed[i] = (Class) o[i];
34 }
35 }
36
37 });
38 return jp;
39 }
40
41 private static JPanel getButtonPane() {
42 JPanel jp = new JPanel();
43 jp.setLayout(new FlowLayout());
44 jp.add(new RunButton("Compute") {
45 public void run() {
46 for (int i = 0; i < classToBeComputed.length; i++) {
47 System.out.println(classToBeComputed[i].getName());
48 classUtils.reflection.CompObjClient coc = new classUtils.reflection.CompObjClient();
49 coc.setCo(classToBeComputed[i]);
50 coc.run();
51 }
52 }
53 });
54 return jp;
55 }
56 }
57