File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes please help --applet not initialsed error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "please help --applet not initialsed error" Watch "please help --applet not initialsed error" New topic
Author

please help --applet not initialsed error

sakshi saw
Greenhorn

Joined: Jun 06, 2009
Posts: 6
please guide for the following error
applet not initialsed.


i have pasted mycode below

package mypack;

import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class NewJApplet extends JApplet {

/**
* Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init() {
// JFrame MyFrame=new JFrame("COMPONENT DISPLAYER");
Mypanel jp=new Mypanel();
// add(MyFrame);
add(jp);
// TODO start asynchronous download of heavy resources
}

// TODO overwrite start(), stop() and destroy() methods

}
package mypack;

import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.JPanel;

/**
*
* @author
*/
public class Mypanel extends JPanel{

private MyScrollPane scroll;

public Mypanel() {

setBorder(BorderFactory.createLineBorder(Color.BLACK));
scroll=new MyScrollPane();
add(scroll);

}


}

package mypack;
import java.awt.Color;
import javax.swing.*;
/**
*
* @author
*/
public class MyScrollPane extends JScrollPane{

public MyScrollPane() {
super();
// super(VERTICAL_SCROLLBAR_ALWAYS,HORIZONTAL_SCROLLBAR_ALWAYS);
setBackground(Color.BLUE);
}


}


the output is below-

java.lang.IllegalArgumentException: invalid verticalScrollBarPolicy
at javax.swing.JScrollPane.setVerticalScrollBarPolicy(JScrollPane.java:466)
at javax.swing.JScrollPane.<init>(JScrollPane.java:258)
at javax.swing.JScrollPane.<init>(JScrollPane.java:304)
at mypack.MyScrollPane.<init>(MyScrollPane.java:16)
at mypack.Mypanel.<init>(Mypanel.java:23)
at mypack.NewJApplet.init(NewJApplet.java:24)
at sun.applet.AppletPanel.run(AppletPanel.java:380)
at java.lang.Thread.run(Thread.java:595)
BUILD SUCCESSFUL (total time: 2 seconds)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Please Use Code Tags. And please Ease Up.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
the code posted does not profduce that error for me

but the error is self-explanatory
java.lang.IllegalArgumentException: invalid verticalScrollBarPolicy
sakshi saw
Greenhorn

Joined: Jun 06, 2009
Posts: 6
sir please i have not been able to solve the problem i went through JScrollPane constructos i dont think the mistake is here!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you are even told what line the error occurs
at mypack.MyScrollPane.<init>(MyScrollPane.java:16)

and, by counting the lines of what you posted, line 16 is a blank line.
so you haven't posted the real code, meaning you'll have to find the problem for yourself
sakshi saw
Greenhorn

Joined: Jun 06, 2009
Posts: 6
sir i have pasted the whole code i even tried to to debug it using watches it gets stuck after
super()

Sir i am new to it and i am seriously confused i have even removed the line add(scroll);
from constructor
btw was it correct to place it there becuse panel has not been constructed fully and i was adding it
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
I just tried it again (all files in a single .java file) and it compiled and ran without error.

all I can suggest is you try to compile MyScrollPane() on it's own, then read and follow the error message/s
 
 
subject: please help --applet not initialsed error
 
Similar Threads
Sub JPanel Size
JList in JScrollPane
How to Add Graphics to Jpanel
Adding JPanel to JFrame
Simple GUI program: changing color of a panel.