home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
jfc.bin
/
WindowsTreeUI.java
< prev
next >
Wrap
Text File
|
1998-02-26
|
4KB
|
117 lines
/*
* @(#)WindowsTreeUI.java 1.8 98/02/02
*
* Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the confidential and proprietary information of Sun
* Microsystems, Inc. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Sun.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
* THIS SOFTWARE OR ITS DERIVATIVES.
*
*/
package com.sun.java.swing.plaf.windows;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import com.sun.java.swing.plaf.basic.*;
import com.sun.java.swing.*;
import com.sun.java.swing.plaf.*;
/**
* A Windows tree.
* <p>
* Warning: serialized objects of this class will not be compatible with
* future swing releases. The current serialization support is appropriate
* for short term storage or RMI between Swing1.0 applications. It will
* not be possible to load serialized Swing1.0 objects with future releases
* of Swing. The JDK1.2 release of Swing will be the compatibility
* baseline for the serialized form of Swing objects.
*
* @version 1.8 02/02/98
* @author unknown
*/
public class WindowsTreeUI extends BasicTreeUI {
public static ComponentUI createUI( JComponent c )
{
return new WindowsTreeUI();
}
protected void drawVerticalLine( Graphics g, JComponent c, int x, int top, int bottom )
{
drawDashedVerticalLine( g, x, top, bottom );
}
protected void drawHorizontalLine( Graphics g, JComponent c, int y, int left, int right )
{
drawDashedHorizontalLine( g, y, left, right );
}
static protected final int HALF_SIZE = 4;
static protected final int SIZE = 9;
/**
* The minus sign button icon
* <p>
* Warning: serialized objects of this class will not be compatible with
* future swing releases. The current serialization support is appropriate
* for short term storage or RMI between Swing1.0 applications. It will
* not be possible to load serialized Swing1.0 objects with future releases
* of Swing. The JDK1.2 release of Swing will be the compatibility
* baseline for the serialized form of Swing objects.
*/
public static class ExpandedIcon implements Icon, Serializable {
static public Icon createExpandedIcon() {
return new ExpandedIcon();
}
public void paintIcon(Component c, Graphics g, int x, int y) {
g.setColor(Color.white);
g.fillRect(x, y, SIZE-1, SIZE-1);
g.setColor(Color.gray);
g.drawRect(x, y, SIZE-1, SIZE-1);
g.setColor(Color.black);
g.drawLine(x + 2, y + HALF_SIZE, x + (SIZE - 3), y + HALF_SIZE);
}
public int getIconWidth() { return SIZE; }
public int getIconHeight() { return SIZE; }
}
/**
* The plus sign button icon
* <p>
* Warning: serialized objects of this class will not be compatible with
* future swing releases. The current serialization support is appropriate
* for short term storage or RMI between Swing1.0 applications. It will
* not be possible to load serialized Swing1.0 objects with future releases
* of Swing. The JDK1.2 release of Swing will be the compatibility
* baseline for the serialized form of Swing objects.
*/
public static class CollapsedIcon extends ExpandedIcon {
static public Icon createCollapsedIcon() {
return new CollapsedIcon();
}
public void paintIcon(Component c, Graphics g, int x, int y) {
super.paintIcon(c, g, x, y);
g.drawLine(x + HALF_SIZE, y + 2, x + HALF_SIZE, y + (SIZE - 3));
}
}
}