blob: 145d82aae377a89e75315dd24e40ab562a53ec97 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package NET.worlds.console;
import java.awt.Dimension;
import java.awt.Panel;
class FixedSizePanel extends Panel {
private static final long serialVersionUID = 3707537728341782609L;
int w;
int h;
public FixedSizePanel(int w, int h) {
this.w = w;
this.h = h;
}
@Override
public Dimension preferredSize() {
Dimension d = super.preferredSize();
if (this.w >= 0) {
d.width = this.w;
}
if (this.h >= 0) {
d.height = this.h;
}
return d;
}
@Override
public Dimension minimumSize() {
Dimension d = super.minimumSize();
if (this.w >= 0) {
d.width = this.w;
}
if (this.h >= 0) {
d.height = this.h;
}
return d;
}
}
|