import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class First {
public static void main(String args[])
{
new First();
/* Opening Frame */
JFrame frame = new JFrame("Hello");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 150);
/* This resize to components inside the frame */
//frame.pack();
Container content = frame.getContentPane();
content.setBackground(Color.white);
content.setLayout(new FlowLayout());
content.add(new JTextArea("Welcome to My Java World !"));
content.add(new JTextField("Enetr text "));
content.add(new JButton("Click"));
//frame.addWindowListener(new ExitListener());
frame.setVisible(true);
}
//Constructor
public void First()
{
System.out.println(" Constructor hello ");
}
}
/*compile */
javac First.java && java First
/* creating exec jar.
copy con mainClass.txt
"Main-Class: First
jar cmfv mainClass.txt FistSwing.jar *.class *.java
/* execute jar */
java -jar FirstSwing.jar
/* Excute using Browser by adding below code in body*/
LessThan applet code="First" archive="FirstSwing.jar" GreaterThan
Lessthan Slash applet GreaterThan
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JFrame.html
http://www.javabeginner.com/java-addressbook.htm
http://www.beginner-java-tutorial.com/jtextarea.html
No comments:
Post a Comment