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