JExtendedInternalFrame: fix resize behaviour
parent
f38b9ce93a
commit
6b36943144
|
@ -54,34 +54,37 @@ public class JExtendedInternalFrame extends JInternalFrame
|
|||
public void componentResized(ComponentEvent e) {
|
||||
Component dp = getParent();
|
||||
|
||||
Dimension dpr = dp.getSize();
|
||||
Rectangle b = getBounds();
|
||||
boolean reset = false;
|
||||
|
||||
if (b.x < 0) {
|
||||
reset = true;
|
||||
b.width += b.x;
|
||||
b.x = 0;
|
||||
if(dp != null) {
|
||||
Dimension dpr = dp.getSize();
|
||||
Rectangle b = getBounds();
|
||||
boolean reset = false;
|
||||
|
||||
if (b.x < 0) {
|
||||
reset = true;
|
||||
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