Page 202 - CITS - CSA - TP (Volume 2) - Hindi
P. 202
कं ूटर सॉ वेयर ए ीके शन - CITS
अ ास 116 : े म ास का उपयोग करके और द ू सरे े म ास का ए ट ड करके एक सरल कं टेनर
बनाएं (Create a simple container using Frame class and extending another
Frame class)
उ े
इस अ ास के अंत म आप यह कर सक गे
• े म ास का उपयोग करके एक सरल कं टेनर बनाने और दू सरे े म ास का िव ार करने के िलए जावा ो ाम डेवलप कर
आव कताएं (Requirements)
उपकरण/साम ी (Tools/Materials)
• िवंडोज OS वाला PC/लैपटॉप
• SDK सॉ वेयर
• टे एिडटर (िवजुअल ू िडयो/सबलाइम/नोटपैड)
ि या (Procedure)
टा 1: िसंपल े म : एक लेबल के साथ एक सरल ािफ़कल िवंडो ( े म)
import java.awt.Frame;
import java.awt.Label;
public class SimpleContainer extends Frame {
public SimpleContainer(String title) {
// Call the constructor of the superclass (Frame) with the specified title
super(title);
// Create a label to add to the frame
Label label = new Label(“Hello, I’m a simple container!”);
// Add the label to the frame
add(label);
// Set the size of the frame
setSize(300, 200);
// Make the frame visible
setVisible(true);
}
188

