src/com/0000755000175000017500000000000010072542100012350 5ustar twernertwernersrc/com/incors/0000755000175000017500000000000010072542100013645 5ustar twernertwernersrc/com/incors/plaf/0000755000175000017500000000000010072542100014567 5ustar twernertwernersrc/com/incors/plaf/ColorUIResource2.java0000644000175000017500000000624407372206354020567 0ustar twernertwernerpackage com.incors.plaf; /** * This class had to be created because ColorUIResouce does not allow * transparency. Hopefully one day support for transparency will be added to we * ColorUIResouce and we can get rid of this class. Wrapping a Color * object to make a pseudo subclass is very ugly. */ import java.awt.Color; import java.awt.PaintContext; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.color.ColorSpace; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.image.ColorModel; import javax.swing.plaf.ColorUIResource; public class ColorUIResource2 extends ColorUIResource { private Color myColor; // constructors public ColorUIResource2(Color c) { super(0, 0, 0); myColor = c; } public ColorUIResource2(int r, int g, int b) { super(0, 0, 0); myColor = new Color(r, g, b); } public ColorUIResource2(int r, int g, int b, int a) { super(0, 0, 0); myColor = new Color(r, g, b, a); } public ColorUIResource2(int rgb) { super(0, 0, 0); myColor = new Color(rgb); } public ColorUIResource2(int rgba, boolean hasalpha) { super(0, 0, 0); myColor = new Color(rgba, hasalpha); } public ColorUIResource2(float r, float g, float b) { super(0, 0, 0); myColor = new Color(r, g, b); } public ColorUIResource2(float r, float g, float b, float alpha) { super(0, 0, 0); myColor = new Color(r, g, b, alpha); } // non static methods public int getRed() { return myColor.getRed(); } public int getGreen() { return myColor.getGreen(); } public int getBlue() { return myColor.getBlue(); } public int getAlpha() { return myColor.getAlpha(); } public int getRGB() { return myColor.getRGB(); } public Color brighter() { return myColor.brighter(); } public Color darker() { return myColor.darker(); } public int hashCode() { return myColor.hashCode(); } public boolean equals(Object obj) { return myColor.equals(obj); } public String toString() { return myColor.toString(); } public float[] getRGBComponents(float[] compArray) { return myColor.getRGBComponents(compArray); } public float[] getRGBColorComponents(float[] compArray) { return myColor.getRGBColorComponents(compArray); } public float[] getComponents(float[] compArray) { return myColor.getComponents(compArray); } public float[] getColorComponents(float[] compArray) { return myColor.getColorComponents(compArray); } public float[] getComponents(ColorSpace cspace, float[] compArray) { return myColor.getComponents(cspace, compArray); } public float[] getColorComponents(ColorSpace cspace, float[] compArray) { return myColor.getColorComponents(cspace, compArray); } public ColorSpace getColorSpace() { return myColor.getColorSpace(); } public PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints) { return myColor.createContext(cm, r, r2d, xform, hints); } public int getTransparency() { return myColor.getTransparency(); } }src/com/incors/plaf/FastGradientPaint.java0000644000175000017500000000153707421104710021014 0ustar twernertwernerpackage com.incors.plaf; /* * This code was contributed by Sebastian Ferreyra (sebastianf@citycolor.net). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import java.awt.geom.*; import java.awt.image.ColorModel; public class FastGradientPaint implements Paint { int startColor, endColor; boolean isVertical; public FastGradientPaint( Color sc, Color ec, boolean isV ) { startColor = sc.getRGB(); endColor = ec.getRGB(); isVertical = isV; } public synchronized PaintContext createContext( ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints ) { return new FastGradientPaintContext( cm, r, startColor, endColor, isVertical ); } public int getTransparency() { return ( ( ( (startColor & endColor) >> 24) & 0xFF ) == 0xFF) ? OPAQUE : TRANSLUCENT; } } src/com/incors/plaf/FastGradientPaintContext.java0000644000175000017500000001173010072545126022363 0ustar twernertwernerpackage com.incors.plaf; /* * This code was contributed by Sebastian Ferreyra (sebastianf@citycolor.net). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.PaintContext; import java.awt.Rectangle; import java.awt.image.ColorModel; import java.awt.image.Raster; import java.awt.image.WritableRaster; import java.util.LinkedList; import java.util.HashMap; import java.util.WeakHashMap; class FastGradientPaintContext implements PaintContext { private class GradientInfo { ColorModel model; int parallelLength, startColor, endColor; boolean isVertical; public boolean equals( Object o ) { if ( ! ( o instanceof GradientInfo ) ) return false; GradientInfo gi = (GradientInfo) o; if ( gi.model.equals(model) && gi.parallelLength == parallelLength && gi.startColor == startColor && gi.endColor == endColor && gi.isVertical == isVertical ) return true; return false; } public int hashCode() { return parallelLength; } public String toString() { return "Direction:" + (isVertical?"ver":"hor") + ", Length: "+Integer.toString( parallelLength )+", Color1: "+Integer.toString( startColor, 16 )+", Color2: "+Integer.toString( endColor, 16 ); } } private class Gradient { GradientInfo info; int perpendicularLength = 0; WritableRaster raster; HashMap childRasterCache; Gradient ( GradientInfo i ) { info = i; } private Raster getRaster( int parallelPos, int perpendicularLength, int parallelLength ) { if ( raster == null || ( this.perpendicularLength < perpendicularLength ) ) createRaster( perpendicularLength ); Integer key = new Integer( parallelPos ); Object o = childRasterCache.get( key ); if ( o !=null ) return (Raster) o; else { Raster r; if ( info.isVertical ) r = raster.createChild( 0, parallelPos, this.perpendicularLength, info.parallelLength-parallelPos, 0, 0, null ); else r = raster.createChild( parallelPos, 0, info.parallelLength-parallelPos, this.perpendicularLength, 0, 0, null ); childRasterCache.put( key, r ); //System.out.println( "Storing child raster in cache. Position: " + Integer.toString(parallelPos) ); return r; } } public void dispose() { // raster = null; } private void createRaster( int perpendicularLength ) { int gradientWidth, gradientHeight; if ( info.isVertical ) { gradientHeight = info.parallelLength; gradientWidth = this.perpendicularLength = perpendicularLength; } else { gradientWidth = info.parallelLength; gradientHeight = this.perpendicularLength = perpendicularLength; } int sa = (info.startColor >> 24) & 0xFF; int sr = (info.startColor >> 16) & 0xFF; int sg = (info.startColor >> 8) & 0xFF; int sb = info.startColor & 0xFF; int da = ((info.endColor >> 24) & 0xFF) - sa; int dr = ((info.endColor >> 16) & 0xFF) - sr; int dg = ((info.endColor >> 8) & 0xFF) - sg; int db = (info.endColor & 0xFF) - sb; raster = info.model.createCompatibleWritableRaster( gradientWidth, gradientHeight ); Object c = null; int pl = info.parallelLength; for ( int i = 0 ; i < pl ; i++ ) { c = info.model.getDataElements( (sa+(i*da)/pl)<<24 | (sr+(i*dr)/pl)<<16 | (sg+(i*dg)/pl)<<8 | (sb+(i*db)/pl), c ); for ( int j = 0 ; j < perpendicularLength ; j++ ) { if ( info.isVertical ) raster.setDataElements( j, i, c ); else raster.setDataElements( i, j, c ); } } childRasterCache = new HashMap(); } } private static WeakHashMap gradientCache = new WeakHashMap(); private static LinkedList recentInfos = new LinkedList(); GradientInfo info; int parallelDevicePos; Gradient gradient; FastGradientPaintContext(ColorModel cm, Rectangle r, int sc, int ec, boolean ver ) { info = new GradientInfo(); if ( (((sc & ec)>>24) & 0xFF) != 0xFF ) info.model = ColorModel.getRGBdefault(); else info.model = cm; info.startColor = sc; info.endColor = ec; if ( info.isVertical = ver ) { parallelDevicePos = r.y; info.parallelLength = r.height; } else { parallelDevicePos = r.x; info.parallelLength = r.width; } recentInfos.remove( info ); recentInfos.add( 0, info ); if ( recentInfos.size() > 16 ) recentInfos.removeLast(); Object o = gradientCache.get( info ); if ( o != null ) o = ( ( java.lang.ref.WeakReference )o ).get(); if ( o != null ) { gradient = (Gradient) o; } else { gradientCache.put( info, new java.lang.ref.WeakReference( gradient = new Gradient( info ) ) ); //System.out.println( "Storing gradient in cache. Info: " + info.toString() ); } } public void dispose() { gradient.dispose(); } public ColorModel getColorModel() { return info.model; } public synchronized Raster getRaster( int x, int y, int w, int h ) { if ( info.isVertical ) return gradient.getRaster( y - parallelDevicePos, w, h ); else return gradient.getRaster( x - parallelDevicePos, h, w ); } } src/com/incors/plaf/kunststoff/0000755000175000017500000000000010072542102016777 5ustar twernertwernersrc/com/incors/plaf/kunststoff/GradientTheme.java0000644000175000017500000000315607410117670022401 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.plaf.*; import javax.swing.plaf.metal.*; /** * Interface that provides methods for getting the colors for all gradients * in the Kunststoff Look&Feel. This interface can be implemented by subclasses * of javax.swing.plaf.metal.MetalTheme to have a theme that provides * standard colors as well as gradient colors. */ public interface GradientTheme { /** * Returns the upper gradient color for components like JButton, JMenuBar, * and JProgressBar. * Will return null if upper gradient should not be painted. */ public ColorUIResource getComponentGradientColorReflection(); /** * Returns the lower gradient color for components like JButton, JMenuBar, * and JProgressBar. * Will return null if lower gradient should not be painted. */ public ColorUIResource getComponentGradientColorShadow(); /** * Returns the upper gradient color for text components like JTextField and * JPasswordField. * Will return null if upper gradient should not be painted. */ public ColorUIResource getTextComponentGradientColorReflection(); /** * Returns the lower gradient color for text components like JTextField and * JPasswordField. * Will return null if lower gradient should not be painted. */ public ColorUIResource getTextComponentGradientColorShadow(); public int getBackgroundGradientShadow(); }src/com/incors/plaf/kunststoff/icons/0000755000175000017500000000000010072542102020112 5ustar twernertwernersrc/com/incors/plaf/kunststoff/icons/Error.gif0000644000175000017500000000277107264133040021707 0ustar twernertwernerGIF89a s11s91s99{99{B9{BBFBJJ{kk{ksOJRJRRZTc^kssss{s{ss{]Wlh{z{sƜġΠΧ֭ƱέұέƵεεƽƽƽνֵֵֵֽֽ޽ֽ!X, H .XP!#bqR+WPHI *Hㅔ+TR%K(b@'*X":tʣLLBBcϟA!Dt4J:j #jD$! :|:u@yP(CC(ܠ>ZX$%6!AHٸ7X,ywq[0T @`ID )׈<f Б3[P(h@*  E'Mg. &\A Tށ1 40 Dvn`}F@4$a"( 'hp@| 3\*-$ A%xz# 4֠B7 M*`@dp: * )l,AAxc:BRW L0* @d)@cX\ XP@ٰ@ oT(ܰ#b!C 7lhaF fHX*L@a"1T9pƆ7`(1BD #H(a% "%PN@IIDZDaF BK|"Eˡcl y-т4kPȐ;ԧ w{.Դ4jP)r(cF B6 )+B- 8@@e"*@(A Hb  T+UZ8ߠ,PXQ;$AASIEz! ̬CM%! z7Tf&U<~[b$U}0 wh*l[ZXohE8B i"(\f*~=FB @c'V!x?5Мp@`Fp~)ZF  OQ)[ @xO@,Bc5q3 #h Aɜ P 8p%UA@|R6A 8+*@D,0FXѯAp $pA  #P`j|?i0A .MXhAu P@;  @ 0px \0@pd4;src/com/incors/plaf/kunststoff/icons/Question.gif0000644000175000017500000000275307264134550022434 0ustar twernertwernerGIF89a JJ1JR9RR9ZZ9RZBZZBZZJccJccRckJkkRssZZkckcsgssscuxe{{ko{p{xs{ƵƵƽƽνƽƽƽƽƽ!X, HK(lؐ!#J$!)Th2I'Ja(K2H%N,)r`L,䐪C,$ćh&8Xx;2(ȀƒV}'fGfĄSPapCiO`* #PЁvt9xYOwA5xeEIv 4ptW0>\U$x < j]((U?1Xd.89S]2D%> 0XtsdY]UZ CU&fURX_}>0feR% `yVhʟB uEЂTNigЕ@lVQ ӑv.PAA u C 0kVJ  BWt,Xւ D* A P ԩp(4@0]TU !d`քEh -@C *\+@3LPdd@0A3$ 0 D;src/com/incors/plaf/kunststoff/icons/treecol.gif0000644000175000017500000000044607364257414022265 0ustar twernertwernerGIF89a (((###???JJJ|||'''999///111 )))>>>AAA@@@{{{CCC:::DDD777$$$%%%GGG+++&&&!, C@ 4ȁl$fI2 \XQ*,k0 N 0 B$ڄ+) +'$+A;src/com/incors/plaf/kunststoff/icons/treeex.gif0000644000175000017500000000044507364257414022123 0ustar twernertwernerGIF89a ///򇇇yyy,,,(((GGGJJJ<<<;;;...---HHH555BBB%%%***$$$&&&!, BEDJ#M $\@8P"B e Ѩ`,/cS1!$A;src/com/incors/plaf/kunststoff/icons/Warn.gif0000644000175000017500000000270407264131140021520 0ustar twernertwernerGIF89a sZsZ{Z{c{c!kk!k1s9sBs%w-{1))195wBBV=9?FVJR\^R^opokƷm~Ȼ}νƽƽý{{ƄƄνƌƌƔƔΔƜΜƥΥΥΥ֥ƭέέ֭֭ҵֵֽ޽޽!X, H 6p(#bG*VPbM$Fc$D!&T!r`IL!CǍ>bI!%6IQJ@ T"#DJ!Pw c?!)S t&N0y2 :~Q!!t}P%0 HcK3'xpb7hpH"PE&Pʒѓ@]„@MS] (d" $N'PN4AՆOF12vtک2@0Ux:,YO$h BW-] 0l2`٧ J(gPBl&P70"tP4@sѕX_hd0}5]3NC( 3e/lPޝ(Yz_ !AP퀡Z{= #IW Mwy Đ 1lp@"i^0L5c  P:t@yNhh.РO4A 8`{yQBd x0wi0$ ¢kNjT0@[%`t;D JComponent and the background color is an * instance of ColorUIResource. In a default JComboBox * with a default renderer this should be the case. */ public class KunststoffComboBoxUI extends MetalComboBoxUI { public static ComponentUI createUI(JComponent c) { return new KunststoffComboBoxUI(); } /** * Installs MyMetalComboBoxButton */ protected JButton createArrowButton() { JButton button = new MyMetalComboBoxButton (comboBox, new MetalComboBoxIcon(), comboBox.isEditable() ? true : false, currentValuePane, listBox); button.setMargin(new Insets(0, 1, 1, 3 )); return button; } /* * This inner class finally fixed a nasty bug with the combo box. Thanks to * Matthew Philips for providing the bugfix. * Thanks to Ingo Kegel for fixing two compiling issues for jikes. */ private final class MyMetalComboBoxButton extends javax.swing.plaf.metal.MetalComboBoxButton { public MyMetalComboBoxButton(JComboBox cb, Icon i, boolean onlyIcon, CellRendererPane pane, JList list) { super (cb, i, onlyIcon, pane, list); } public void paintComponent(Graphics g) { if (! iconOnly && MyMetalComboBoxButton.this.comboBox != null) { boolean isSetRendererOpaque = false; ListCellRenderer renderer = MyMetalComboBoxButton.this.comboBox.getRenderer(); if (renderer instanceof JComponent) { JComponent jRenderer = (JComponent) renderer; if (jRenderer.isOpaque() && jRenderer.getBackground() instanceof ColorUIResource) { isSetRendererOpaque = true; // remember to set the renderer opaque again jRenderer.setOpaque(false); } } super.paintComponent(g); if (isSetRendererOpaque) { ((JComponent) renderer).setOpaque(true); } } else { super.paintComponent(g); } } } } src/com/incors/plaf/kunststoff/KunststoffGradientTheme.java0000644000175000017500000000242407410332564024466 0ustar twernertwernerpackage com.incors.plaf.kunststoff; import javax.swing.plaf.*; import com.incors.plaf.*; public class KunststoffGradientTheme implements GradientTheme { // gradient colors private final ColorUIResource componentGradientColorReflection = new ColorUIResource2(255, 255, 255, 96); private final ColorUIResource componentGradientColorShadow = new ColorUIResource2(0, 0, 0, 48); private final ColorUIResource textComponentGradientColorReflection = new ColorUIResource2(0, 0, 0, 32); private final ColorUIResource textComponentGradientColorShadow = null; private final int backgroundGradientShadow = 32; // methods public String getName() { return "Default Kunststoff Gradient Theme"; } // methods for getting gradient colors public ColorUIResource getComponentGradientColorReflection() { return componentGradientColorReflection; } public ColorUIResource getComponentGradientColorShadow() { return componentGradientColorShadow; } public ColorUIResource getTextComponentGradientColorReflection() { return textComponentGradientColorReflection; } public ColorUIResource getTextComponentGradientColorShadow() { return textComponentGradientColorShadow; } public int getBackgroundGradientShadow() { return backgroundGradientShadow; } }src/com/incors/plaf/kunststoff/KunststoffInternalFrameTitlePane.java0000644000175000017500000000242110072545066026301 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by Jerason Banes (jbanes@techie.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.metal.*; public class KunststoffInternalFrameTitlePane extends MetalInternalFrameTitlePane { public KunststoffInternalFrameTitlePane(JInternalFrame frame) { super(frame); } public void paintComponent(Graphics g) { super.paintComponent(g); // paint reflection Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rectReflection = new Rectangle(0, 1, this.getWidth(), this.getHeight()/2);; KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rectReflection, true); // paint shadow Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rectShadow = new Rectangle(0, this.getHeight()/2, this.getWidth(), this.getHeight()/2+1); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rectShadow, true); } } src/com/incors/plaf/kunststoff/KunststoffInternalFrameUI.java0000644000175000017500000000512210072545066024732 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by Jerason Banes (jbanes@techie.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.beans.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.metal.*; public class KunststoffInternalFrameUI extends MetalInternalFrameUI { private MetalInternalFrameTitlePane titlePane; private PropertyChangeListener paletteListener; private static String FRAME_TYPE = "JInternalFrame.frameType"; private static String NORMAL_FRAME = "normal"; private static String PALETTE_FRAME = "palette"; private static String OPTION_DIALOG = "optionDialog"; protected static String IS_PALETTE = "JInternalFrame.isPalette"; // added by Thomas Auinger // to solve a compiling problem public KunststoffInternalFrameUI(JInternalFrame b) { super(b); } public static ComponentUI createUI(JComponent c) { return new KunststoffInternalFrameUI((JInternalFrame)c); } public void installUI(JComponent c) { paletteListener = new PaletteListener(); c.addPropertyChangeListener(paletteListener); super.installUI(c); } public void uninstallUI(JComponent c) { c.removePropertyChangeListener(paletteListener); super.uninstallUI(c); } protected JComponent createNorthPane(JInternalFrame w) { super.createNorthPane(w); titlePane = new KunststoffInternalFrameTitlePane(w); return titlePane; } public void setPalette(boolean isPalette) { super.setPalette(isPalette); titlePane.setPalette(isPalette); } private void setFrameType(String frameType) { if (frameType.equals(OPTION_DIALOG)) { LookAndFeel.installBorder(frame, "InternalFrame.optionDialogBorder"); titlePane.setPalette(false); } else if (frameType.equals(PALETTE_FRAME)) { LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder"); titlePane.setPalette(true); } else { LookAndFeel.installBorder(frame, "InternalFrame.border"); titlePane.setPalette(false); } } class PaletteListener implements PropertyChangeListener { public void propertyChange(PropertyChangeEvent e) { String name = e.getPropertyName(); if(name.equals(FRAME_TYPE)) { if(e.getNewValue() instanceof String) setFrameType((String)e.getNewValue()); } else if(name.equals(IS_PALETTE)) { if(e.getNewValue() != null) setPalette(((Boolean)e.getNewValue()).booleanValue()); else setPalette(false); } } } // end class PaletteListener } src/com/incors/plaf/kunststoff/KunststoffListUI.java0000644000175000017500000000766310072545066023132 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; /** * From version 2.0 the KunststoffListUI works with the DefaultListCellRenderer, * which makes it really plug and play! */ public class KunststoffListUI extends BasicListUI { private boolean isToolkitTrueColor = false; public KunststoffListUI(JComponent list) { // this will be needed for the decision if a big gradient or a small shadow // should be painted. On 16-bit colors the big gradient looks awkward, therefore // we will then paint a small shadow instead isToolkitTrueColor = KunststoffUtilities.isToolkitTrueColor(list); } public static ComponentUI createUI(JComponent list) { return new KunststoffListUI(list); } public void update(Graphics g, JComponent c) { if (c.isOpaque()) { Graphics2D g2D = (Graphics2D) g; Color colorBackground = c.getBackground(); int shadow = KunststoffLookAndFeel.getBackgroundGradientShadow(); // we will only paint the background if the background color is not null if (colorBackground != null) { Rectangle clipBounds = g.getClipBounds(); if (shadow == 0) { // paint the background without gradient g2D.setColor(colorBackground); g2D.fill(clipBounds); } else { // create the shadow color int red = colorBackground.getRed(); int green = colorBackground.getGreen(); int blue = colorBackground.getBlue(); Color colorShadow = new Color(red>=shadow?red-shadow:0, green>=shadow?green-shadow:0, blue>=shadow?blue-shadow:0); if (isToolkitTrueColor) { // paint big horizontal gradient Rectangle rect = new Rectangle(0, 0, list.getWidth(), list.getHeight()); KunststoffUtilities.drawGradient(g, colorBackground, colorShadow, rect, clipBounds, false); } else { g2D.setColor(colorBackground); g2D.fill(clipBounds); // create faded shadow color Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); // paint shadow at top GradientPaint gradientTop = new GradientPaint(0f, 0f, colorShadow, 0f, 5f, colorShadowFaded); g2D.setPaint(gradientTop); g2D.fill(new Rectangle(clipBounds.x, clipBounds.y, clipBounds.width, 20)); // paint shadow at left GradientPaint gradientLeft = new GradientPaint(0f, 0f, colorShadow, 5f, 0f, colorShadowFaded); g2D.setPaint(gradientLeft); g2D.fill(new Rectangle(clipBounds.x, clipBounds.y, 20, clipBounds.height)); } } } } paint(g, c); } // We temporarily make the renderer transparent if the row is not selected // and the renderer is a JComponent (like DefaultListCellRenderer) and the // background color is a ColorUIResource (which means it probably has the // original color assigned by the Look&Feel). protected void paintCell(Graphics g, int row, Rectangle rowBounds, ListCellRenderer cellRenderer, ListModel dataModel, ListSelectionModel selModel, int leadIndex) { if (cellRenderer instanceof JComponent && !selModel.isSelectedIndex(row)) { JComponent renderer = ((JComponent) cellRenderer); if (renderer.getBackground() instanceof ColorUIResource && renderer.isOpaque()) { renderer.setOpaque(false); super.paintCell(g, row, rowBounds, cellRenderer, dataModel, selModel, leadIndex); renderer.setOpaque(true); return; } } super.paintCell(g, row, rowBounds, cellRenderer, dataModel, selModel, leadIndex); } }src/com/incors/plaf/kunststoff/KunststoffLookAndFeel.java0000644000175000017500000001335510072545540024074 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. * * The code was improved with the help of these great people: * * Aljoscha Rittner * C.J. Kent * Christian Peter * Christoph Wilhelms * Eric Georges * Gerald Bauer * Ingo Kegel * Jamie LaScolea * Jens Niemeyer * Jerason Banes * Jim Wissner * Johannes Ernst * Jonas Kilian * Julien Ponge * Karsten Lentzsch * Matthew Philips * Romain Guy * Sebastian Ferreyra * Steve Varghese * Taoufik Romdhane * Timo Haberkern * */ import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.metal.*; /** * The main class for the Kunststoff Look&Feel. * */ public class KunststoffLookAndFeel extends MetalLookAndFeel { private static GradientTheme gradientTheme; private static boolean isInstalled = false; private static boolean themeHasBeenSet = false; // Thanks to Jonas Kilian for // fixing the themes-bug public KunststoffLookAndFeel() { // the next line was removed by Jens Niemeyer, jens@jensn.de, because it would // cause a crash when using Sun Web Start // super(); // install with the UIManager, if not done yet. if (!isInstalled) { UIManager.installLookAndFeel(new UIManager.LookAndFeelInfo("Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel")); isInstalled = true; } } public String getID() { return "Kunststoff"; } public String getName() { return "Kunststoff"; } public String getDescription() { return "Kunststoff Look&Feel 2.0.2. Developed by INCORS GmbH and contributors" + ", 2001-2004. Published under the Lesser GNU Public Licence."; } public boolean isNativeLookAndFeel() { return false; } public boolean isSupportedLookAndFeel() { return true; } protected void initClassDefaults(UIDefaults table) { super.initClassDefaults(table); putDefault(table, "ButtonUI"); putDefault(table, "ToggleButtonUI"); putDefault(table, "ComboBoxUI"); putDefault(table, "TabbedPaneUI"); putDefault(table, "TextFieldUI"); putDefault(table, "PasswordFieldUI"); putDefault(table, "ListUI"); putDefault(table, "TreeUI"); putDefault(table, "ToolBarUI"); putDefault(table, "MenuBarUI"); putDefault(table, "MenuUI"); putDefault(table, "ScrollBarUI"); putDefault(table, "ProgressBarUI"); putDefault(table, "TableHeaderUI"); putDefault(table, "InternalFrameUI"); // if you want a check box icon with gradients, just remove the comment from // the following lines. We prefer the standard icon. /* putDefault(table, "CheckBoxUI"); try { String className = "com.incors.plaf.kunststoff.KunststoffCheckBoxIcon"; table.put("CheckBox.icon", className); } catch (Exception ex) { ex.printStackTrace(); } */ } protected void putDefault(UIDefaults table, String uiKey) { try { String className = "com.incors.plaf.kunststoff.Kunststoff"+uiKey; table.put(uiKey, className); } catch (Exception ex) { ex.printStackTrace(); } } protected void createDefaultTheme() { if (!themeHasBeenSet) { setCurrentTheme(new KunststoffTheme()); } if (gradientTheme==null) { gradientTheme = new KunststoffGradientTheme(); } } /** * Sets the theme that defines the colors for gradients. */ public static void setCurrentGradientTheme(GradientTheme theme) { if (theme == null) { throw new NullPointerException("Gradient Theme cannot have null value"); } gradientTheme = theme; } /** * Sets the current color theme. This works exactly as with the MetalLookAndFeel. * Note that for customizing the gradients the method setCurrentGradientTheme() * must be used. */ public static void setCurrentTheme(MetalTheme theme) { MetalLookAndFeel.setCurrentTheme(theme); themeHasBeenSet = true; } protected void initSystemColorDefaults(UIDefaults table) { super.initSystemColorDefaults(table); // we made the color a bit darker because the were complaints about the color // being very difficult to see table.put("textHighlight", KunststoffUtilities.getTranslucentColorUIResource(getTextHighlightColor(), 128)); } protected void initComponentDefaults(UIDefaults table) { super.initComponentDefaults(table); table.put("SplitPane.dividerSize", new Integer(8)); // will result in only one row of bumps } // ******** getter methods for the gradient colors ********* /** * Returns the reflection color for a standard component (such as JButton). */ public static ColorUIResource getComponentGradientColorReflection() { return gradientTheme.getComponentGradientColorReflection(); } /** * Returns the shadow color for a standard component (such as JButton). */ public static ColorUIResource getComponentGradientColorShadow() { return gradientTheme.getComponentGradientColorShadow(); } /** * Returns the reflection color for a text component (such as JTextField). */ public static ColorUIResource getTextComponentGradientColorReflection() { return gradientTheme.getTextComponentGradientColorReflection(); } /** * Returns the reflection color for a text component (such as JTextField). */ public static ColorUIResource getTextComponentGradientColorShadow() { return gradientTheme.getTextComponentGradientColorShadow(); } /** * Returns the background shadow color for JList. In future we might also * use this color for the background of JTree. */ public static int getBackgroundGradientShadow() { return gradientTheme.getBackgroundGradientShadow(); } }src/com/incors/plaf/kunststoff/KunststoffMenuBarUI.java0000644000175000017500000000255210072545066023540 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; public class KunststoffMenuBarUI extends BasicMenuBarUI { public static ComponentUI createUI(JComponent c) { return new KunststoffMenuBarUI(); } public void paint(Graphics g, JComponent c) { super.paint(g, c); // paint upper gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(0, 0, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, true); } // paint lower gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(0, c.getHeight()/2, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, true); } } }src/com/incors/plaf/kunststoff/KunststoffMenuUI.java0000644000175000017500000000367410072545066023121 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. * * Thanks to Christoph Wilhelms for providing a fic for a bug that screwed up * the menu bar's ui after setting a menu disabled. */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; public class KunststoffMenuUI extends BasicMenuUI { public static ComponentUI createUI(JComponent c) { return new KunststoffMenuUI(); } public void paint(Graphics g, JComponent c) { super.paint(g, c); Container parent = menuItem.getParent(); if (c.isOpaque() && parent != null && parent instanceof JMenuBar) { Point loc = c.getLocation(); // paint upper gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle drawRect = new Rectangle(0, 0, parent.getWidth(), parent.getHeight()/2); Rectangle gradRect = new Rectangle(0, -loc.y, parent.getWidth(), parent.getHeight()/2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, drawRect, gradRect, true); } // paint lower gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle drawRect = new Rectangle(0, parent.getHeight()/2, parent.getWidth(), parent.getHeight()/2); Rectangle gradRect = new Rectangle(0, parent.getHeight()/2-loc.y, parent.getWidth(), parent.getHeight()/2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, drawRect, gradRect, true); } } } }src/com/incors/plaf/kunststoff/KunststoffPasswordFieldUI.java0000644000175000017500000000121107336162130024740 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. */ import javax.swing.*; import javax.swing.plaf.*; import javax.swing.text.*; public class KunststoffPasswordFieldUI extends KunststoffTextFieldUI { KunststoffPasswordFieldUI(JComponent c) { super(c); } public static ComponentUI createUI(JComponent c) { return new KunststoffPasswordFieldUI(c); } protected String getPropertyPrefix() { return "PasswordField"; } public View create(Element elem) { return new PasswordView(elem); } }src/com/incors/plaf/kunststoff/KunststoffProgressBarUI.java0000644000175000017500000000474210072545066024443 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com) * It is published under the terms of the Lesser GNU Public License. * * The original class was contributed by * Julien Ponge * julien@izforge.com * http://www.izforge.com/ * */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; public class KunststoffProgressBarUI extends BasicProgressBarUI { // Creates the UI public static ComponentUI createUI(JComponent c) { return new KunststoffProgressBarUI(); } public void paint(Graphics g, JComponent c) { super.paint(g, c); JProgressBar prog = (JProgressBar) c; if (prog.getOrientation() == JProgressBar.HORIZONTAL) { // paint upper gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(0, 0, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, true); } // paint lower gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(0, c.getHeight()/2, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, true); } } else { // if progress bar is vertical // paint left gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(0, 0, c.getWidth()/2, c.getHeight()); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, false); } // paint right gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(c.getWidth()/2, 0, c.getWidth()/2, c.getHeight()); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, false); } } } }src/com/incors/plaf/kunststoff/KunststoffScrollBarUI.java0000644000175000017500000000507707421253050024070 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.metal.*; public class KunststoffScrollBarUI extends MetalScrollBarUI { public static ComponentUI createUI(JComponent c) { return new KunststoffScrollBarUI(); } protected JButton createDecreaseButton(int orientation) { decreaseButton = new KunststoffScrollButton(orientation, scrollBarWidth, isFreeStanding); return decreaseButton; } protected JButton createIncreaseButton(int orientation) { increaseButton = new KunststoffScrollButton(orientation, scrollBarWidth, isFreeStanding); return increaseButton; } /** * Calls the super classes paint(Graphics g) method and then paints two gradients. * The direction of the gradients depends on the direction of the scrollbar. */ protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { super.paintThumb(g, c, thumbBounds); // colors for the reflection gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); // colors for the shadow gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rectReflection; // rectangle for the reflection gradient Rectangle rectShadow; // rectangle for the shadow gradient if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { rectReflection = new Rectangle(thumbBounds.x+1, thumbBounds.y, thumbBounds.width/2, thumbBounds.height); rectShadow = new Rectangle(thumbBounds.x + thumbBounds.width/2, thumbBounds.y, thumbBounds.width/2+1, thumbBounds.height); } else { rectReflection = new Rectangle(thumbBounds.x, thumbBounds.y+1, thumbBounds.width, thumbBounds.height/2); rectShadow = new Rectangle(thumbBounds.x, thumbBounds.y + thumbBounds.height/2, thumbBounds.width, thumbBounds.height/2+1); } // the direction of the gradient is orthogonal to the direction of the scrollbar boolean isVertical = (scrollbar.getOrientation() == JScrollBar.HORIZONTAL); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rectReflection, isVertical); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rectShadow, isVertical); } }src/com/incors/plaf/kunststoff/KunststoffScrollButton.java0000644000175000017500000000350210072545066024377 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.plaf.metal.*; public class KunststoffScrollButton extends MetalScrollButton { public KunststoffScrollButton( int direction, int width, boolean freeStanding) { super(direction, width, freeStanding); } /** * Calls the super classes paint(Graphics g) method and then paints two gradients. * The direction of the gradients depends on the direction of the scrollbar. */ public void paint(Graphics g) { super.paint(g); int width = getWidth(); int height = getHeight(); Rectangle rectReflection; Rectangle rectShadow; boolean isVertical = (getDirection() == EAST || getDirection() == WEST); if (isVertical) { rectReflection = new Rectangle(1, 1, width, height/2); rectShadow = new Rectangle(1, height/2, width, height/2+1); } else { rectReflection = new Rectangle(1, 1, width/2, height); rectShadow = new Rectangle(width/2, 1, width/2+1, height); } // paint reflection gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rectReflection, isVertical); } // paint shadow gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rectShadow, isVertical); } } }src/com/incors/plaf/kunststoff/KunststoffTabbedPaneUI.java0000644000175000017500000000751310072545066024176 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com) * with contributions by Jamie LaScolea. * * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; public class KunststoffTabbedPaneUI extends BasicTabbedPaneUI { private static final int SHADOW_WIDTH = 5; public static ComponentUI createUI(JComponent c) { return new KunststoffTabbedPaneUI(); } protected void installDefaults() { super.installDefaults(); } /* * Thanks to a contribution by Jamie LaScolea this method now works with * multiple rows of tabs. */ protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) { super.paintTab(g, tabPlacement, rects, tabIndex, iconRect, textRect); Rectangle tabRect = rects[tabIndex]; Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); // paint shadow that the selected tab throws on the next tab int selectedIndex = tabPane.getSelectedIndex(); // the following statement was added by Jamie LaScolea as a bug fix. Thanks Jamie! if (this.lastTabInRun(tabPane.getTabCount(), this.selectedRun) != selectedIndex ){ if (tabPlacement == JTabbedPane.TOP || tabPlacement == JTabbedPane.BOTTOM) { if (tabIndex == selectedIndex+1) { Rectangle gradientRect = new Rectangle((int) tabRect.getX(), (int) tabRect.getY(), SHADOW_WIDTH, (int) tabRect.getHeight()); KunststoffUtilities.drawGradient(g, colorShadow, colorShadowFaded, gradientRect, false); } } else { if (tabIndex == selectedIndex+1) { Rectangle gradientRect = new Rectangle((int) tabRect.getX(), (int) tabRect.getY(), (int) tabRect.getWidth(), SHADOW_WIDTH); KunststoffUtilities.drawGradient(g, colorShadow, colorShadowFaded, gradientRect, true); } } } if (tabPlacement == JTabbedPane.TOP) { Rectangle gradientRect = new Rectangle((int) tabRect.getX(), (int) tabRect.getY(), (int) tabRect.getWidth(), (int) SHADOW_WIDTH); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, gradientRect, true); } else if (tabPlacement == JTabbedPane.BOTTOM) { if (tabIndex != selectedIndex) { Rectangle gradientRect = new Rectangle((int) tabRect.getX(), (int) tabRect.getY(), (int) tabRect.getWidth(), SHADOW_WIDTH); KunststoffUtilities.drawGradient(g, colorShadow, colorShadowFaded, gradientRect, true); } } else if (tabPlacement == JTabbedPane.RIGHT) { if (tabIndex != selectedIndex) { Rectangle gradientRect = new Rectangle((int) tabRect.getX(), (int) tabRect.getY(), (int) SHADOW_WIDTH, (int) tabRect.getHeight()); KunststoffUtilities.drawGradient(g, colorShadow, colorShadowFaded, gradientRect, false); } } } protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected ) { if ( isSelected ) { g.setColor(UIManager.getColor("TabbedPane.selected")); } else { g.setColor(tabPane.getBackgroundAt(tabIndex)); } switch(tabPlacement) { case LEFT: g.fillRect(x+1, y+1, w-2, h-3); break; case RIGHT: g.fillRect(x, y+1, w-2, h-3); break; case BOTTOM: g.fillRect(x+1, y, w-3, h-1); break; case TOP: default: g.fillRect(x+1, y+1, w-3, h-1); } } }src/com/incors/plaf/kunststoff/KunststoffTableHeaderUI.java0000644000175000017500000000277210072545066024353 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. * * This class was originally contributed by Jens Niemeyer, jens@jensn.de */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; public class KunststoffTableHeaderUI extends BasicTableHeaderUI { public static ComponentUI createUI(JComponent c) { return new KunststoffTableHeaderUI(); } public void paint(Graphics g, JComponent c) { super.paint(g, c); if (!c.isOpaque()) { return; // we only draw the gradients if the component is opaque } // paint reflection Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(0, 0, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, true); } // paint shadow Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(0, c.getHeight()/2, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, true); } } } src/com/incors/plaf/kunststoff/KunststoffTextAreaUI.java0000644000175000017500000000315107410325540023713 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com) * based on a contribution by Timo Haberkern. * It is published under the terms of the Lesser GNU Public License. */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; public class KunststoffTextAreaUI extends BasicTextAreaUI{ protected JComponent myComponent; public KunststoffTextAreaUI(JComponent c) { super(); myComponent = c; } public static ComponentUI createUI(JComponent c) { return new KunststoffTextAreaUI(c); } protected void paintBackground(Graphics g) { super.paintBackground(g); Rectangle editorRect = getVisibleEditorRect(); // paint upper gradient Color colorReflection = KunststoffLookAndFeel.getTextComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(editorRect.x, editorRect.y, editorRect.width, editorRect.height/2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, true); } // paint lower gradient Color colorShadow = KunststoffLookAndFeel.getTextComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(editorRect.x, editorRect.y+editorRect.height/2, editorRect.width, editorRect.height/2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, true); } } }src/com/incors/plaf/kunststoff/KunststoffTextFieldUI.java0000644000175000017500000000306307410122150024060 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; public class KunststoffTextFieldUI extends BasicTextFieldUI{ protected JComponent myComponent; public KunststoffTextFieldUI() { super(); } KunststoffTextFieldUI(JComponent c) { super(); myComponent = c; } public static ComponentUI createUI(JComponent c) { return new KunststoffTextFieldUI(c); } protected void paintBackground(Graphics g) { super.paintBackground(g); // paint upper gradient Color colorReflection = KunststoffLookAndFeel.getTextComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(0, 0, myComponent.getWidth(), myComponent.getHeight()/2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, true); } // paint lower gradient Color colorShadow = KunststoffLookAndFeel.getTextComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(0, myComponent.getHeight()/2, myComponent.getWidth(), myComponent.getHeight()/2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, true); } } }src/com/incors/plaf/kunststoff/KunststoffTheme.java0000644000175000017500000000223310072545066023007 0ustar twernertwernerpackage com.incors.plaf.kunststoff; import javax.swing.plaf.*; import javax.swing.plaf.metal.DefaultMetalTheme; public class KunststoffTheme extends DefaultMetalTheme { // primary colors private final ColorUIResource primary1 = new ColorUIResource(32, 32, 32); private final ColorUIResource primary2 = new ColorUIResource(160, 160, 180); private final ColorUIResource primary3 = new ColorUIResource(200, 200, 224); // secondary colors private final ColorUIResource secondary1 = new ColorUIResource(130, 130, 130); private final ColorUIResource secondary2 = new ColorUIResource(180, 180, 180); private final ColorUIResource secondary3 = new ColorUIResource(224, 224, 224); // methods public String getName() { return "Default Kunststoff Theme"; } protected ColorUIResource getPrimary1() { return primary1; } protected ColorUIResource getPrimary2() { return primary2; } protected ColorUIResource getPrimary3() { return primary3; } protected ColorUIResource getSecondary1() { return secondary1; } protected ColorUIResource getSecondary2() { return secondary2; } protected ColorUIResource getSecondary3() { return secondary3; } }src/com/incors/plaf/kunststoff/KunststoffToggleButtonUI.java0000644000175000017500000000733107410122244024613 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. * * This class was originally contributed by Jens Niemeyer, jens@jensn.de */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.metal.*; public class KunststoffToggleButtonUI extends MetalToggleButtonUI { private final static KunststoffToggleButtonUI buttonUI = new KunststoffToggleButtonUI(); public static ComponentUI createUI(JComponent c) { return buttonUI; } public void paint(Graphics g, JComponent c) { super.paint(g, c); if (!c.isOpaque()) { return; // we only draw the gradients if the component is opaque } Component parent = c.getParent(); if(parent instanceof JToolBar) { int orientation = ((JToolBar) parent).getOrientation(); Point loc = c.getLocation(); Rectangle rectReflection; Rectangle rectShadow; Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if(orientation == SwingConstants.HORIZONTAL) { // paint upper gradient if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); rectReflection = new Rectangle(0, -loc.y, parent.getWidth(), parent.getHeight()/2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rectReflection, true); } // paint lower gradient if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); rectShadow = new Rectangle(0, parent.getHeight()/2 - loc.y, parent.getWidth(), parent.getHeight()/2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rectShadow, true); } } else { // if tool bar orientation is vertical // paint left gradient if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); rectReflection = new Rectangle(0, 0, parent.getWidth()/2, parent.getHeight()); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rectReflection, false); } // paint right gradient if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); rectShadow = new Rectangle(parent.getWidth()/2 - loc.x, 0, parent.getWidth(), parent.getHeight()); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rectShadow, false); } } } else { // if not in tool bar // paint upper gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(0, 0, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, true); } // paint lower gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(0, c.getHeight()/2, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, true); } } } }src/com/incors/plaf/kunststoff/KunststoffToolBarUI.java0000644000175000017500000000511310072542626023544 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com) * based on a contribution by C.J. Kent * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.metal.*; public class KunststoffToolBarUI extends MetalToolBarUI { public static ComponentUI createUI(JComponent c) { return new KunststoffToolBarUI(); } public void paint(Graphics g, JComponent c) { super.paint(g, c); int orientation = SwingConstants.HORIZONTAL; if (c instanceof JToolBar) { orientation = ((JToolBar) c).getOrientation(); } if (orientation == SwingConstants.HORIZONTAL) { // paint upper (reflection) gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(0, 0, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, true); } // paint lower (shadow) gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(0, c.getHeight()/2, c.getWidth(), c.getHeight()/2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, true); } } else { // is orientation is vertical // paint left (reflection) gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(0, 0, c.getWidth()/2, c.getHeight()); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, false); } // paint right (shadow) gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(c.getWidth()/2, 0, c.getWidth()/2, c.getHeight()); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, false); } } } } src/com/incors/plaf/kunststoff/KunststoffTreeUI.java0000644000175000017500000000307410072545066023106 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com) * based on a contribution by Timo Haberkern. * It is published under the terms of the Lesser GNU Public License. */ import java.awt.*; import javax.swing.*; import javax.swing.tree.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; public class KunststoffTreeUI extends BasicTreeUI { protected static ImageIcon m_iconExpanded; protected static ImageIcon m_iconCollapsed; public KunststoffTreeUI(JComponent c) { try { m_iconExpanded = new ImageIcon(getClass().getResource("icons/treeex.gif")); m_iconCollapsed = new ImageIcon(getClass().getResource("icons/treecol.gif")); } catch (Exception e) { e.printStackTrace(); } } public static ComponentUI createUI(JComponent tree) { return new KunststoffTreeUI(tree); } // This method replaces the metal expand-/collaps-icons with some nicer ones. protected void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { if (isExpanded == true) { if (null != m_iconExpanded) { g.drawImage(m_iconExpanded.getImage(), bounds.x-17, bounds.y+4, null); } } else { if (null != m_iconCollapsed) { g.drawImage(m_iconCollapsed.getImage(), bounds.x-17, bounds.y+4, null); } } } }src/com/incors/plaf/kunststoff/KunststoffUtilities.java0000644000175000017500000000512607421404374023724 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import com.incors.plaf.*; /** * Collection of methods often used in the Kunststoff Look&Feel */ public class KunststoffUtilities { /** * Convenience method to create a translucent Color. */ public static Color getTranslucentColor(Color color, int alpha) { if (color == null) { return null; } else if (alpha == 255) { return color; } else { return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); } } /** * Convenience method to create a translucent ColorUIResource. */ public static Color getTranslucentColorUIResource(Color color, int alpha) { if (color == null) { return null; } else if (alpha == 255) { return color; } else { return new ColorUIResource2(color.getRed(), color.getGreen(), color.getBlue(), alpha); } } /** * Convenience method to draw a gradient on the specified rectangle */ public static void drawGradient(Graphics g, Color color1, Color color2, Rectangle rect, boolean isVertical) { Graphics2D g2D = (Graphics2D) g; Paint gradient = new FastGradientPaint(color1, color2, isVertical); g2D.setPaint(gradient); g2D.fill(rect); } /** * Convenience method to draw a gradient. The first rectangle defines the drawing region, * the second rectangle defines the size of the gradient. */ public static void drawGradient(Graphics g, Color color1, Color color2, Rectangle rect, Rectangle rect2, boolean isVertical) { // We are currently not using the FastGradientPaint to render this gradient, because we have to decide how // we can use FastGradientPaint if rect and rect2 are different. if (isVertical) { Graphics2D g2D = (Graphics2D) g; GradientPaint gradient = new GradientPaint(0f, (float) rect.getY(), color1, 0f, (float) (rect.getHeight() + rect.getY()), color2); g2D.setPaint(gradient); g2D.fill(rect); } else { Graphics2D g2D = (Graphics2D) g; GradientPaint gradient = new GradientPaint((float) rect.getX(), 0f, color1, (float) (rect.getWidth() + rect.getX()), 0f, color2); g2D.setPaint(gradient); g2D.fill(rect); } } /** * Returns true if the display uses 24- or 32-bit color depth (= true color) */ public static boolean isToolkitTrueColor(Component c) { int pixelsize = c.getToolkit().getColorModel().getPixelSize(); return pixelsize >= 24; } } src/com/incors/plaf/kunststoff/ModifiedDefaultListCellRenderer.java0000644000175000017500000000160707336162320026027 0ustar twernertwernerpackage com.incors.plaf.kunststoff; /* * This code was developed by INCORS GmbH (www.incors.com). * It is published under the terms of the GNU Lesser General Public License. */ import java.awt.*; import javax.swing.*; /** * The only difference between this class and the DefaultListCellRenderer is that * objects of this class are not opaque by default. */ public class ModifiedDefaultListCellRenderer extends DefaultListCellRenderer { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setOpaque(isSelected); return this; } }src/com/incors/plaf/kunststoff/themes/0000755000175000017500000000000010072542102020264 5ustar twernertwernersrc/com/incors/plaf/kunststoff/themes/KunststoffDesktopTheme.java0000644000175000017500000000430407410123014025612 0ustar twernertwerner/* * KunststoffDesktopTheme.java * * Created on 17. Oktober 2001, 22:40 */ package com.incors.plaf.kunststoff.themes; import java.awt.Font; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.FontUIResource; import javax.swing.UIDefaults; import javax.swing.UIManager; /** * * @author christophw * @version */ public class KunststoffDesktopTheme extends com.incors.plaf.kunststoff.KunststoffTheme { private FontUIResource controlFont; private FontUIResource menuFont; private FontUIResource windowTitleFont; private FontUIResource monospacedFont; /** * Crates this Theme */ public KunststoffDesktopTheme() { menuFont = new FontUIResource("Tahoma",Font.PLAIN, 12); controlFont = new FontUIResource("Tahoma",Font.PLAIN, 11); windowTitleFont = new FontUIResource("Tahoma", Font.BOLD, 12); monospacedFont = new FontUIResource("Monospaced", Font.PLAIN, 11); } public String getName() { return "Desktop"; } /** * The Font of Labels in many cases */ public FontUIResource getControlTextFont() { return controlFont; } /** * The Font of Menus and MenuItems */ public FontUIResource getMenuTextFont() { return menuFont; } /** * The Font of Nodes in JTrees */ public FontUIResource getSystemTextFont() { return controlFont; } /** * The Font in TextFields, EditorPanes, etc. */ public FontUIResource getUserTextFont() { return controlFont; } /** * The Font of the Title of JInternalFrames */ public FontUIResource getWindowTitleFont() { return windowTitleFont; } public void addCustomEntriesToTable(UIDefaults table) { super.addCustomEntriesToTable(table); UIManager.getDefaults().put("PasswordField.font", monospacedFont); UIManager.getDefaults().put("TextArea.font", monospacedFont); UIManager.getDefaults().put("TextPane.font", monospacedFont); UIManager.getDefaults().put("EditorPane.font", monospacedFont); } } src/com/incors/plaf/kunststoff/themes/KunststoffNotebookTheme.java0000644000175000017500000000654707410123014025774 0ustar twernertwerner/* * KunststoffDesktopTheme.java * * Created on 17. Oktober 2001, 22:40 */ package com.incors.plaf.kunststoff.themes; import java.awt.Font; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.FontUIResource; import javax.swing.UIDefaults; import javax.swing.UIManager; /** * * @author christophw * @version */ public class KunststoffNotebookTheme extends com.incors.plaf.kunststoff.KunststoffTheme { // primary colors private final ColorUIResource primary1 = new ColorUIResource(22, 22, 54); private final ColorUIResource primary2 = new ColorUIResource(110, 110, 130); private final ColorUIResource primary3 = new ColorUIResource(150, 150, 170); // secondary colors private final ColorUIResource secondary1 = new ColorUIResource(100, 100, 100); private final ColorUIResource secondary2 = new ColorUIResource(130, 130, 130); private final ColorUIResource secondary3 = new ColorUIResource(180, 180, 180); // private final ColorUIResource secondary3 = new ColorUIResource(224, 224, 224); // fonts private FontUIResource controlFont; private FontUIResource menuFont; private FontUIResource windowTitleFont; private FontUIResource monospacedFont; /** * Crates this Theme */ public KunststoffNotebookTheme() { menuFont = new FontUIResource("Tahoma",Font.PLAIN, 12); controlFont = new FontUIResource("Tahoma",Font.PLAIN, 11); windowTitleFont = new FontUIResource("Tahoma", Font.BOLD, 12); monospacedFont = new FontUIResource("Monospaced", Font.PLAIN, 11); } public String getName() { return "Notebook"; } /** * The Font of Labels in many cases */ public FontUIResource getControlTextFont() { return controlFont; } /** * The Font of Menus and MenuItems */ public FontUIResource getMenuTextFont() { return menuFont; } /** * The Font of Nodes in JTrees */ public FontUIResource getSystemTextFont() { return controlFont; } /** * The Font in TextFields, EditorPanes, etc. */ public FontUIResource getUserTextFont() { return controlFont; } /** * The Font of the Title of JInternalFrames */ public FontUIResource getWindowTitleFont() { return windowTitleFont; } protected ColorUIResource getPrimary1() { return primary1; } protected ColorUIResource getPrimary2() { return primary2; } protected ColorUIResource getPrimary3() { return primary3; } protected ColorUIResource getSecondary1() { return secondary1; } protected ColorUIResource getSecondary2() { return secondary2; } protected ColorUIResource getSecondary3() { return secondary3; } public void addCustomEntriesToTable(UIDefaults table) { super.addCustomEntriesToTable(table); UIManager.getDefaults().put("PasswordField.font", monospacedFont); UIManager.getDefaults().put("TextArea.font", monospacedFont); UIManager.getDefaults().put("TextPane.font", monospacedFont); UIManager.getDefaults().put("EditorPane.font", monospacedFont); } } src/com/incors/plaf/kunststoff/themes/KunststoffPresentationTheme.java0000644000175000017500000000672707410123014026667 0ustar twernertwerner/* * KunststoffDesktopTheme.java * * Created on 17. Oktober 2001, 22:40 */ package com.incors.plaf.kunststoff.themes; import java.awt.Font; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.FontUIResource; import javax.swing.UIDefaults; import javax.swing.UIManager; /** * * @author christophw * @version */ public class KunststoffPresentationTheme extends com.incors.plaf.kunststoff.KunststoffTheme { // primary colors private final ColorUIResource primary1 = new ColorUIResource(22, 22, 54); private final ColorUIResource primary2 = new ColorUIResource(110, 110, 130); private final ColorUIResource primary3 = new ColorUIResource(150, 150, 170); // secondary colors private final ColorUIResource secondary1 = new ColorUIResource(100, 100, 100); private final ColorUIResource secondary2 = new ColorUIResource(130, 130, 130); private final ColorUIResource secondary3 = new ColorUIResource(180, 180, 180); // private final ColorUIResource secondary3 = new ColorUIResource(224, 224, 224); // fonts private FontUIResource controlFont; private FontUIResource menuFont; private FontUIResource windowTitleFont; private FontUIResource monospacedFont; private FontUIResource textFont; /** * Crates this Theme */ public KunststoffPresentationTheme() { menuFont = new FontUIResource("Tahoma",Font.PLAIN, 17); controlFont = new FontUIResource("Tahoma",Font.PLAIN, 16); textFont = new FontUIResource("Tahoma",Font.PLAIN, 14); windowTitleFont = new FontUIResource("Tahoma", Font.BOLD, 17); monospacedFont = new FontUIResource("Monospaced", Font.PLAIN, 15); } public String getName() { return "Presentation"; } /** * The Font of Labels in many cases */ public FontUIResource getControlTextFont() { return controlFont; } /** * The Font of Menus and MenuItems */ public FontUIResource getMenuTextFont() { return menuFont; } /** * The Font of Nodes in JTrees */ public FontUIResource getSystemTextFont() { return controlFont; } /** * The Font in TextFields, EditorPanes, etc. */ public FontUIResource getUserTextFont() { return textFont; } /** * The Font of the Title of JInternalFrames */ public FontUIResource getWindowTitleFont() { return windowTitleFont; } protected ColorUIResource getPrimary1() { return primary1; } protected ColorUIResource getPrimary2() { return primary2; } protected ColorUIResource getPrimary3() { return primary3; } protected ColorUIResource getSecondary1() { return secondary1; } protected ColorUIResource getSecondary2() { return secondary2; } protected ColorUIResource getSecondary3() { return secondary3; } public void addCustomEntriesToTable(UIDefaults table) { super.addCustomEntriesToTable(table); UIManager.getDefaults().put("PasswordField.font", monospacedFont); UIManager.getDefaults().put("TextArea.font", monospacedFont); UIManager.getDefaults().put("TextPane.font", monospacedFont); UIManager.getDefaults().put("EditorPane.font", monospacedFont); } } licence.txt0000644000175000017500000005705407427612764013211 0ustar twernertwernerGNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS