Please send questions to
st10@humboldt.edu .
/**
* TryNoLayout1
*
* a simple JApplet that uses hardcoded layout
*
* Modified from class NullLayoutPane, in Flanagan's
* "Java Examples in a Nutshell", 2nd Edition, pp. 198-199
*
* RECOMMENDED SIZE: 300h x 400w
*
* modified by: Sharon M. Tuttle
* last modified: 2-26-01
**/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TryNoLayout1 extends JApplet
{
Container myContentPane;
public void init()
{
JButton paneButton;
JPanel panePanel;
Box topRowBox, bottomRowBox;
JPanel colPanel;
Box fixedColBox, fixedRowBox;
JTextArea textArea;
myContentPane = getContentPane();
// this is how you get RID of the default layout manager!
// (remember: set layout for the CONTENT PANE;)
myContentPane.setLayout(null);
// "create some buttons and set their sizes and positions
// explicitly" --- but, remember, what if fonts differ on
// different platforms? etc.
for (int i=0; i <= 9; i++)
{
JButton b = new JButton("Button #" + i);
b.setBounds(i*30, i*20, 125, 35);
myContentPane.add(b);
}
}
}