当前位置: 首页>>代码示例>>Java>>正文


Java Painter.paint方法代码示例

本文整理汇总了Java中javax.swing.Painter.paint方法的典型用法代码示例。如果您正苦于以下问题:Java Painter.paint方法的具体用法?Java Painter.paint怎么用?Java Painter.paint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.Painter的用法示例。


在下文中一共展示了Painter.paint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paintComponent

import javax.swing.Painter; //导入方法依赖的package包/类
/**
 * Paint the component using the Nimbus Table Header Background Painter
 */
@Override protected void paintComponent(Graphics g) {
    Painter painter = (Painter) UIManager.get(
        "TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter");
    if (painter != null){
        if (g instanceof Graphics2D){
            painter.paint((Graphics2D)g,this,getWidth()+1,getHeight());
        } else {
            // paint using image to not Graphics2D to support
            // Java 1.1 printing API
            BufferedImage img =  new BufferedImage(getWidth(),getHeight(),
                    BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2 = (Graphics2D)img.getGraphics();
            painter.paint(g2,this,getWidth()+1,getHeight());
            g2.dispose();
            g.drawImage(img,0,0,null);
            img = null;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:TableScrollPaneCorner.java

示例2: paintComponent

import javax.swing.Painter; //导入方法依赖的package包/类
/**
 * Paint the component using the Nimbus Table Header Background Painter
 */
@Override protected void paintComponent(Graphics g) {
    @SuppressWarnings("unchecked")
    Painter<JComponent> painter = (Painter) UIManager.get(
        "TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter");
    if (painter != null){
        if (g instanceof Graphics2D){
            painter.paint((Graphics2D)g,this,getWidth()+1,getHeight());
        } else {
            // paint using image to not Graphics2D to support
            // Java 1.1 printing API
            BufferedImage img =  new BufferedImage(getWidth(),getHeight(),
                    BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2 = (Graphics2D)img.getGraphics();
            painter.paint(g2,this,getWidth()+1,getHeight());
            g2.dispose();
            g.drawImage(img,0,0,null);
            img = null;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:TableScrollPaneCorner.java

示例3: paintIcon

import javax.swing.Painter; //导入方法依赖的package包/类
/**
 * Implements the standard Icon interface's paintIcon method as the standard
 * synth stub passes null for the context and this will cause us to not
 * paint any thing, so we override here so that we can paint the enabled
 * state if no synth context is available
 */
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
    Painter painter = (Painter)UIManager.get(prefix + "[Enabled]." + key);
    if (painter != null){
        JComponent jc = (c instanceof JComponent) ? (JComponent)c : null;
        Graphics2D gfx = (Graphics2D)g;
        gfx.translate(x, y);
        painter.paint(gfx, jc , width, height);
        gfx.translate(-x, -y);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:NimbusIcon.java

示例4: paintIcon

import javax.swing.Painter; //导入方法依赖的package包/类
/**
 * Implements the standard Icon interface's paintIcon method as the standard
 * synth stub passes null for the context and this will cause us to not
 * paint any thing, so we override here so that we can paint the enabled
 * state if no synth context is available
 */
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
    Painter<JComponent> painter =
        paintFilter((Painter)UIManager.get(prefix + "[Enabled]." + key));
    if (painter != null){
        JComponent jc = (c instanceof JComponent) ? (JComponent)c : null;
        Graphics2D gfx = (Graphics2D)g;
        gfx.translate(x, y);
        painter.paint(gfx, jc , width, height);
        gfx.translate(-x, -y);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:NimbusIcon.java


注:本文中的javax.swing.Painter.paint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。