I made a simple code that creates a form with a Textbox and a button and an ActionListener
that make a message of the Textbox show when pressing the button. it works on eclipes but when i converting
it to a jar the form open but when i press on the buttn Nothing Happens...
This is my code:
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class hello { public static void main(String args[]){ final JTextField Textbox = new JTextField(16); JFrame frame = new JFrame("Java app"); JButton button = new JButton("Send Command"); JPanel panel = new JPanel(); panel.add(button); panel.add(Textbox); frame.add(panel); frame.setSize(500, 400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ JOptionPane.showMessageDialog(null, Textbox.getText()); } }); } }
how can i fix it?