//awt programs
import java.awt.Component; //paint(),show()
import java.awt.Graphics; //drawString()
import java.awt.Frame; //setVisible()
import java.awt.Dimension;//setSize()
class Ex extends Frame
{
public Ex()
{
setSize(200,700);
// show();
setVisible(true);
}
public void paint(Graphics g)
{
g.drawString("Welcome", 100,500);
}
}
public class First
{
public static void main(String ar[])
{
Ex e=new Ex();
// e.paint(5);
}
}
/*
E:\raj\java\awt>javac First.java
Note: First.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
E:\raj\java\awt>java First
*/
/*
public class Frame extends Window implements MenuContainer
{
//A Frame is a top-level window with a title and a border.
}
public class Dimension extends Dimension2D implements Serializable
{
int height,width;
void setSize(int width, int height)
{
//Sets the size of this Dimension object to the specified width and height.
}
}
public abstract class Component extends Object implements ImageObserver, MenuContainer, Serializable
{
//it is used to display the window on the screen with buttons
static float BOTTOM_ALIGNMENT;
static float CENTER_ALIGNMENT;
static float LEFT_ALIGNMENT;
static float RIGHT_ALIGNMENT;
static float TOP_ALIGNMENT;
public void show() or boolean setVisible(boolean a)
{
// Deprecated. As of JDK version 1.1, replaced by setVisible(boolean).
}
public void paint(Graphics g)
{
// Paints this component.
// Dynamically calculate size information
Dimension size = getSize();
// diameter
int d = Math.min(size.width, size.height);
int x = (size.width - d)/2;
int y = (size.height - d)/2;
// draw circle (color already set to foreground)
g.fillOval(x, y, d, d);
g.setColor(Color.black);
g.drawOval(x, y, d, d);
}
}
public abstract class Graphics extends Object
{
protected Graphics()
{
}
abstract void drawString(String str, int x, int y)
{
String str;
int x,y; //coordinates
// Draws the text given by the specified
// string, using this graphics context's current font and color.
}
public class Container extends Component
{
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT,
LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
boolean action(Event evt, Object what)
{
}
}
public interface Accessible
{
AceesibleContext getAccessibleContext()
{
}
}
public class Window extends Container implements Accessible
{
}
public class Frame extends Window implements MenuContainer
{
---
---
}
*/