Sunday, January 30, 2011

Java applet Tutorial Website

Java Tutorial applet

Java Applet Tutorial

This tutorial will take you step by step through the process of building applets. I have chosen for a Learn-By-Example method, the fastest way to learn.
You will not learn the "Why" but the "How". Throughout the java tutorial all new lines of code are explained, the ones you have already seen aren't commented anymore.
Within a few minutes you will be able to display things on the screen, a few minutes later you are able to use a GUI and after that you wil see how to interact with the user.

next topic is coding using java applet

Sunday, December 5, 2010

Tuesday, November 30, 2010

Using File Stream and JOptionPane in java

import java.io.*;
import javax.swing.JOptionPane;

public class sample
{
public static void main(String args[])
{
try
{

PrintWriter pw=null;
String n1,n2;
String filename="C:\\jpcezar\\out.txt";
n1=JOptionPane.showInputDialog("Enter you Name:");
n2=JOptionPane.showInputDialog("Enter you Address:");

boolean apend=true;
if(apend)
{
pw=new PrintWriter(new FileWriter(filename,true));
}
else
{
pw=new PrintWriter(new FileWriter(filename,false));
}

pw.println("My Name is:" + n1);
pw.println("My Address is:" + n2);

JOptionPane.showMessageDialog(null,"Successfully save ");

pw.close();
pw.flush();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"File not found"));
}

}
}