Hi thomas et al; I thought I'd just take this opportunity, since the matter of coding ease has come up lately, with people not understanding code and feeling it's too complex or such, to send along the simplest of java Hello World apps to go with the more complex window-based app.
The below code will also print Hello World! to the screen, but in a terminal or command line environment, rather than in a window. // Define the class public class Hello { // main routine for running the program public static void main(String[] args) { // do the actual printing System.out.println("Hello World!"); } // end main } // end class So that's all there is to it!… If you wanted to, you could even put all this on one line of code, as in: public class Hello{public static void main(String[] args) {System.out.println("Hello World!");}} But the previous way above is much, much better and easier to read. Of course, you may, as I do, prefer the window approach, but this is a very basic and easy way of doing this kind of app. HOpe this makes sense and hope you all are having a wonderful day!… Smiles, Cara :) . On Apr 8, 2008, at 2:48 PM, Thomas Ward wrote: > Hi Louis, > No problem. Below is a simple Java swing application that draws a > 300 by > 300 window and displays a graphic with hello world in the center. This > should hopefully be simple enough for your needs. > /* > * Hello World. > * Version 1.0. > * Written by Thomas Ward. > * Last updated April 8, 2008. > */ > > // Import packages and classes. > import java.awt.*; > import java.awt.event.*; > import javax.swing.*; > > public class Hello extends JFrame implements KeyListener { > > // Hello class constructor. > // Initializes the Hello class, > // and creates the main window frame. > public Hello() { > > // Setup application window. > super("Hello World!"); > setSize(300, 300); > > // Set close operation. > setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); > > // Set the window focus. > setFocusable(true); > > // Make the Window visible. > setVisible(true); > > // Add keyboard listener > // to poll for keyboard input. > addKeyListener(this); > } > > // Key pressed event. > // Checks to see if any keys are being held down. > public void keyPressed(KeyEvent key) { > > // Was the escape key pressed? > // If so exit hello world. > if (key.getKeyCode() == KeyEvent.VK_ESCAPE) { > System.exit(0); > } > } > > public void keyReleased(KeyEvent key) {} > > public void keyTyped(KeyEvent key) {} > > // Paint Hello world to the screen. > public void paintComponent(Graphics graphic) { > graphic.drawString("Hello, world!", 125, 95); > } > > // Main method. > // Initializes the application. > public static void main (String[] args) { > new Hello(); > } > } > > > [EMAIL PROTECTED] wrote: >> Hi Thomas, Could you possibly send me your Hello World program? I am >> interested and want to see what Java looks like, and compare it to >> the >> versions that claim to support Symbian. Thanks. >> > > > --- > Gamers mailing list __ Gamers@audyssey.org > If you want to leave the list, send E-mail to [EMAIL PROTECTED] > . > You can make changes or update your subscription via the web, at > http://audyssey.org/mailman/listinfo/gamers_audyssey.org. > All messages are archived and can be searched and read at > http://www.mail-archive.com/[EMAIL PROTECTED] > If you have any questions or concerns regarding the management of > the list, > please send E-mail to [EMAIL PROTECTED] --- View my Online Portfolio at: http://www.onemodelplace.com/CaraQuinn --- Gamers mailing list __ Gamers@audyssey.org If you want to leave the list, send E-mail to [EMAIL PROTECTED] You can make changes or update your subscription via the web, at http://audyssey.org/mailman/listinfo/gamers_audyssey.org. All messages are archived and can be searched and read at http://www.mail-archive.com/[EMAIL PROTECTED] If you have any questions or concerns regarding the management of the list, please send E-mail to [EMAIL PROTECTED]