org.jclarion.clarion.swing.StatusLayout Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clarion-runtime Show documentation
Show all versions of clarion-runtime Show documentation
JClarion runtime environment
The newest version!
package org.jclarion.clarion.swing;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
public class StatusLayout implements LayoutManager
{
private int[] sizes;
public StatusLayout(int sizes[])
{
this.sizes=sizes;
}
@Override
public void addLayoutComponent(String name, Component comp)
{
}
@Override
public void layoutContainer(Container parent)
{
int committedSize=0;
int adjustCount=0;
for (int scan=0;scan0) {
committedSize+=sizes[scan];
} else {
committedSize-=sizes[scan];
adjustCount++;
}
}
int adjustSize=0;
if (adjustCount>0) {
adjustSize=(parent.getWidth()-committedSize)/adjustCount;
}
int xpos=0;
for (int scan=0;scan0) {
width+=sizes[scan];
} else {
width-=sizes[scan];
}
if (pref.height>maxHeight) maxHeight=pref.height;
}
return new Dimension(width,maxHeight);
}
@Override
public Dimension preferredLayoutSize(Container parent)
{
int maxHeight=0;
int width=0;
for (int scan=0;scan0) {
width+=sizes[scan];
} else {
width-=sizes[scan];
}
if (pref.height>maxHeight) maxHeight=pref.height;
}
return new Dimension(width,maxHeight);
}
@Override
public void removeLayoutComponent(Component comp)
{
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy