微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.swing.Painter的实例源码

项目:Openjsharp    文件TableScrollPaneCorner.java   
/**
 * 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,getHeight());
            g2.dispose();
            g.drawImage(img,null);
            img = null;
        }
    }
}
项目:jdk8u-jdk    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:openjdk-jdk10    文件SynthPainterImpl.java   
private void paintBackground(SynthContext ctx,Graphics g,int x,int y,int w,int h,AffineTransform transform) {
    // if the background color of the component is 100% transparent
    // then we should not paint any background graphics. This is a solution
    // for there being no way of turning off Nimbus background painting as
    // basic components are all non-opaque by default.
    Component c = ctx.getComponent();
    Color bg = (c != null) ? c.getBackground() : null;
    if (bg == null || bg.getAlpha() > 0){

        Painter<Object> backgroundPainter = style.getBackgroundPainter(ctx);
        if (backgroundPainter != null) {
            paint(backgroundPainter,ctx,g,x,y,w,h,transform);
        }
    }
}
项目:openjdk-jdk10    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:openjdk-jdk10    文件Nimbusstyle.java   
/**
 * Gets the appropriate background Painter,if there is one,for the state
 * specified in the given SynthContext. This method does appropriate
 * fallback searching,as described in #get.
 *
 * @param ctx The SynthContext. Must not be null.
 * @return The background painter associated for the given state,or null if
 * none Could be found.
 */
public Painter<Object> getBackgroundPainter(SynthContext ctx) {
    Values v = getValues(ctx);
    int xstate = getExtendedState(ctx,v);
    Painter<Object> p = null;

    // check the cache
    tmpKey.init("backgroundPainter$$instance",xstate);
    p = paintFilter((Painter)v.cache.get(tmpKey));
    if (p != null) return p;

    // not in cache,so lookup and store in cache
    RuntimeState s = null;
    int[] lastIndex = new int[] {-1};
    while ((s = getNextState(v.states,lastIndex,xstate)) != null) {
        if (s.backgroundPainter != null) {
            p = paintFilter(s.backgroundPainter);
            break;
        }
    }
    if (p == null) p = paintFilter((Painter)get(ctx,"backgroundPainter"));
    if (p != null) {
        v.cache.put(new CacheKey("backgroundPainter$$instance",xstate),p);
    }
    return p;
}
项目:openjdk-jdk10    文件Nimbusstyle.java   
/**
 * Gets the appropriate foreground Painter,as described in #get.
 *
 * @param ctx The SynthContext. Must not be null.
 * @return The foreground painter associated for the given state,or null if
 * none Could be found.
 */
public Painter<Object> getForegroundPainter(SynthContext ctx) {
    Values v = getValues(ctx);
    int xstate = getExtendedState(ctx,v);
    Painter<Object> p = null;

    // check the cache
    tmpKey.init("foregroundPainter$$instance",xstate)) != null) {
        if (s.foregroundPainter != null) {
            p = paintFilter(s.foregroundPainter);
            break;
        }
    }
    if (p == null) p = paintFilter((Painter)get(ctx,"foregroundPainter"));
    if (p != null) {
        v.cache.put(new CacheKey("foregroundPainter$$instance",p);
    }
    return p;
}
项目:openjdk-jdk10    文件Nimbusstyle.java   
/**
 * Gets the appropriate border Painter,as described in #get.
 *
 * @param ctx The SynthContext. Must not be null.
 * @return The border painter associated for the given state,or null if
 * none Could be found.
 */
