JExtendedInternalFrame: fix resize behaviour
parent
f38b9ce93a
commit
6b36943144
|
@ -54,34 +54,37 @@ public class JExtendedInternalFrame extends JInternalFrame
|
||||||
public void componentResized(ComponentEvent e) {
|
public void componentResized(ComponentEvent e) {
|
||||||
Component dp = getParent();
|
Component dp = getParent();
|
||||||
|
|
||||||
Dimension dpr = dp.getSize();
|
if(dp != null) {
|
||||||
Rectangle b = getBounds();
|
Dimension dpr = dp.getSize();
|
||||||
boolean reset = false;
|
Rectangle b = getBounds();
|
||||||
|
boolean reset = false;
|
||||||
if (b.x < 0) {
|
|
||||||
reset = true;
|
if (b.x < 0) {
|
||||||
b.width += b.x;
|
reset = true;
|
||||||
b.x = 0;
|
b.width += b.x;
|
||||||
|
b.x = 0;
|
||||||
|
}
|
||||||
|
if (b.y < 0) {
|
||||||
|
reset = true;
|
||||||
|
b.height += b.y;
|
||||||
|
b.y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b.x + b.width > dpr.width) {
|
||||||
|
b.width = dpr.width - b.x;
|
||||||
|
reset = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b.y + b.height > dpr.height){
|
||||||
|
b.height = dpr.height - b.y;
|
||||||
|
reset = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reset) {
|
||||||
|
setBounds(b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (b.y < 0) {
|
|
||||||
reset = true;
|
|
||||||
b.height += b.y;
|
|
||||||
b.y = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b.x + b.width > dpr.width) {
|
|
||||||
b.width = dpr.width - b.x;
|
|
||||||
reset = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b.y + b.height > dpr.height){
|
|
||||||
b.height = dpr.height - b.y;
|
|
||||||
reset = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reset) {
|
|
||||||
setBounds(b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue