KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > contrib > poibrowser > Util


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19 package org.apache.poi.contrib.poibrowser;
20
21 import java.awt.*;
22 import javax.swing.*;
23
24 /**
25  * <p>Contains various (well, just one at the moment) static utility
26  * methods.</p>
27  *
28  * @author Rainer Klute <a
29  * HREF="mailto:klute@rainer-klute.de">&lt;klute@rainer-klute.de&gt;</a>
30  * @version $Id: Util.java,v 1.3 2004/04/09 13:05:08 glens Exp $
31  * @since 2002-01-25
32  */

33 public class Util
34 {
35
36     /**
37      * <p>Makes a Swing component inverted by swapping its foreground
38      * and background colors. Hint: Depending on your needs it might
39      * also be a good idea to call <tt>c.setOpaque(true)</tt>.</p>
40      */

41     public static void invert(final JComponent c)
42     {
43         final Color invBackground = c.getForeground();
44         final Color invForeground = c.getBackground();
45         c.setBackground(invBackground);
46         c.setForeground(invForeground);
47     }
48
49 }
50
51
Popular Tags