This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Applets and the fly likes DRAW A NEW LINE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Applets
Bookmark "DRAW A NEW LINE " Watch "DRAW A NEW LINE " New topic


Zahid, Butt
Ranch Hand

Joined: Feb 16, 2001
Posts: 100
Hi all,
I am new to designing applets.
This is a simple question, How do you cause a line space in an applet. I tried System.out.println but this doesnt work.
I want a radio group to start in a new line.
here is my code:
import java.awt.*;
import java.applet.Applet;
public class myapplet1 extends Applet {
public void init() {
TextField t = new TextField("Default Data");
Button b = new Button("Click");
Checkbox c = new Checkbox("Select", false);
//I want the line space here
CheckboxGroup group = new CheckboxGroup();
Checkbox g1 = new Checkbox("1",false,group);
Checkbox g2 = new Checkbox("2",false,group);
Checkbox g3 = new Checkbox("3",true,group);
If there are any problems with the code that you can notice please DO tell me.
Thanks in advance.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

The default layout of an Applet is FlowLayout. This makes all components added to it line up like words in a sentence until one hits the edge of the screen. Then it starts over far enough down to put space between the components. One thing you could do is set your applet's layout to GridLayout... if you specify one column and as many rows as you have components they will all line up one above the other.
If you have a complex layout in mind, you will have to create a layout for your applet, then add components to panels with layouts of their own... you can nest other panels within these panels too if you want...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: DRAW A NEW LINE
jQuery in Action, 3rd edition