當前位置: 首頁>>代碼示例>>Java>>正文


Java SwingUtilities.paintComponent方法代碼示例

本文整理匯總了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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:ViewTooltips.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:RendererPropertyDisplayer.java

示例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());
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:6,代碼來源:TableCheckBoxColumn.java


注:本文中的javax.swing.SwingUtilities.paintComponent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。