Java Questions

Stabering

Solid State Member
Messages
8
I just took a course on HTML, Javascript, and Java programming and I am now studying on my own.

I was just wondering if Java can be used outside of it's little cmd box, because thats all i can seem to do with it.

When i compile and use on JCreator it opens a little black cmd box and runs it there, but i want it to do other stuff, like open other programs on my computer or open a webpage... ANYTHING BUT THAT LITTLE BLACK BOX!

Going insane...

Stabering
 
ah Jcreator, pain in the butt if you ask me, but it works.

The "black box" is a Java application. If you want to have like a normal window, you want an applet. Off hand I don't remember how to set that up.
 
There are some good documents and code chucks that kind of show you how to make some apps. here is a link. www.java.sun.com

and click on documents or tutorials under resources, that can help you, and same here with me i havent used java in about 6 months, and all my files i had stored on my flash driver got wiped, and made me mad.
 
Is it possible to like make a file that when its run it opens other files? Or does that what App does..?
 
app means application. you can write a HTML file that you load in your web browser and then it will load up the game in in the browser and you can play it that way, no sure about it opening other files, was never taught that.



sorry i miss spoke there, an application is that black screen you are talking about a applet is what you want here is a small chunk of code that is pretty much the Hello world thing for applets


Code:
/* The HelloWorld class implements an applet that
   displays "Hello World!" within an XHTML document. */
import java.awt.*; import java.applet.*;
public class HelloWorld extends Applet
{
  public void init()  // Initialize the canvas
  {
    Color lightgray=new Color(211,211,211); // customize
    setBackground(lightgray);  // make mellow background
    resize(150,10);
  }
  public void paint(Graphics g)  // Display Hello World!
  {
    g.drawString("Hello World!",50,25);
  }
}




this is a section of code you can use to load or play the applet in a web browser, save it as a HTML file in the same folder as your project or give the right directory to find it in.


Code:
<applet code="HelloWorld.class" codebase="javaProj/" height="70"
  width="300" <param name="image" value="anintro.jpg"></param>
  Your browser does not support Java!</applet>

but that looks different than how i used to type them.
 
Back
Top Bottom