Tuesday, January 4, 2011

Drop Table

select * from table1;
drop table table1; 
select * from table1;



This message Shown Because Table1 deleted from database.

RadioButton

import java.awt.*;
import javax.swing.*;

class Radiobutton extends JFrame
{
 JRadioButton first,second,third,fourth,fifth;
 Radiobutton()
 {    
     first = new JRadioButton("First");
     second = new JRadioButton("Second");
     third = new JRadioButton("Third");
     fourth = new JRadioButton("Fourth");
     fifth = new JRadioButton("Fifth");
    
     //Add on Frame
     add(first);
     add(second);
     add(third);
     add(fourth);
     add(fifth);
  
     ButtonGroup bg = new ButtonGroup();
     bg.add(first);
     bg.add(second);
     bg.add(third);
     bg.add(fourth);
     bg.add(fifth); 
 }
  
 public static void main(String[] args) 
 {
     JFrame win = new Radiobutton();
  
     win.setTitle("Radiobutton");
     win.setSize(400,100);
     win.setLayout(new FlowLayout());
     win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     win.setVisible(true);
 }  
}


Output

CheckBox


import javax.swing.*;

class CheckBox extends JFrame
{
    JCheckBox ch1,ch2,ch3,ch4;
 
 CheckBox()
 {    
     ch1=new JCheckBox("Cricket",false);
     ch2=new JCheckBox("Football",false);
     ch3=new JCheckBox("Baseball",false);
     ch4=new JCheckBox("Swimming",false);  
     add(ch1);add(ch3);add(ch4);add(ch2);  
 }
  
 public static void main(String[] args) 
 {
     JFrame win = new CheckBox();
   
     win.setTitle("CheckBox");
     win.setSize(400,100);
     win.setLayout(new FlowLayout());
     win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     win.setVisible(true);
 }  
}


Output

Saturday, January 1, 2011

Add Label

import javax.swing.*;

class Label extends JFrame
{
   JLabel l;
 
   Label()
   {    
       add(l=new JLabel("Have a Nice Day"));
       l.setBounds(30,60,100,20);
   }
  
   public static void main(String[] args) 
   {
      JFrame win = new Label();
   
      win.setTitle("Label");
      win.setSize(200,200);
      win.setLayout(null);
      win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      win.setVisible(true);
   }  
}

Output

Create Button on Frame

import javax.swing.*;

class Button extends JFrame
{
   JButton b1;
 
   Button()
   {    
      add(b1=new JButton("ok"));
      b1.setBounds(60,60,50,50);
   }
  
   public static void main(String[] args) 
   {
      JFrame win = new Button();
   
      win.setTitle("Button");
      win.setSize(200,200);
      win.setLayout(null);
      win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      win.setVisible(true);
   }  
}

Output