<meta name="keywords" content="Exenco,Expert Engineering Company,Industrial automation,Control System Solutions,,mechanical,Electrial,Instrumentation and Control SCADA,PLC,DCS,HMI Turnkey Projects, Brownfield Projects, Green Field projects, O&M Services, Opration Maintenance services, Site services"/> | |
<meta name="description" content="Exenco The Engineering Company for Industrial Automation and Engineering Solutions and services" /> |
Wednesday, 28 September 2011
Meta Tag
HTML Anchor Tag
<html>
<head>
<title>.:: Best Stories online ::. - BestStory.com</title>
</head>
<body>
<h1 align="center">Best Stories Online</h1>
<h2><marquee>www.beststory.com</marquee></h2>
<p>We have best stories for you. Please read...</p>
<h2><a name="topstory1">Story 1</a> :</h2>
<p>Once upon a time there was a king...
Once upon a time there was a king...
<a href="#story1">Read More</a></p>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
<h5><a name="story1"> Remaining Part Of Story 1 :</a></h5>
<p>He was very kind and best king. But he had no child</p>
<p><a href="#topstory1">Click here</a> to go on top of story 1.</p>
</body>
</html>
<head>
<title>.:: Best Stories online ::. - BestStory.com</title>
</head>
<body>
<h1 align="center">Best Stories Online</h1>
<h2><marquee>www.beststory.com</marquee></h2>
<p>We have best stories for you. Please read...</p>
<h2><a name="topstory1">Story 1</a> :</h2>
<p>Once upon a time there was a king...
Once upon a time there was a king...
<a href="#story1">Read More</a></p>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
<h5><a name="story1"> Remaining Part Of Story 1 :</a></h5>
<p>He was very kind and best king. But he had no child</p>
<p><a href="#topstory1">Click here</a> to go on top of story 1.</p>
</body>
</html>
Tuesday, 20 September 2011
Graphics Using ball
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Color;
import javax.swing.JFrame;
public class hellokid extends Frame{
int x=50;
int y=50;
int dx=1;
int dy=1;
public hellokid() {
setSize(800,600);
setVisible(true);
}@Override
public void paint (Graphics g) {
g.setColor(Color.black);
g.drawOval(x,y,200,200);
g.fillOval(x,y, 200,200);
super.paint(g);
x=x+dx;
y=y+dy;
if(x==500 && y==500){
x=50;y=50;
dx=1;
dy=1;
repaint();
}
repaint();
for(int a=1;a<20000000;a++){}
}
public static void main (String arg[])
{
hellokid w=new hellokid();
}
}
Interface using GUI Component in java for Database application
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Student{
Frame f=new Frame("student");
Panel p;
JLabel l,l1,l2,l3;
JTextField t,t1,t2,t3;
JButton b,b1,b2,b3,b4;//insert,update,record,find,delete
public Student(){
f.setLayout(null);
l=new JLabel("Roll No.");
l.setLayout(null);
l1=new JLabel("Student Name");
l1.setLayout(null);
l2=new JLabel("Address");
l2.setLayout(null);
l3=new JLabel("Course");
l3.setLayout(null);
l.setLocation(60,50);
l.setSize(60,20);
t=new JTextField();
t.setLocation(120,50);
t.setSize(100,20);
l1.setLocation(270,50);
l1.setSize(80,20);
t1=new JTextField();
t1.setLocation(380,50);
t1.setSize(100,20);
l2.setLocation(60,90);
l2.setSize(60,20);
t2=new JTextField();
t2.setLocation(120,90);
t2.setSize(100,20);
l3.setLocation(270,90);
l3.setSize(80,20);
t3=new JTextField();
t3.setLocation(380,90);
t3.setSize(100,20);
p=new Panel();
p.setLayout(null);
p.setLocation(0,170);
p.setSize(1024,70);
p.setBackground(Color.gray);
b=new JButton("add");
b.setLayout(null);
b.setLocation(50,10);
b.setSize(70,30);
b.setForeground(Color.blue);
b1=new JButton("update");
b1.setLayout(null);
b1.setLocation(130,10);
b1.setSize(90,30);
b1.setForeground(Color.blue);
b2=new JButton("search");
b2.setLayout(null);
b2.setLocation(230,10);
b2.setSize(100,30);
b2.setForeground(Color.blue);
b3=new JButton("delete");
b3.setLayout(null);
b3.setLocation(340,10);
b3.setSize(100,30);
b3.setForeground(Color.blue);
p.add(b);
p.add(b1);
p.add(b2);
p.add(b3);
f.add(l);
f.add(t);
f.add(l1);
f.add(t1);
f.add(l2);
f.add(t2);
f.add(l3);
f.add(t3);
f.add(p);
f.setSize(800,800);
f.setVisible(true);
}//end of constructor
public static void main(String m[]){
new Student();
}//end of main
}//end of class
Monday, 19 September 2011
how to connect with jdbc,odbc with access
import java.sql.*;
public class Test1
{
public static void main(String[] args)
{
try {
int rollno=240;
String name="Tahir";
String address="Lahore";
String course="Java";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:StudentDB");
Statement s = con.createStatement();
s.executeUpdate("insert into StudentTable(RollNo,StudentName,StudentAddress,StudentCourse)
values("+rollno+",'"+name+"','"+address+"','"+course+"')");
s.close();
con.close(); }
catch (Exception err) {
System.out.println("ERROR: " + err);
}
}
}
Friday, 16 September 2011
How to write in a File and Read from a File in Java
import java.io.*;
public class FileWriter{
public FileWriter(){
try{
FileOutputStream fos =new FileOutputStream("data.txt");
BufferedOutputStream bos= new BufferedOutputStream(fos);
DataOutputStream dos= new DataOutputStream(bos);
dos.writeUTF("Testing the file program");
dos.close();
fos.close();
FileInputStream fis =new FileInputStream("data.txt");
BufferedInputStream bis= new BufferedInputStream(fis);
DataInputStream dis= new DataInputStream(bis);
String s=dis.readUTF();
System.out.println(s);
dis.close();
fis.close();
}catch(Exception e){}
}//end of constrctr
public static void main(String m[]){
new FileWriter();
}//end of main
}//end of class
How to get Input in Java
import java.io.*;
public class GetUserInput {
public static void main (String[] args) {
System.out.print("Enter your name and press Enter:
");
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
String name = null;
try {
name = br.readLine();
} catch (IOException e) {
System.out.println("Error!");
System.exit(1);
}
System.out.println("Your name is " + name);
}
}
Subscribe to:
Posts (Atom)