• 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

i keep on seeing the console window and not the applet

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

  •  
    Marshal
    Posts: 79153
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    . . . 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
    Posts: 20
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Rancher
    Posts: 43081
    77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    //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
    Posts: 20
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 20
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Rancher
    Posts: 43081
    77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 20
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 20
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
     
    If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic