Jeg har lige lavet dette eksempel med forte og absolut layout:
http://www.disky.dk/layout/Layout.htmlKoden er denne her:
/*
* Layout.java
*
* Created on 17. oktober 2001, 10:14
*/
/**
*
* @author srr
* @version
*/
public class Layout extends java.applet.Applet
{
/** Initializes the applet Layout */
public void init ()
{
initComponents ();
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
private void initComponents()
{
button1 = new java.awt.Button();
textField1 = new java.awt.TextField();
scrollbar1 = new java.awt.Scrollbar();
label1 = new java.awt.Label();
setLayout(null);
button1.setFont(new java.awt.Font (\"Dialog\", 0, 11));
button1.setLabel(\"button1\");
button1.setName(\"button1\");
button1.setBackground(new java.awt.Color (212, 208, 200));
button1.setForeground(java.awt.Color.black);
add(button1);
button1.setBounds(40, 20, 70, 20);
textField1.setBackground(java.awt.Color.white);
textField1.setName(\"textfield1\");
textField1.setFont(new java.awt.Font (\"Dialog\", 0, 11));
textField1.setForeground(java.awt.Color.black);
textField1.setText(\"textField1\");
add(textField1);
textField1.setBounds(140, 20, 20, 100);
scrollbar1.setBackground(new java.awt.Color (212, 208, 200));
scrollbar1.setName(\"scrollbar1\");
scrollbar1.setFont(new java.awt.Font (\"Dialog\", 0, 11));
scrollbar1.setForeground(java.awt.Color.black);
add(scrollbar1);
scrollbar1.setBounds(20, 50, 80, 90);
label1.setFont(new java.awt.Font (\"Dialog\", 0, 18));
label1.setName(\"label1\");
label1.setBackground(new java.awt.Color (204, 204, 204));
label1.setForeground(java.awt.Color.black);
label1.setText(\"label1\");
add(label1);
label1.setBounds(180, 60, 60, 90);
}
// Variables declaration - do not modify
private java.awt.Button button1;
private java.awt.TextField textField1;
private java.awt.Scrollbar scrollbar1;
private java.awt.Label label1;
// End of variables declaration
}