本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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);
}
}
示例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);
}
}