本文整理匯總了Java中javax.swing.SwingUtilities.paintComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java SwingUtilities.paintComponent方法的具體用法?Java SwingUtilities.paintComponent怎麽用?Java SwingUtilities.paintComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.SwingUtilities
的用法示例。
在下文中一共展示了SwingUtilities.paintComponent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setComponent
import javax.swing.SwingUtilities; //導入方法依賴的package包/類
/**
* Set the cell renderer we will proxy.
*/
public void setComponent (Component jc, JComponent owner) {
Dimension dd = jc.getPreferredSize();
Rectangle currentScreenBounds = Utilities.getUsableScreenBounds();
// get some reasonable limit for the width
int width = Math.min(dd.width, 2 * currentScreenBounds.width);
int height = Math.min(dd.height + 2, 2 * currentScreenBounds.height);
Image nue = !Utilities.isMac() ? owner.createVolatileImage(width, height) :
new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics g = nue.getGraphics();
g.setColor (bg);
g.fillRect (0, 0, width, dd.height + 2);
if( jc instanceof Container && !jc.isValid() ) {
//#214739
jc.setSize( width, dd.height );
jc.doLayout();
}
SwingUtilities.paintComponent(g, jc, this, 0, 0, width, dd.height + 2);
g.dispose();
setImage (nue);
}
示例2: paintComponent
import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public void paintComponent(Graphics g) {
//Hack for issue 38132 - Beans are set via TTVBridge as a package
//private property on the parent PropertyPanel (if there is one).
//FindBeans() will locate the beans either in the model or as a
//property of the PropertyPanel (if an esoteric undocumented client property
//is set on the PropertyPanel). RendererFactory will set the env
//value (if there is an env) to the value of ReusablePropertyEnv.NODE
//(a performance hack to avoid creating 1 property env for each property
//painted each time we paint). Cool, huh?
reusableEnv.setNode(EditorPropertyDisplayer.findBeans(this));
JComponent comp = getRenderer(this);
prepareRenderer(comp);
comp.setBounds(0, 0, getWidth(), getHeight());
if (comp instanceof InplaceEditor) {
Component inner = findInnermostRenderer(comp);
SwingUtilities.paintComponent(g, comp, this, 0, 0, getWidth(), getHeight());
removeAll();
return;
}
comp.paint(g);
}
示例3: paintIcon
import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
SwingUtilities.paintComponent(
g, check, (Container) c, x, y, getIconWidth(), getIconHeight());
}