| 1 | package tax; |
| 2 | |
| 3 | import javax.swing.JButton; |
| 4 | import javax.swing.JFrame; |
| 5 | import javax.swing.JOptionPane; |
| 6 | |
| 7 | public class TaxApp { |
| 8 | |
| 9 | public static void main(final String[] args) { |
| 10 | final JFrame parent = new JFrame(); |
| 11 | JButton button = new JButton(); |
| 12 | |
| 13 | button.setText("Button text"); |
| 14 | parent.add(button); |
| 15 | parent.pack(); |
| 16 | parent.setVisible(true); |
| 17 | |
| 18 | button.addActionListener(new java.awt.event.ActionListener() { |
| 19 | @Override |
| 20 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
| 21 | String name = JOptionPane.showInputDialog(parent, |
| 22 | "Prompt", null); |
| 23 | } |
| 24 | }); |
| 25 | } |
| 26 | |
| 27 | } |