KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > joshy > html > forms > AbsoluteLayoutManager


1 package org.joshy.html.forms;
2
3 import java.awt.LayoutManager JavaDoc;
4 import java.awt.Component JavaDoc;
5 import java.awt.Container JavaDoc;
6 import java.awt.Dimension JavaDoc;
7 public class AbsoluteLayoutManager implements LayoutManager JavaDoc {
8     public AbsoluteLayoutManager() {
9     }
10
11     public void addLayoutComponent(String JavaDoc name, Component JavaDoc comp) {
12     }
13
14     public void layoutContainer(Container JavaDoc target) {
15
16         int ncomponents = target.countComponents();
17         for (int i = 0 ; i < ncomponents ; i++) {
18             Component JavaDoc comp = target.getComponent(i);
19             int x = comp.getX();
20             int y = comp.getY();
21             Dimension JavaDoc size = comp.getPreferredSize();
22             comp.reshape(x,y,size.width,size.height);
23         }
24
25     }
26     public Dimension JavaDoc minimumLayoutSize(Container JavaDoc parent) {
27         return parent.size();
28     }
29     public Dimension JavaDoc preferredLayoutSize(Container JavaDoc parent) {
30         return parent.size();
31     }
32     public void removeLayoutComponent(Component JavaDoc comp) {
33     }
34 }
35
Popular Tags