aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes i keep on seeing the console window and not the applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "i keep on seeing the console window and not the applet" Watch "i keep on seeing the console window and not the applet" New topic
Author

i keep on seeing the console window and not the applet

natasha henry
Greenhorn

Joined: Apr 12, 2007
Posts: 20
hey its me again-pretty gurl ghettoslim..i have another problem that doesn't really involve the issue of functionality but is rather a problem of my applet not showing. i know about the<html> <applet code=.........></applet> etc. to create an html so that the applet can be loaded. the only problem is that my java software-shelly cashman, doesn't have a JCreator or other feature that enables one to convert such a file to html. it has a more convenient feature but one that i cannot quite understand. whenever you go the the newoption there is the applet icon to pick from and this automatically creates something like(for example):

applet.WelcomeApplet.html
WelcomeApplet.java

however the only one that can be edited is WelcomeApplet.java
In this class i have the constructors and methods but i cannot compile this to produce an onscreen interface. therefore i go for the tester/sub-class WelcomeWindow but for me to do that i have to go through the same process like with the WelcomeApplet in creating a class. therefore in essence i have:

applet.WelcomeApplet.html
applet.WelcomeWindow.html
WelcomeApplet.java
W elcomeWindow.java

and still the same problem!!!

HERE IS THE CODE



TESTER CLASS

i accented out the bulk of these lines bcuz i don't understand them...these automatically opened with both applet classes upon just starting...could these be the key? the codes that i have before and after these lines is what i compile
/*public class WelcomeWindow extends {
boolean isStandalone = false;

//Construct the applet
public WelcomeWindow() {
}

//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}

//Component initialization
private void jbInit() throws Exception {
this.setSize(new Dimension(400,300));
}

//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}

//Get parameter info
public String[][] getParameterInfo() {
return null;
}
// static initializer for setting look & feel
static {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
}
catch (Exception e) {}
}

} */




[ April 12, 2007: Message edited by: natasha henry ]
[ April 13, 2007: Message edited by: natasha henry ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42944
    
  68
Welcome to JavaRanch. A couple of random observations:

  • I don't think you need WelcomeWindow in your applet. It looks like a class you'd use if you wanted to run the code as an application (not an applet).
  • You're using "==" to compare strings, which generally won't work. Use the "equals" method that can be used with a String object.
  • As it is, the code is basically unreadable: UseCodeTags
  • For further help, post the HTML file that shows the applet (just the relevant parts, of course), and what your directory layout is (i.e., which files are where). What happens if you open the HTML file in a browser?

  • Campbell Ritchie
    Sheriff

    Joined: Oct 13, 2005
    Posts: 40052
        
      28
    . . . and you don't need JCreator to create an html file. You can do it in an ordinary text editor.

    You can download all the software you need, Java, JCreatorLE, IDEs, Java API documentation, Java specifications, etc., from the net.


    And you don't have to pay a penny for it.
    natasha henry
    Greenhorn

    Joined: Apr 12, 2007
    Posts: 20
    HEY PEEPS-I'M BACK TO MY APPLET NOW
    i am reposting the code and i have editted it, making a few changes and hoping that it is more readable and easier to work with now
    i have been receiving a few error messages and they have been indicated below.



    [ April 13, 2007: Message edited by: natasha henry ]
    [ April 13, 2007: Message edited by: natasha henry ]
    Ulf Dittmer
    Marshal

    Joined: Mar 22, 2005
    Posts: 42944
        
      68
    //I AM GETTING THE ERROR MESSAGE HERE SAYING ILLEGAL START OF EXPRESSION


    You can't define a method inside of another method. This code needs to be outside of the init method.
    natasha henry
    Greenhorn

    Joined: Apr 12, 2007
    Posts: 20
    THANK YOU DITTMER THAT MADE SOME DIFFERENCE BUT SEE IF YOU CAN DIRECT YOUR ATTENTION TO THE IF PART OF THE CODE-I HAVE INDICATED A RECURRING ERROR MSG

    natasha henry
    Greenhorn

    Joined: Apr 12, 2007
    Posts: 20
    ANOTHER THING-I HAVE BEEN TRYING FOR THE LONGEST WHILE TO RUN THE APPLET TAG THAT IS IN AN HTML FILE BUT I JUST SEE THE WORDS AND NOT THE APPLET. IF MY BROWSER IS NOT JAVA ENABLED HOW DO I MAKE IT LIKE THAT?
    COULD YOU DO A TEST RUN FOR ME AND TELL ME WHAT EXACTLY I AM TO DO?



    TANKS A WHOLE HEAP MAN!!!
    Ulf Dittmer
    Marshal

    Joined: Mar 22, 2005
    Posts: 42944
        
      68
    Please, KeepItDown.

    Just to point out the obvious, but this code doesn't do anything:
    if("OK".equals(event.getActionCommand()))
    usernameField.getSelectedText();
    passwordField.getSelectedText();
    }


    String comparison is done using the equals method, not using "=" or "==":

    if (usernameField.getSelectedText()=string2 && passwordField.getSelectedText()=string1)


    As to running the applet, what does the applet tag look like, and where are the various applet files, i.e. what is the directory layout?
    [ April 14, 2007: Message edited by: Ulf Dittmer ]
    natasha henry
    Greenhorn

    Joined: Apr 12, 2007
    Posts: 20
    oh! sorry if i gave the wrong impression with the all caps

    that tip really worked though-thank you

    the applet is located in: "G ocuments\Display\Runprogram"

    my applet tag is:

    <applet
    codebase="."
    code="Runprogram.Welcome.class"
    width="250"
    height="250"
    >
    </applet>


    [ April 15, 2007: Message edited by: natasha henry ]

    [ April 15, 2007: Message edited by: natasha henry ]
    [ April 15, 2007: Message edited by: natasha henry ]
    natasha henry
    Greenhorn

    Joined: Apr 12, 2007
    Posts: 20
    mr dittmer because of the question of time
    i simply am going to resort to creating an application of this program instead of running it as an applet.
    thank you for your time
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: i keep on seeing the console window and not the applet