Lines 11-30
Link Here
|
11 |
|
11 |
|
12 |
package com.sun.rave.windowmgr; |
12 |
package com.sun.rave.windowmgr; |
13 |
|
13 |
|
|
|
14 |
import java.awt.AWTEvent; |
14 |
import java.awt.BorderLayout; |
15 |
import java.awt.BorderLayout; |
15 |
import java.awt.Component; |
16 |
import java.awt.EventQueue; |
16 |
import java.awt.Dimension; |
17 |
import java.awt.Graphics; |
17 |
import java.awt.Image; |
18 |
import java.awt.Image; |
18 |
import java.awt.Toolkit; |
|
|
19 |
import java.awt.Rectangle; |
19 |
import java.awt.Rectangle; |
|
|
20 |
import java.awt.event.PaintEvent; |
20 |
import java.awt.event.WindowAdapter; |
21 |
import java.awt.event.WindowAdapter; |
21 |
import java.awt.event.WindowEvent; |
22 |
import java.awt.event.WindowEvent; |
|
|
23 |
import java.awt.image.BufferedImage; |
22 |
|
24 |
|
23 |
import java.net.URL; |
|
|
24 |
|
25 |
import java.util.Locale; |
26 |
|
27 |
import javax.swing.ImageIcon; |
28 |
import javax.swing.JComponent; |
25 |
import javax.swing.JComponent; |
29 |
import javax.swing.JFrame; |
26 |
import javax.swing.JFrame; |
30 |
import javax.swing.JPanel; |
27 |
import javax.swing.JPanel; |
Lines 39-49
Link Here
|
39 |
import org.openide.filesystems.Repository; |
36 |
import org.openide.filesystems.Repository; |
40 |
import org.openide.util.HelpCtx; |
37 |
import org.openide.util.HelpCtx; |
41 |
import org.openide.util.NbBundle; |
38 |
import org.openide.util.NbBundle; |
42 |
import org.openide.util.SharedClassObject; |
|
|
43 |
import org.openide.util.Utilities; |
39 |
import org.openide.util.Utilities; |
44 |
|
40 |
|
45 |
import org.openide.ErrorManager; |
|
|
46 |
|
47 |
//import com.sun.rave.plaf.LookAndFeelFactory; |
41 |
//import com.sun.rave.plaf.LookAndFeelFactory; |
48 |
|
42 |
|
49 |
import org.openide.util.RequestProcessor; |
43 |
import org.openide.util.RequestProcessor; |
Lines 168-182
Link Here
|
168 |
firePropertyChange(ABOUT_TO_SHOW, null, null); |
162 |
firePropertyChange(ABOUT_TO_SHOW, null, null); |
169 |
} |
163 |
} |
170 |
|
164 |
|
|
|
165 |
public Graphics getGraphics() { |
166 |
// Return the dummy graphics that paint nowhere, until we receive a paint() |
167 |
if (waitingForPaintDummyGraphic != null) { |
168 |
// If we are the PaintEvent we are waiting for is being dispatched |
169 |
// we better return the correct graphics. |
170 |
AWTEvent event = EventQueue.getCurrentEvent(); |
171 |
if (event == null || (event.getID() != PaintEvent.PAINT && event.getSource() != this)) { |
172 |
return waitingForPaintDummyGraphic; |
173 |
} |
174 |
releaseWaitingForPaintDummyGraphic(); |
175 |
} |
176 |
return super.getGraphics(); |
177 |
} |
178 |
|
179 |
public void paint(Graphics g) { |
180 |
// As a safeguard, always release the dummy graphic when we get a paint |
181 |
if (waitingForPaintDummyGraphic != null) { |
182 |
releaseWaitingForPaintDummyGraphic(); |
183 |
// Since the release did not occur before the getGraphics() call, |
184 |
// I need to get the actual graphics now that I've released |
185 |
g = getGraphics(); |
186 |
} |
187 |
super.paint(g); |
188 |
} |
189 |
|
171 |
public void setLayoutPane(JComponent layoutPane){ |
190 |
public void setLayoutPane(JComponent layoutPane){ |
172 |
getContentPane().add(layoutPane, BorderLayout.CENTER); |
191 |
getContentPane().add(layoutPane, BorderLayout.CENTER); |
173 |
} |
192 |
} |
|
|
193 |
|
194 |
protected Image waitingForPaintDummyImage; |
195 |
protected Graphics waitingForPaintDummyGraphic; |
174 |
|
196 |
|
175 |
public void showWindow(){ |
197 |
public void showWindow() { |
|
|
198 |
// The setVisible will cause a PaintEvent to be queued up, as a LOW_PRIORITY one |
199 |
// As the painting of my child components occurs, they cause painting of their own |
200 |
// When the PaintEvent queued from the setVisible is finally processed, it assumes |
201 |
// nothing has been displayed and redraws the whole window. |
202 |
// So we make it such that, UNTIL there is the repaint is dispatched, return a graphics |
203 |
// which goes nowhere. |
204 |
waitingForPaintDummyImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); |
205 |
waitingForPaintDummyGraphic = waitingForPaintDummyImage.getGraphics(); |
176 |
setVisible(true); |
206 |
setVisible(true); |
177 |
//mainWindowShowing = true; |
|
|
178 |
} |
207 |
} |
179 |
|
208 |
|
|
|
209 |
protected void releaseWaitingForPaintDummyGraphic() { |
210 |
if (waitingForPaintDummyGraphic != null) { |
211 |
waitingForPaintDummyGraphic.dispose(); |
212 |
waitingForPaintDummyGraphic = null; |
213 |
waitingForPaintDummyImage = null; |
214 |
} |
215 |
} |
216 |
|
180 |
private boolean enableFixedSwitcher() { |
217 |
private boolean enableFixedSwitcher() { |
181 |
FileObject fo = Repository.getDefault().getDefaultFileSystem(). |
218 |
FileObject fo = Repository.getDefault().getDefaultFileSystem(). |
182 |
findResource("Toolbars/WorkspaceSwitcher"); // NOI18N |
219 |
findResource("Toolbars/WorkspaceSwitcher"); // NOI18N |