public Painter<Object> getBorderPainter(SynthContext ctx) {
    Values v = getValues(ctx);
    int xstate = getExtendedState(ctx,v);
    Painter<Object> p = null;

    // check the cache
    tmpKey.init("borderPainter$$instance",xstate)) != null) {
        if (s.borderPainter != null) {
            p = paintFilter(s.borderPainter);
            break;
        }
    }
    if (p == null) p = paintFilter((Painter)get(ctx,"borderPainter"));
    if (p != null) {
        v.cache.put(new CacheKey("borderPainter$$instance",p);
    }
    return p;
}
项目:openjdk9    文件SynthPainterImpl.java   
private void paintBackground(SynthContext ctx,transform);
        }
    }
}
项目:openjdk9    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:openjdk9    文件Nimbusstyle.java   
/**
 * Gets the appropriate background Painter,p);
    }
    return p;
}
项目:openjdk9    文件Nimbusstyle.java   
/**
 * Gets the appropriate foreground Painter,p);
    }
    return p;
}
项目:openjdk9    文件Nimbusstyle.java   
/**
 * Gets the appropriate border Painter,p);
    }
    return p;
}
项目:Java8CN    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:jdk8u_jdk    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:infobip-open-jdk-8    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:jdk8u-dev-jdk    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:jdk7-jdk    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:openjdk-source-code-learn    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:OLD-OpenJDK8    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:openjdk-jdk7u-jdk    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:openjdk-icedtea7    文件TableScrollPaneCorner.java   
/**
 * 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,null);
            img = null;
        }
    }
}
项目:Openjsharp    文件SynthPainterImpl.java   
private void paintBackground(SynthContext ctx,AffineTransform transform) {
    // if the background color of the component is 100% transparent
    // then we should not paint any background graphics. This is a solution
    // for there being no way of turning off Nimbus background painting as
    // basic components are all non-opaque by default.
    Component c = ctx.getComponent();
    Color bg = (c != null) ? c.getBackground() : null;
    if (bg == null || bg.getAlpha() > 0){
        Painter backgroundPainter = style.getBackgroundPainter(ctx);
        if (backgroundPainter != null) {
            paint(backgroundPainter,transform);
        }
    }
}
项目:Openjsharp    文件SynthPainterImpl.java   
private void paintForeground(SynthContext ctx,AffineTransform transform) {
    Painter foregroundPainter = style.getForegroundPainter(ctx);
    if (foregroundPainter != null) {
        paint(foregroundPainter,transform);
    }
}
项目:Openjsharp    文件SynthPainterImpl.java   
private void paintBorder(SynthContext ctx,AffineTransform transform) {
    Painter borderPainter = style.getBorderPainter(ctx);
    if (borderPainter != null) {
        paint(borderPainter,transform);
    }
}
项目:Openjsharp    文件Nimbusstyle.java   
private Painter getPainter(Map<String,Object> defaults,String key) {
    Object p = defaults.get(key);
    if (p instanceof UIDefaults.LazyValue) {
        p = ((UIDefaults.LazyValue)p).createValue(UIManager.getDefaults());
    }
    return (p instanceof Painter ? (Painter)p : null);
}
项目:Openjsharp    文件NimbusIcon.java   
/**
 * 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,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);
    }
}
项目:jdk8u-jdk    文件SynthPainterImpl.java   
private void paintBackground(SynthContext ctx,transform);
        }
    }
}
项目:jdk8u-jdk    文件SynthPainterImpl.java   
private void paintForeground(SynthContext ctx,transform);
    }
}
项目:jdk8u-jdk    文件SynthPainterImpl.java   
private void paintBorder(SynthContext ctx,transform);
    }
}
项目:jdk8u-jdk    文件Nimbusstyle.java   
private Painter getPainter(Map<String,String key) {
    Object p = defaults.get(key);
    if (p instanceof UIDefaults.LazyValue) {
        p = ((UIDefaults.LazyValue)p).createValue(UIManager.getDefaults());
    }
    return (p instanceof Painter ? (Painter)p : null);
}
项目:jdk8u-jdk    文件NimbusIcon.java   
/**
 * 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,-y);
    }
}
项目:openjdk-jdk10    文件SynthPainterImpl.java   
private void paintForeground(SynthContext ctx,AffineTransform transform) {
    Painter<Object> foregroundPainter = style.getForegroundPainter(ctx);
    if (foregroundPainter != null) {
        paint(foregroundPainter,transform);
    }
}
项目:openjdk-jdk10    文件SynthPainterImpl.java   
private void paintBorder(SynthContext ctx,AffineTransform transform) {
    Painter<Object> borderPainter = style.getBorderPainter(ctx);
    if (borderPainter != null) {
        paint(borderPainter,transform);
    }
}
项目:openjdk-jdk10    文件Nimbusstyle.java   
private Painter<Object> getPainter(Map<String,String key) {
    Object p = defaults.get(key);
    if (p instanceof UIDefaults.LazyValue) {
        p = ((UIDefaults.LazyValue)p).createValue(UIManager.getDefaults());
    }
    @SuppressWarnings("unchecked")
    Painter<Object> tmp = (p instanceof Painter ? (Painter)p : null);
    return tmp;
}
项目:openjdk-jdk10    文件NimbusIcon.java   
/**
 * 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,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);
    }
}
项目:openjdk9    文件SynthPainterImpl.java   
private void paintForeground(SynthContext ctx,transform);
    }
}
项目:openjdk9    文件SynthPainterImpl.java   
private void paintBorder(SynthContext ctx,transform);
    }
}
项目:openjdk9    文件Nimbusstyle.java   
private Painter<Object> getPainter(Map<String,String key) {
    Object p = defaults.get(key);
    if (p instanceof UIDefaults.LazyValue) {
        p = ((UIDefaults.LazyValue)p).createValue(UIManager.getDefaults());
    }
    @SuppressWarnings("unchecked")
    Painter<Object> tmp = (p instanceof Painter ? (Painter)p : null);
    return tmp;
}
项目:openjdk9    文件NimbusIcon.java   
/**
 * 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,-y);
    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。