Monday, May 7, 2007

How will you add a panel to a frame?

Here goes the snippet:

import javax.swing.*;

public class XYZ extends JFrame{

public XYZ(){

JPanel panel =new JPanel();

this.getContentPane().add(panel);

}

public static void main (String args[]){

XYZ obj=new XYZ();

obj.setVisible(true);

}

}

0 comments :

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2017. Reads: best tracker