NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
sheetal7sheetal
Joined: 03 Jul 2012 Posts: 1
|
Posted: Tue Jul 03, 2012 12:49 pm Post subject: JFRAME applet works when run directly but not in web broeser |
|
|
hey..I m using netbeans IDE 6.0.1 AND am trying to embed a jframe applet in the web project.I made a java project "Testing" and within it,a NewJFrame.java file with the following code:-
//made iN design mode....
package testing;
public class NewJFrame extends javax.swing.JFrame {
/** Creates new form NewJFrame */
public NewJFrame() {
initComponents();
}
private void initComponents() {
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("jButton1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(141, 141, 141)
.addComponent(jButton1)
.addContainerGap(186, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(130, 130, 130)
.addComponent(jButton1)
.addContainerGap(147, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
// End of variables declaration
}
..Then i made another web project "WebApplication2" and in index.jsp, i added within the body the following code:-
<applet code="testing.NewJFrame" archive="Testing.jar" codebase="." width=676 height=657></applet>
I also have included Testing.jar in "WebApplication2".But when i try to run index.jsp,
all the browsers give run time exception:-java.lang.reflect.InvocationTargetException/........
Although NewJFrame runs directly as applet.......but not in browser..kindly somebody help?
the thing is that wen i tried to do the same procedure with an applet which only displyed text "hello".........web browser showed the applet.but as soon as i add button or any such thing...it gives this exception........... |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|