🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #163

Frames and components

#163
From: lata
Date: Tue, 22 Jun 2004 18:37
32 lines
1590 bytes
I am trying to add labels, textbox and button to a frame but it wont appear on the frame until i resize the frame. what wld be the reason. The following is my code - do i need to add anything to it

import java.awt.*;
import java.awt.*;

public class FrameDemo extends Frame{
	public static void main(String args[]){
		FrameDemo fd = new FrameDemo();
		Panel p = new Panel();

		 fd.setSize(400,400);
		fd.setVisible(true);
		fd.setTitle("Frame Demo");
		fd.setBackground(Color.red);
		fd.setForeground(Color.blue);

        fd.setLayout(new FlowLayout());

		Label lb = new Label("TEXT");
		p.add(lb);
		Button bt = new Button("Push me");
		p.add(bt);
		TextField tf = new TextField("Type here",20);
		p.add(tf);
		p.setVisible(true);

		fd.add(p);

	}
}

thanks
Technical Details
Message-ID: <40d87c54$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,c979e8b3d06486e9,start
X-Google-Attributes: gid1089d0,public
From:     lata <dprafullata@yahoo.com>
Newsgroups: borland.public.jbuilder.java.api
X-Newsreader: AspNNTP 1.50 (aewnet.com)
Subject: Frames and components
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 63.161.67.199
Message-ID: <40d87c54$1@newsgroups.borland.com>
Date: 22 Jun 2004 11:37:08 -0700
X-Trace: newsgroups.borland.com 1087929428 63.161.67.199 (22 Jun 2004 11:37:08 -0700)
Lines: 32
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail