/** * Sets the shape of {@link #getWindow() the window}. This method calls {@link Workarounds#setTransparent(Window, Shape)}, * if transparency cannot be set then {@link #disable()} is called. * @param shape the shape to set, not <code>null</code> */ protected void setShape( Shape shape ){ if( !Workarounds.getDefault().setTransparent( getWindow(), shape ) ){ disable(); } }
/** * Sets the algorithm which is responsible for updating the shape of this window. The algorithm remains * active until {@link #destroy()} is called.<br> * Note: This method does nothing if {@link Workarounds#supportsTransparency(Window)} returns <code>false</code>. * @param window the {@link Window} representing <code>this</code>, it should be {@link #getWindowComponent()} * @param shape the algorithm defining the new shape */ protected void setShape( Window window, ScreenWindowShape shape ){ if( Workarounds.getDefault().supportsTransparency( window )){ if( this.shape != null ){ this.shape.disable(); this.shape = null; } if( shape != null ){ this.shape = new ScreenWindowShapeAdapter( this, window ); this.shape.setShape( shape ); } } }
/** * Tries first to call {@link Class#forName(String)} with <code>className</code> as argument, then creates * a new object, casts it to a {@link Workaround}, and finally {@link #addWorkaround(Workaround) installs that workaround} * @param className the name of the class to install * @return <code>true</code> if a new Workaround was installed */ public static boolean tryAddWorkaround( String className ){ try{ Class<?> clazz = Class.forName( className, true, Workarounds.class.getClassLoader() ); Object instance = clazz.newInstance(); getDefault().addWorkaround( (Workaround)instance ); return true; } catch( Exception e ){ e.printStackTrace(); return false; } }
public Overlay(){ setLayout( null ); setOpaque( false ); Workarounds.getDefault().markAsGlassPane( this ); }
private void init( boolean undecorated, WindowConfiguration configuration ){ if( undecorated ){ frame.setUndecorated( true ); frame.getRootPane().setWindowDecorationStyle( JRootPane.NONE ); } frame.setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE ); frame.addWindowListener( new WindowAdapter(){ @Override public void windowClosing( WindowEvent e ){ fireWindowClosing(); } }); init( frame, frame.getContentPane(), configuration, undecorated ); boolean translucency = false; if( configuration.isTransparent() ){ translucency = Workarounds.getDefault().setTranslucent( frame ); } if( !translucency && configuration.getShape() != null ){ setShape( frame, configuration.getShape() ); } }
listener.done( this ); Workarounds.getDefault().setup( this );
private void init( boolean undecorated, WindowConfiguration configuration ){ if( undecorated ){ frame.setUndecorated( true ); frame.getRootPane().setWindowDecorationStyle( JRootPane.NONE ); } frame.setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE ); frame.addWindowListener( new WindowAdapter(){ @Override public void windowClosing( WindowEvent e ){ fireWindowClosing(); } }); init( frame, frame.getContentPane(), configuration, undecorated ); boolean translucency = false; if( configuration.isTransparent() ){ translucency = Workarounds.getDefault().setTranslucent( frame ); } if( !translucency && configuration.getShape() != null ){ setShape( frame, configuration.getShape() ); } }
/** * Creates a new GlassPane. */ public GlassPane(){ addMouseListener( this ); addMouseMotionListener( this ); addMouseWheelListener( this ); setOpaque( false ); setFocusable( false ); Workarounds.getDefault().markAsGlassPane( this ); }
boolean transparency = Workarounds.getDefault().setTranslucent( this );
/** * Sets the shape of {@link #getWindow() the window}. This method calls {@link Workarounds#setTransparent(Window, Shape)}, * if transparency cannot be set then {@link #disable()} is called. * @param shape the shape to set, not <code>null</code> */ protected void setShape( Shape shape ){ if( !Workarounds.getDefault().setTransparent( getWindow(), shape ) ){ disable(); } }
/** * Sets the algorithm which is responsible for updating the shape of this window. The algorithm remains * active until {@link #destroy()} is called.<br> * Note: This method does nothing if {@link Workarounds#supportsTransparency(Window)} returns <code>false</code>. * @param window the {@link Window} representing <code>this</code>, it should be {@link #getWindowComponent()} * @param shape the algorithm defining the new shape */ protected void setShape( Window window, ScreenWindowShape shape ){ if( Workarounds.getDefault().supportsTransparency( window )){ if( this.shape != null ){ this.shape.disable(); this.shape = null; } if( shape != null ){ this.shape = new ScreenWindowShapeAdapter( this, window ); this.shape.setShape( shape ); } } }
boolean transparency = Workarounds.getDefault().setTranslucent( this );
private void init( boolean undecorated, WindowConfiguration configuration ){ if( undecorated ){ dialog.setUndecorated( true ); dialog.getRootPane().setWindowDecorationStyle( JRootPane.NONE ); } dialog.setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE ); dialog.setModal( false ); dialog.addWindowListener( new WindowAdapter(){ @Override public void windowClosing( WindowEvent e ){ fireWindowClosing(); } }); boolean translucency = false; if( configuration.isTransparent() ){ JPanel panel = new JPanel(); panel.setOpaque( false ); dialog.setContentPane( panel ); translucency = Workarounds.getDefault().setTranslucent( dialog ); } init( dialog, dialog.getContentPane(), configuration, undecorated ); if( !translucency && configuration.getShape() != null ){ setShape( dialog, configuration.getShape() ); } }