
-----------------------------------
nonamedude
Fri May 07, 2010 11:38 pm

Help.... with graphics
-----------------------------------
I am writing an applet, and i am fairly new to it, still learning as I type. 
I was just wondering how to call a graphics method
this one for example
public void paint (int count[] [], Graphics g)
{

}

if this is nt possible, then, how to display a shape if a certain condtion is met
eg
if (int a ==1)
drawoval

ty for your help :)

-----------------------------------
DemonWasp
Sat May 08, 2010 4:29 am

RE:Help.... with graphics
-----------------------------------
The syntax is as follows:

[code]
if ( condition ) {
    conditional-statements
}
[/code]

-----------------------------------
TerranceN
Sat May 08, 2010 9:34 am

RE:Help.... with graphics
-----------------------------------
What do you mean by "calling a graphics method"? Do you mean how to draw stuff using a graphics object, or how to get a graphics object so you can call a method that requires one?

If it is the former, read [url=http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Graphics.html]this page.

If it is the latter, you need to have a component (things like applets and frames are components already) and call its getGraphics() method.

-----------------------------------
nonamedude
Sat May 08, 2010 11:03 am

Re: Help.... with graphics
-----------------------------------
What i i am stuck goes like this,

static int counter[] [] = new int [10] [10];

    public void init ()
    {
 button1 = new JButton ("Button1");
        button1.addActionListener (this);
        button1.setFont (f3);     
        button1.setBackground (Color.green);
        button1.setForeground (Color.white);
        contentPane.add (button1);
}
    public void actionPerformed (ActionEvent e)
    {
        if (e.getSource () == button1)
        {
         
            for (int x = 6 ; x 