Click here to read the Tutorial 1 o...' />
  FREE tutorial,solution,RSS Feeds on Operating Systems, Programming, Web Development, Applications, Databases, Networking, Hardware, Security, SEO Free Expertsforge Membership
Join us as Moderator
Submit Article to Expertsforge.com Submit Article My Expertsforge
 
RSS Feeds, Help Help RSS Feeds
bannertop
 

Java Tutorial: Java Basic Programs Part II

gravikumar
2/11/2005 5:00:03 PM, Views: 2156
Java basic programs part II is the continuation of the Part 1 of Java basic Programs. Click here to read the Tutorial 1 of Java Basic Programs

Sample Java Basic Program: 4

/* awttest.java - shows the appearance of the awt componenets, and demonstrates how the layout manager arranges components.*/

import java.applet.applet;
import java.awt.*;

//awttest class
public class awttest extends applet
{
public awttest ()   
   {
   super ();
   setsize (300, 300);
   setlayout (new flowlayout());
   add (new button ("button"));
   add (new label ("label"));
   choice choice = new choice ();
   choice.additem("choice");
   add (choice);
   list list = new list ();
   list.add("list item 1");
   list.add("list item 2");
   add (list);
   canvas canvas = new canvas();
   canvas.setsize (50, 50);
   add (canvas);
   add (new checkbox ("checkbox"));
   textarea textarea = new textarea ("textarea", 5, 30);
   add (textarea);
   textfield textfield = new textfield ("textfield");
   add (textfield);
   }
}


Sample Java Basic Program: 5

button1.java -a program that creates a button

import java.applet.applet;
import java.awt.*;

public class button1 extends applet
{
public button1()
   {
   button mybutton = new button ("click me");
   add (mybutton);
   }
}


Sample Java Basic Program: 6

// button1.java - a program that creates a button

import java.applet.applet;
import java.awt.*;

public class button2 extends applet
{
public button2()
   {
   for (int i = 0; i < 5; i++)
      {
      button mybutton = new button ("click me");
      add (mybutton);
      }
   }
}
Next Steps:
Add this Tutorial to:
Blink Blink del.icio.ous Del.icio.us Digg Digg
Fark Fark Furl Furl Google Google
Reddit Reddit Simpy Simpy Spurl Spurl
Technorati Technorati Windows Live Win Live Yahoo Yahoo
Rate Me!
Avg Visitor Rating: Average Visitor Rating is 1 out of 5
Number of Ratings : 1 Votes
Rate:
Send Private MessageSend Message
Signup / Login To View the Solution or Provide Comments
Post Comment/Solution
Comment:*
        (Link Rules) 
  Use : [bold] for <b>; [/bold] for </b>; [italic] for <i>; [/italic] for </i>; [code] & [/code] for code
 
Categories
Options
Java RSS Feed
gravikumar
Most Popular Tutorial
Most Popular Solution
Top Rated
Top Rankers
Overall
1. jawahar (250)
2. gravikumar (200)
Yearly -2008
No Rankings!
Expertsforge Sponsors
bnrtop