269 public JPanel getGlassPane() {
270 return glassPane;
271 }
272
273 /**
274 * Sets the {@code JLayer}'s glassPane component, which can be {@code null}.
275 * <br>This is a bound property.
276 *
277 * @param glassPane the glassPane component of this {@code JLayer}
278 *
279 * @see #getGlassPane()
280 */
281 public void setGlassPane(JPanel glassPane) {
282 Component oldGlassPane = getGlassPane();
283 boolean isGlassPaneVisible = false;
284 if (oldGlassPane != null) {
285 isGlassPaneVisible = oldGlassPane.isVisible();
286 super.remove(oldGlassPane);
287 }
288 if (glassPane != null) {
289 AWTAccessor.getComponentAccessor().setMixingCutoutShape(glassPane,
290 new Rectangle());
291 glassPane.setVisible(isGlassPaneVisible);
292 super.addImpl(glassPane, null, 0);
293 }
294 this.glassPane = glassPane;
295 firePropertyChange("glassPane", oldGlassPane, glassPane);
296 revalidate();
297 repaint();
298 }
299
300 /**
301 * Called by the constructor methods to create a default {@code glassPane}.
302 * By default this method creates a new JPanel with visibility set to true
303 * and opacity set to false.
304 *
305 * @return the default {@code glassPane}
306 */
307 public JPanel createGlassPane() {
308 return new DefaultLayerGlassPane();
309 }
310
|
269 public JPanel getGlassPane() {
270 return glassPane;
271 }
272
273 /**
274 * Sets the {@code JLayer}'s glassPane component, which can be {@code null}.
275 * <br>This is a bound property.
276 *
277 * @param glassPane the glassPane component of this {@code JLayer}
278 *
279 * @see #getGlassPane()
280 */
281 public void setGlassPane(JPanel glassPane) {
282 Component oldGlassPane = getGlassPane();
283 boolean isGlassPaneVisible = false;
284 if (oldGlassPane != null) {
285 isGlassPaneVisible = oldGlassPane.isVisible();
286 super.remove(oldGlassPane);
287 }
288 if (glassPane != null) {
289 glassPane.setMixingCutoutShape(new Rectangle());
290 glassPane.setVisible(isGlassPaneVisible);
291 super.addImpl(glassPane, null, 0);
292 }
293 this.glassPane = glassPane;
294 firePropertyChange("glassPane", oldGlassPane, glassPane);
295 revalidate();
296 repaint();
297 }
298
299 /**
300 * Called by the constructor methods to create a default {@code glassPane}.
301 * By default this method creates a new JPanel with visibility set to true
302 * and opacity set to false.
303 *
304 * @return the default {@code glassPane}
305 */
306 public JPanel createGlassPane() {
307 return new DefaultLayerGlassPane();
308 }
309
|