What I have is a basic window with 2 buttons on it: Get Values and Start. When the 'get values' button is clicked, I want the getInput(); method to run, causing 2 pop up windows to appear, asking for 2 numeric values. I am currently trying to get it so that the getInput(); method runs when I click the button.
This is my code for the relevant methods so far (the name of the class is mainGui):
public static boolean getInputs = false; public mainGui() { getValues = new JButton("Get Values"); start = new JButton("Start"); add(start); add(getValues); } public void populateWindow(){ setLayout(new FlowLayout()); //Creating a test text area. //JComponent comp = new JTextField(); getValues.addActionListener(this); start.addActionListener(this); //Create content pane mainGui newContentPane = new mainGui(); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); } public void actionPerformed(ActionEvent e) { getInputs = true; }
If you need any more code, then just ask.