NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

JFRAME applet works when run directly but not in web broeser

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
sheetal7sheetal



Joined: 03 Jul 2012
Posts: 1

PostPosted: Tue Jul 03, 2012 12:49 pm    Post subject: JFRAME applet works when run directly but not in web broeser Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo