• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Adding a new text Field in a new line in a Applet

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to add a new field in a applet, however i want it to appear in a new line.
I found out to add a new field, but dont know how to add it in a new line
The following is the code snippet:

public void init() {
try {
jbInit();
myDate = new MyDate();
this.setBackground(Color.gray); // Set background color to blue.
this.setForeground(Color.black); // Set foreground color to white.
this.setLayout (new BorderLayout ());
Panel p = new Panel ();
p.setLayout (new FlowLayout (FlowLayout.LEFT));



/*this.setBackground(Color.green); // Set background color to blue.
this.setForeground(Color.black); // Set foreground color to white.
this.setLayout(new FlowLayout()); // Set flow style.
execute_button = new Button ("Validate Date");
add (execute_button);*/

// Create input label and text field.
input_label = new Label("Day:");
day = new TextField(2);
p.add(input_label);
p.add(day);
p.add(input_label);
p.add(day);

input_label = new Label("Month:" );
month = new TextField(2);
p.add(input_label);
p.add(month);
p.add(input_label);
p.add(month);

execute_button = new Button ("Validate Date");
add (execute_button);

input_label = new Label("Day2:");
day2 = new TextField(2);
p.add(input_label);
p.add(day2);
p.add(input_label);
p.add(day2);

this.add ("North", p);
output = new TextArea (10, 60);
this.add ("Center", output);

} catch (Exception e) {
e.printStackTrace();
}
}


Could anyone let me know about it?

Thanks
Alex
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Recommended reading
http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic