📄 synthpainter.java
字号:
/* * @(#)SynthPainter.java 1.13 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package javax.swing.plaf.synth;import java.awt.*;import javax.swing.*;/** * <code>SynthPainter</code> is used for painting portions of * <code>JComponent</code>s. At a minimum each <code>JComponent</code> * has two paint methods: one for the border and one for the background. Some * <code>JComponent</code>s have more than one <code>Region</code>, and as * a consequence more paint methods. * <p> * Instances of <code>SynthPainter</code> are obtained from the * {@link javax.swing.plaf.synth.SynthStyle#getPainter} method. * <p> * You typically supply a <code>SynthPainter</code> by way of Synth's * <a href="doc-files/synthFileFormat.html">file</a> format. The following * example registers a painter for all <code>JButton</code>s that will * render the image <code>myImage.png</code>: * <pre> * <style id="buttonStyle"> * <imagePainter path="myImage.png" sourceInsets="2 2 2 2" * paintCenter="true" stretch="true"/> * <insets top="2" bottom="2" left="2" right="2"/> * </style> * <bind style="buttonStyle" type="REGION" key="button"/> *</pre> * <p> * <code>SynthPainter</code> is abstract in so far as it does no painting, * all the methods * are empty. While none of these methods are typed to throw an exception, * subclasses can assume that valid arguments are passed in, and if not * they can throw a <code>NullPointerException</code> or * <code>IllegalArgumentException</code> in response to invalid arguments. * * @version 1.13, 11/17/05 * @since 1.5 * @author Scott Violet */public abstract class SynthPainter { /** * Used to avoid null painter checks everywhere. */ static SynthPainter NULL_PAINTER = new SynthPainter() {}; /** * Paints the background of an arrow button. Arrow buttons are created by * some components, such as <code>JScrollBar</code>. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintArrowButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the border of an arrow button. Arrow buttons are created by * some components, such as <code>JScrollBar</code>. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintArrowButtonBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the foreground of an arrow button. This method is responsible * for drawing a graphical representation of a direction, typically * an arrow. Arrow buttons are created by * some components, such as <code>JScrollBar</code> * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to * @param direction One of SwingConstants.NORTH, SwingConstants.SOUTH * SwingConstants.EAST or SwingConstants.WEST */ public void paintArrowButtonForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int direction) { } /** * Paints the background of a button. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the border of a button. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintButtonBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the background of a check box menu item. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintCheckBoxMenuItemBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the border of a check box menu item. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintCheckBoxMenuItemBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the background of a check box. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintCheckBoxBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the border of a check box. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintCheckBoxBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the background of a color chooser. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintColorChooserBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the border of a color chooser. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintColorChooserBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the background of a combo box. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintComboBoxBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the border of a combo box. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintComboBoxBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the background of a desktop icon. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintDesktopIconBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the border of a desktop icon. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintDesktopIconBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the background of a desktop pane. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to * @param g <code>Graphics</code> to paint to * @param x X coordinate of the area to paint to * @param y Y coordinate of the area to paint to * @param w Width of the area to paint to * @param h Height of the area to paint to */ public void paintDesktopPaneBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { } /** * Paints the background of a desktop pane. * * @param context SynthContext identifying the <code>JComponent</code> and * <code>Region</code> to paint to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -