I can't use swing components in my applets

When I write an applet without any swing components, my browser never has any trouble finding the classes it needs, whether they're classes I've written or classes that came with Java. However, when I try to use swing components it cannot find them, because it is looking in the wrong place:
On my computer I have a directory called C:\Java, into which I installed my Java Development Kit (so Sun's classes are stored in the default location within that directory, wherever that is), and I store my classes in C:\Java\Files\[path depends on package]. My browser gives an error message along the lines of "Cannot find class JFrame at C:\Java\Files\javax\swing\JFrame.class"; it shouldn't be looking for this non-existent directory, it should find the swing components where it finds, for example, the Applet class and the Graphics class.
Is there any way I can set the classpath on my browser? Are the swing components stored separately from other classes (I'm using the J2SE v1.3)?
Thanks in advance.

Without having complete information, it appears that you are running your applets using the browser's VM. Further, I assume you are using either IE or Netscape Navigator pre-v6. In that case, your browser only supports Java 1.1, and Swing was implemented in Java 1.2. You need to use the Java plug-in in order to use the Swing classes (see the Plug-in forum for more information), or else download the Swing classes from Sun and include them in your CLASSPATH.
HTH,
Carl Rapson

Similar Messages

  • Can I Use Swing Components in a JSP Page

    Hi,
    Can I use Swing Componnents in a JSP Page.If so,Can anybody provide with a sample code.
    Thanks.

    hi,
    I wanted to use the JTabbedPane for tab buttons in my
    Jsp Page.Is that possible?I am afraid that you can't.
    As for GUI (graphics) in the HTML page you can use only the html form elements (but you should simulate other behaviours by dynamically reloading the page).-
    Ionel.

  • New - can't use Swing components????

    I downloaded jdk-1_1_8_009-win.exe and installed and I'm merrily learning Java - except I don't have the javax.swing.* classes in this download (when I look in \lib\classes.zip).
    I have repeatedly tried downloading the SDK 1.3.1 and Java Foundation Classes (JFC), but all I get is Page Not Found over and over.
    This is getting freaking frustrating. What am I supposed to do? All I'm trying to do is create a JFrame with a JButton, and continue from there. Why isn't the Swing stuff in their latest JDK download?
    Thanks for reading a dumb question from a beginner!

    Why isn't the Swing stuff in their latest JDK download?It is! The problem is that you downloaded an obsolete JDK version (1.1.8), and javax.swing did not appear until version 1.2.
    What am I supposed to do? Download the lastest version of the SDK.
    http://java.sun.com/j2se/1.4/download.html

  • Can i use swing under JSP?

    i have a JSP, now my question is, can I display swing components under JSP?

    A JSP is just a way to write HTML back to browser.
    It is a mix of HTML and java.
    A JSP is converted to a java source file, with code like:
    out.println(".... HTML code you wrote ...");In this way a java application writes back to the client browser on a page request.
    A totally different mechanism are either a java applet (embedded in an HTML page),
    or Java WebStart, which distributes entire java applications via the net.
    If you are familiar with Swing, or have an existing Swing application, or need a
    user friendly GUI, those are the ways.

  • How to add swing components in an applet

    hello friends;
    I encounterd one problem that is I created one applet which I derived from JApplet and now I want to add some swing components to that applet. I added them properly and when I am testing my applet in Appletviewer it is working fine but when I tested it in internet explorer it is not working. Please help me overcome this problem
    Thanks in advance.
    Amit

    IE does not support swing if you do not have the java-plugin installed. Either install that, then IE can display Swing components - or use AWT which can be displayed by IE.
    cheers,
    kelysar

  • How can i understand swing components?

    hi
    i am tonmoy. i have some question about swing component
    i,e JTextField,JListBox JTable etc.
    1. i have made a class name StyledDOcument extends
    DefaultStyledDocument so i can access any public method of
    DefaultStyledDocument. but my problem is that i cannot understand
    which method is implicitly called and whcih are not.
    for example InsertString(int offs, String str, AttributeSet a)
    is internally called because if i dont override it or call it using
    super.insertstring(), it will be called internally everytime i press
    char from keybord.
    so i think there are many method of swing components that are called
    internally but by reading java doc i can't understand
    which method is internally called and which are not.
    so plese answer my questions in details.
    thank you

    Tutorials, Teachers, and books are all good ways to learn these things.

  • Using Swing Components in JSP

    Hi,
    I regret that I do not have a very specific problem here. However, I am wondering if there is a way to display Swing components, such as a panel, on a web page using JSP. If so, are there any tutorials on such a practice? Or would something like this be included in a general tutorial?
    Thanks,
    Dan

    You'll have to use a JApplet.

  • How to use Swing Components in  JavaFX

    Hi All,
    I am new to JavaFx. I am trying to use java swing components in javafx.
    I found a sample program in net and tried it. But it shows compile time error.
    Code:
    MySwingComponent .fx
    import javafx.ext.swing.SwingComponent;
    import javax.swing.JComponent;
    import javax.swing.JButton;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    * @author nandha
    class MySwingComponent extends SwingComponent{
    var button: JButton;
    public var text: String on replace {
    button.setText(text);
    public var action: function();
    override protected function createJComponent () : JComponent {
    button = new JButton();
    button.addActionListener(ActionListener {
    public override function actionPerformed(e:ActionEvent){
    action();
    return button;
    The above code shows no error.
    Test SwingButton.fx
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import swingcomponents.MySwingButton;
    * @author nandha
    Stage {
    title: "Swing Button Example"
    scene: Scene {
    width: 250
    height: 80
    content: [
    MySwingButton{  // error message: imcompatible type. found MySwingButton. Required javafx.scene.Node[]
    text: "Click Me!"
    action: function(){
    println("Hello World!");
    This code which used the MySwingButton shows error: imcompatible type. found MySwingButton. Required javafx.scene.Node[] - where i have added the MySwingButton.
    Please help me to fix the error.
    Thanks &Regards,
    Nandha K

    Hi Sasa,
    First thanks for your reply.
    I found the problem and have fixed.
    Problem:
    There is no class MySwingButton in the package swingcomponents. Its MySwingComponent that i should have used, which is a big mistake that i have done. To my surprise i don't know NetBeans didn't show any error message at that line.
    Thanks & Regards,
    Nandha K

  • How to implement hyperlink in java using swing components

    hi.....
    pls help me to find out solution
    how to implement hyperlink in java using swing components

    I've got the same problem here.
    I want to implement a HyperlinkListener to a JLabel. (Unlike suggested above, it is only supported by JEditorPane and not JLabel)
    The goal is, that if a user clicks on a Link in a JLabel, the standard browser opens and displays that page.
    Can somebody please help?
    My ultimate goal would be to also be able to add clickable HyperLinks in ToolTip texts, but i guess that'd be even more complicated.

  • Can't use Swing in my java application

    I installed J2SE 5 Update 4 on my machine and was trying my hands on creating GUI using swing. I kept getting the error message: "Package javax,swing not found in import".
    I have the statement: import javax.swing.*; in my code so I don't what to do again.
    Thanks

    I think your best bet is to try uninstalling and installing Java again. Your problem could be something small, however you wull eaist less time to re-install everything, then to try searching for the problem.
    btw-What Development tool do you use? Just in case you may try to check whether it could be a problem of the ide (It should not be however), just check with another Ide, and see if the same happens. If yes, then follow my first advise, I think it would take you less time.

  • Newbie Q: How can I use swing on a Mac

    Can anyone tell me how I can get the swing class libraries installed on my Macintosh? According to the MRJ 2.2.5 (Macintosh Runtime for Java) this is compatible with Swing 1.1.1. But where do I get the class library and where do I put it when I have got it. The only info I have is to see:
    http://java.sun.com
    Well here I am.
    Anyone got any ideas.
    Thanks.

    Here:
    http://java.sun.com/products/jfc/download.archive.html

  • Can i use flex components in flash?

    hi all,
    i recently downloaded flex and saw that the components have a
    much better feel than the components which ship with flash 8 pro.
    is there a way to use flex components in flash?
    any help would be appreciated.
    thanks,
    gaurav

    "rritchey" <[email protected]> wrote in
    message
    news:g8ua6d$qu6$[email protected]..
    > bump: Was I not clear in my question? Or does no-one
    know the answer?
    You might want to try in the flexCoders Yahoo! group.

  • Not getting swing components when the applet reloads

    I am facing one problem that is related to reloading of swing components. I Have a JPanel inside JApplet which contains some swing components and a button to launch the same JPanel again in the JApplet. When I click on the button the JPanel should get added in the JApplet once again below the upper JPanel. But new JPanel is not getting displayed although the reference of the new JPanel is created.

    My guess is that you haven't added your swing components to the right place. Are you adding them to the contentpane?

  • Can I use Swing controls with Forms 9i?

    Is there a way to use Java Swing controls with Forms 9i via a PJC or something? If so, is there a white paper on it? Thanks.

    Yes you can. There is a quick start about PJC here:
    http://otn-stage.us.oracle.com/products/forms/htdocs/upgrade/pjc/content.html
    And there is also a paper about Forms in the Java World that you should read.
    http://otn.oracle.com/products/forms/pdf/forms_in_java_world.pdf
    You might want to have a look at the Oracle9i Forms Demos for some code samples as well.

  • How can I use ms components in a computer without the setup of ms?

    I writed a program with the use of the ms components in computer which set up the ms, but now when i generate the exe , and i want to use it in a computer without the ms , how could i do ?? thanks !

    Hi SijinK,
    Iam also facing similar problem.
    When I try to run my CAN application on a system on which NI-CAN s/w is not installed. It gives the error
    "Application failed to initialize properly (0xc0000142)" [error message is attached]. I included all the NI-CAN DLL's[list got using the Depends utility] under my application setup [built using InstallShield V10.0]. It copies the DLL's to the C:\winnt\system32 directory.
    Am I missing any step like registering the DLL's, etc.
    Can you/anyone please help ...
    Thanks in advance
    Vinayak
    Attachments:
    CanAppErrMsg.bmp ‏191 KB

Maybe you are looking for