• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help in this

 
Sheng Ning
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi any idea why this cant work ?]
cant seem to run it or did i use the wrong way to run applets ?
enlighten me please
thks
import javax.swing.JOptionPane;
public class Trial extends javax.swing.JFrame {
public Trial() {
initComponents();
}
private void initComponents() {
jButton1 = new javax.swing.JButton();
getContentPane().setLayout(new java.awt.FlowLayout());
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
jButton1.setText("Hit me!");
jButton1.setToolTipText("");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
handler(evt);
}
});
getContentPane().add(jButton1);
pack();
}
private void handler(java.awt.event.ActionEvent evt) {
java.util.Random r=new java.util.Random();
JOptionPane.showMessageDialog(null,r.nextInt(99999)+" "+r.nextInt(45234));
}
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}
public static void main(String args[]) {
new Trial().show();
}
private javax.swing.JButton jButton1; }
 
eammon bannon
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you are trying to run is not an Applet. Can you explain in what way it isn't working?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic