Panel Control

Panel Control - Panel is called as the group of controls.


 import java.awt.*;


class panelc

{


panelc()

{

   Frame f1 = new Frame();


  Panel p1 = new Panel();

  

  //setting the property of Panel[Changing BackGround Color]

  p1.setBackground(Color.yellow);

 

  //set the properties (left,top,width,height)

  p1.setBounds(40,80,200,200);


  Button b1 = new Button("click me");


  //set the properties

  b1.setBounds(50,100,80,30);


  //set the background color of Button

  b1.setBackground(Color.red);


  //add button to panel

  p1.add(b1);


  //add panel to the Frame

  f1.add(p1);


//set properties of frame

 f1.setSize(500,500);


 f1.setLayout(null);


 f1.setVisible(true);


}


public static void main(String args[])

{

  panelc pl1 = new panelc();

}

}

Comments

Popular posts from this blog

Creating button control

Creating Control Programs