Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.util.Arrays;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JScrollPane;
- import javax.swing.JTextArea;
- public class testing extends JFrame implements ActionListener
- {
- private JTextArea taResultArea;
- private JComboBox cIndexchoice;
- private JButton Start;
- public testing()
- {
- setSize(700, 700);
- setLayout(null);
- taResultArea = new JTextArea();
- taResultArea.setEditable(false);
- taResultArea.setBounds(300, 15, 350, 600);
- add(taResultArea);
- Start = new JButton("Run Simulation");
- setLayout(null);
- Start.setBounds(20, 500, 150, 50);
- // adding buttons to the main window
- add(Start);
- Start.addActionListener(this);
- String[] listOfElements = { "AAA", "BBB", "CCC" };
- cIndexchoice = new JComboBox(listOfElements);
- cIndexchoice.setBounds(20, 50, 100, 20);
- add(cIndexchoice);
- cIndexchoice.addActionListener(this);
- }
- public static void main(String[] args)
- {
- testing window = new testing();
- window.setVisible(true);
- }
- @Override
- public void actionPerformed(ActionEvent e)
- {
- if (e.getSource() == Start)
- {
- String[] AAA = { "A", "AA", "AAA", "AAAA", "AAAAA", "AAAAAA" };
- String[] BBB = { "B", "BB", "BBB", "BBBB", "BBBBB", "BBBBBB" };
- String[] CCC = { "C", "CC", "CCC", "CCCC", "CCCCC", "CCCCCC" };
- SectorSelected ole = new SectorSelected(cIndexchoice
- .getSelectedItem().toString(), BBB);
- String[] lista = ole.getListOfEntities();
- System.out.println(Arrays.toString(lista));
- for (int i = 0; i < AAA.length; i++)
- {
- taResultArea.append(AAA[i] + "\n");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment