63 closer = new Closer();
64 }
65
66 public Component add(Component c) {
67 container.add(c, BorderLayout.CENTER);
68 return c;
69 }
70
71 protected void setCloser(Runnable action, int time) {
72 closer.set(action, time);
73 }
74
75 // Must be executed on EDT.
76 @SuppressWarnings("deprecation")
77 protected void show(Point corner, int indent) {
78 assert SunToolkit.isDispatchThreadForAppContext(this);
79
80 pack();
81
82 Dimension size = getSize();
83 // TODO: When 6356322 is fixed we should get screen bounds in
84 // this way: eframe.getGraphicsConfiguration().getBounds().
85 Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
86
87 if (corner.x < scrSize.width/2 && corner.y < scrSize.height/2) { // 1st square
88 setLocation(corner.x + indent, corner.y + indent);
89
90 } else if (corner.x >= scrSize.width/2 && corner.y < scrSize.height/2) { // 2nd square
91 setLocation(corner.x - indent - size.width, corner.y + indent);
92
93 } else if (corner.x < scrSize.width/2 && corner.y >= scrSize.height/2) { // 3rd square
94 setLocation(corner.x + indent, corner.y - indent - size.height);
95
96 } else if (corner.x >= scrSize.width/2 && corner.y >= scrSize.height/2) { // 4th square
97 setLocation(corner.x - indent - size.width, corner.y - indent - size.height);
98 }
99
100 super.show();
101 closer.schedule();
102 }
103
104 @SuppressWarnings("deprecation")
105 public void hide() {
|
63 closer = new Closer();
64 }
65
66 public Component add(Component c) {
67 container.add(c, BorderLayout.CENTER);
68 return c;
69 }
70
71 protected void setCloser(Runnable action, int time) {
72 closer.set(action, time);
73 }
74
75 // Must be executed on EDT.
76 @SuppressWarnings("deprecation")
77 protected void show(Point corner, int indent) {
78 assert SunToolkit.isDispatchThreadForAppContext(this);
79
80 pack();
81
82 Dimension size = getSize();
83 Rectangle scrSize = getGraphicsConfiguration().getBounds();
84
85 if (corner.x < scrSize.width/2 && corner.y < scrSize.height/2) { // 1st square
86 setLocation(corner.x + indent, corner.y + indent);
87
88 } else if (corner.x >= scrSize.width/2 && corner.y < scrSize.height/2) { // 2nd square
89 setLocation(corner.x - indent - size.width, corner.y + indent);
90
91 } else if (corner.x < scrSize.width/2 && corner.y >= scrSize.height/2) { // 3rd square
92 setLocation(corner.x + indent, corner.y - indent - size.height);
93
94 } else if (corner.x >= scrSize.width/2 && corner.y >= scrSize.height/2) { // 4th square
95 setLocation(corner.x - indent - size.width, corner.y - indent - size.height);
96 }
97
98 super.show();
99 closer.schedule();
100 }
101
102 @SuppressWarnings("deprecation")
103 public void hide() {
|