• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

please help --applet not initialsed error

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please Use Code Tags. And please Ease Up.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the code posted does not profduce that error for me

but the error is self-explanatory
java.lang.IllegalArgumentException: invalid verticalScrollBarPolicy
 
sakshi saw
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic