Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mport java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.*;
- public class midtermWindow extends JFrame{
- private int WINDOW_WIDTH = 275;
- private int WINDOW_HEIGHT = 100;
- private JPanel panel;
- private JButton enterB;
- private JLabel inputL;
- private JTextField inputTF;
- public midtermWindow()
- {
- setTitle("Midterm");
- setSize(WINDOW_WIDTH,WINDOW_HEIGHT);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- buildPanel();
- add(panel);
- setVisible(true);
- }
- private void buildPanel()
- {
- JLabel inputL = new JLabel("Please enter earnings from sales: ");
- JTextField inputTF = new JTextField(10);
- JButton enterB = new JButton ("Enter");
- enterB.addActionListener(new buttonActionListener ());
- panel = new JPanel();
- panel.add(inputL);
- panel.add(inputTF);
- panel.add(enterB);
- }
- private class buttonActionListener implements ActionListener
- {
- @Override
- public void actionPerformed(ActionEvent e) {
- double salesInput;
- String input;
- input = inputTF.getText();
- JOptionPane.showMessageDialog(null, "This Works");
- }
- }
- }
Add Comment
Please, Sign In to add comment