standalone application samples

Where can I get standalone application samples (not applets) of Java programs?I don't need web servers or word processors, but simple small programs such as games for example...thank you.
[209 byte] By [Vanjaa] at [2007-10-2 0:59:07]
# 1
Just google on e.g what you want.. e.g: battleship java http://www.cs.princeton.edu/academics/ugradpgm/spe/summer04/chwillia//Kaj
kajbja at 2007-7-15 18:19:19 > top of Java-index,Java Essentials,New To Java...
# 2

yet, not what I was having in mind..

I'm an experienced MS Visual Basic developer and I can find tons of directories hosting source codes for simple applications (eg. planet-source-code.com).

Whenever I try looking something like that for Java, all I can find are applets but no standalone applications...

Vanjaa at 2007-7-15 18:19:19 > top of Java-index,Java Essentials,New To Java...
# 3

> yet, not what I was having in mind..

What did you have in mind then?

> I'm an experienced MS Visual Basic developer and I

> can find tons of directories hosting source codes for

> simple applications (eg. planet-source-code.com).

I don't see the relation between experienced MS Visual Basic and people who find tons of directories hosting source codes for simple applications.

> Whenever I try looking something like that for Java,

> all I can find are applets but no standalone

> applications...

Then you're not looking hard enough. The link Kaj posted is no applet.

prometheuzza at 2007-7-15 18:19:19 > top of Java-index,Java Essentials,New To Java...
# 4

Copied the following app from http://java.sun.com/docs/books/tutorial/uiswing/

/**

* CelsiusConverter.java is a 1.4 application that

* demonstrates the use of JButton, JTextField and

* JLabel. It requires no other files.

*/

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class CelsiusConverter implements ActionListener {

JFrame converterFrame;

JPanel converterPanel;

JTextField tempCelsius;

JLabel celsiusLabel, fahrenheitLabel;

JButton convertTemp;

public CelsiusConverter() {

//Create and set up the window.

converterFrame = new JFrame("Convert Celsius to Fahrenheit");

converterFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

converterFrame.setSize(new Dimension(120, 40));

//Create and set up the panel.

converterPanel = new JPanel(new GridLayout(2, 2));

//Add the widgets.

addWidgets();

//Set the default button.

converterFrame.getRootPane().setDefaultButton(convertTemp);

//Add the panel to the window.

converterFrame.getContentPane().add(converterPanel, BorderLayout.CENTER);

//Display the window.

converterFrame.pack();

converterFrame.setVisible(true);

}

/**

* Create and add the widgets.

*/

private void addWidgets() {

//Create widgets.

tempCelsius = new JTextField(2);

celsiusLabel = new JLabel("Celsius", SwingConstants.LEFT);

convertTemp = new JButton("Convert");

fahrenheitLabel = new JLabel("Fahrenheit", SwingConstants.LEFT);

//Listen to events from the Convert button.

convertTemp.addActionListener(this);

//Add the widgets to the container.

converterPanel.add(tempCelsius);

converterPanel.add(celsiusLabel);

converterPanel.add(convertTemp);

converterPanel.add(fahrenheitLabel);

celsiusLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));

fahrenheitLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));

}

public void actionPerformed(ActionEvent event) {

//Parse degrees Celsius as a double and convert to Fahrenheit.

int tempFahr = (int)((Double.parseDouble(tempCelsius.getText()))

* 1.8 + 32);

fahrenheitLabel.setText(tempFahr + " Fahrenheit");

}

/**

* Create the GUI and show it. For thread safety,

* this method should be invoked from the

* event-dispatching thread.

*/

private static void createAndShowGUI() {

//Make sure we have nice window decorations.

JFrame.setDefaultLookAndFeelDecorated(true);

CelsiusConverter converter = new CelsiusConverter();

}

public static void main(String[] args) {

//Schedule a job for the event-dispatching thread:

//creating and showing this application's GUI.

javax.swing.SwingUtilities.invokeLater(new Runnable() {

public void run() {

createAndShowGUI();

}

});

}

}

Good luck.

prometheuzza at 2007-7-15 18:19:19 > top of Java-index,Java Essentials,New To Java...
# 5
Have you put any thought into which IDE you plan to use?The reason I say that is, if you are familiar with Visual Studio,you may want to consider Eclipse. Once you do that, there are tons of examples and you will get lots of experience in keeping "up to date." (;-))
WmFay1a at 2007-7-15 18:19:19 > top of Java-index,Java Essentials,New To Java...
# 6
Runnable example sitewww.java2s.com
yinpeng265a at 2007-7-15 18:19:19 > top of Java-index,Java Essentials,New To Java...
# 7
I think you intended to create executable.Then one way is to create executable jar. read http://java.sun.com/docs/books/tutorial/deployment/jar/and then use JRE to run this jar.Or you can use tools like Visual Cafe, from Symantec which will create .exe
devendra.vyavaharea at 2007-7-15 18:19:19 > top of Java-index,Java Essentials,New To Java...