Guest User

Untitled

a guest
Apr 4th, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. import java.awt.event.ActionEvent;
  2. import java.awt.event.ActionListener;
  3. import java.util.Arrays;
  4.  
  5. import javax.swing.JButton;
  6. import javax.swing.JComboBox;
  7. import javax.swing.JFrame;
  8. import javax.swing.JScrollPane;
  9. import javax.swing.JTextArea;
  10.  
  11. public class testing extends JFrame implements ActionListener
  12. {
  13.  
  14. private JTextArea taResultArea;
  15. private JComboBox cIndexchoice;
  16. private JButton Start;
  17.  
  18. public testing()
  19. {
  20. setSize(700, 700);
  21. setLayout(null);
  22. taResultArea = new JTextArea();
  23. taResultArea.setEditable(false);
  24. taResultArea.setBounds(300, 15, 350, 600);
  25. add(taResultArea);
  26.  
  27. Start = new JButton("Run Simulation");
  28. setLayout(null);
  29. Start.setBounds(20, 500, 150, 50);
  30. // adding buttons to the main window
  31. add(Start);
  32. Start.addActionListener(this);
  33.  
  34. String[] listOfElements = { "AAA", "BBB", "CCC" };
  35. cIndexchoice = new JComboBox(listOfElements);
  36. cIndexchoice.setBounds(20, 50, 100, 20);
  37. add(cIndexchoice);
  38. cIndexchoice.addActionListener(this);
  39.  
  40. }
  41.  
  42. public static void main(String[] args)
  43. {
  44. testing window = new testing();
  45. window.setVisible(true);
  46.  
  47. }
  48.  
  49. @Override
  50. public void actionPerformed(ActionEvent e)
  51. {
  52. if (e.getSource() == Start)
  53. {
  54. String[] AAA = { "A", "AA", "AAA", "AAAA", "AAAAA", "AAAAAA" };
  55. String[] BBB = { "B", "BB", "BBB", "BBBB", "BBBBB", "BBBBBB" };
  56. String[] CCC = { "C", "CC", "CCC", "CCCC", "CCCCC", "CCCCCC" };
  57.  
  58. SectorSelected ole = new SectorSelected(cIndexchoice
  59. .getSelectedItem().toString(), BBB);
  60. String[] lista = ole.getListOfEntities();
  61.  
  62. System.out.println(Arrays.toString(lista));
  63. for (int i = 0; i < AAA.length; i++)
  64. {
  65. taResultArea.append(AAA[i] + "\n");
  66. }
  67. }
  68.  
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment