bibliothek.gui.dock.util.BackgroundPaint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docking-frames-core Show documentation
Show all versions of docking-frames-core Show documentation
${project.name} is base or core library
/*
* Bibliothek - DockingFrames
* Library built on Java/Swing, allows the user to "drag and drop"
* panels containing any Swing-Component the developer likes to add.
*
* Copyright (C) 2010 Benjamin Sigg
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Benjamin Sigg
* [email protected]
* CH - Switzerland
*/
package bibliothek.gui.dock.util;
import java.awt.Component;
import java.awt.Graphics;
import javax.swing.JComponent;
import bibliothek.gui.DockTheme;
import bibliothek.util.Todo;
import bibliothek.util.Todo.Compatibility;
import bibliothek.util.Todo.Version;
/**
* A {@link BackgroundPaint} is used to paint the background of various {@link Component}s of
* this framework.
* Please note that some items provided by a {@link DockTheme} do not use a {@link BackgroundPaint}
* because they already paint their background in a specific way.
* @author Benjamin Sigg
*/
@Todo( target=Version.VERSION_1_1_1, compatibility=Compatibility.BREAK_MINOR, priority=Todo.Priority.MINOR,
description="allow BackgroundPaint to enabled/disable transparency" )
public interface BackgroundPaint {
/**
* Informs this paint that is will be used by component
.
* @param component the component that is going to use this paint, not null
*/
public void install( BackgroundComponent component );
/**
* Informs this paint that it is no longer used by component
.
* @param component the component that no longer uses this paint, not null
*/
public void uninstall( BackgroundComponent component );
/**
* Paints the background component
using the graphics context g
. The
* exact behavior of this method may depend on the type of component
.
* This method should be aware of the methods {@link PaintableComponent#paintBackground(Graphics)} and
* {@link PaintableComponent#paintForeground(Graphics)}:
*
* - If these methods are not called, then they will be executed automatically.
* - If these methods are called with an argument of
null
then they will neither paint nor be executed automatically.
* - If these methods are called with an argument not
null
then they paint but will not be executed automatically.
*
* Further more implementations should follow these guide lines to prevent artifacts while painting:
*
* - If
paintable
is solid, then the entire background must be painted (every pixel must be filled).
* - Painting over children ({@link Component}s) will almost certainly not work. The framework uses special transparent panels to do that.
* - Painting semi-transparent children will almost certainly not work because the children may not be marked as transparent (see {@link JComponent#isOpaque()}.
* - In general painting should not require much time (a few milliseconds at most) because painting can happen often.
*
* @param background the component to paint, is installed on this paint, not null
* @param paintable the part of the component that is to be painted, may be a child-{@link Component}
* @param g the graphics context to use
* @throws IllegalArgumentException if component
is not equal to background
or not
* a child of background
*/
public void paint( BackgroundComponent background, PaintableComponent paintable, Graphics g );
}