Thread View: borland.public.jbuilder.java.api
2 messages
2 total messages
Started by lata
Tue, 22 Jun 2004 18:37
Frames and components
Author: lata
Date: Tue, 22 Jun 2004 18:37
Date: Tue, 22 Jun 2004 18:37
32 lines
1590 bytes
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
Re: Frames and components
Author: Tor Iver Wilhelmsen (TeamB)
Date: Tue, 22 Jun 2004 21:02
Date: Tue, 22 Jun 2004 21:02
16 lines
1237 bytes
1237 bytes
On 22 Jun 2004 11:37:08 -0700, lata <dprafullata@yahoo.com> wrote: > The following is my code - do i need to add anything to it Either move the fd.setVisible(true); *after* your code to add components, or add a fd.repaint(); at the end. -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads