Java Swing. PaintingComponent

Dasha

Could you tell me, how can I pass variables (in this case - a) to the paintComponent? I think that way is wrong:

class PaintingComponent extends JPanel
{
    public void paintComponent(Graphics g, int a)
    {       
        raster.setPixel( 12, a, clr ); 
    }//paintComponent(Graphics g)
}
Distjubo

There is no way. Thats how class hierarchies work, if you want to override a method, it has to have the same signature. The only thing you could do is get a from a method call.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事