Help me with Java (Look if you know C++ also)
Simple Java. BreezySwing. For those of you who dont know, BreezySwing is an extension of Swing which was very hard to use for making GUI programs. C++is like java so if yoiu know that you could help me also. This is for my first computer science class, so dont expect mind bogglin, I'm expecting simple errors.
import java.awt.*;
import javax.swing.*;
import BreezySwing.*;
public class EventHandling3 extends GBFrame
{
// instance variables
public JLabel right;
public JLabel wrong;
public JLabel score;
public IntegerField right2;
public IntegerField wrong2;
public IntegerField score2;
public JButton calc;
public JButton reset;
int z;
int x;
int y;
public EventHandling3()
{
right = addLabel ("Right",1,1,1,1);
right2 = addIntegerField (0,1,2,1,2);
wrong = addLabel ("Wrong",2,1,1,1);
wrong2 = addIntegerField (0,2,2,1,2);
score = addLabel ("Score",3,1,1,1);
score2 = addIntegerField (0,3,2,1,2);
calc = addButton ("Calculate",4,1,1,1);
reset = addButton ("Reset",4,2,1,1);
}
public void buttonClicked(JButton buttonObj)
{
if(buttonObj == calc)
{
z = right2.getNumber();
x = wrong2.getNumber();
y = (z * 6) - (x * 2);
score2.setNumber(y);
}
if(buttonObj == reset)
{
right2.setNumber(0);
wrong2.setNumber(0);
score2.setNumber(0);
}
}
}
// main method
public static void main(String [ args)
{
EventHandling3 app = new EventHandling3()
app.setSize(200,200);
app.setTitle("Arav"
app.setVisible(true);
}
Edit: This looks ugly, cause it did not copy the alignment.
________________________
Watch the head humpers Gordon!
Edited by - Aravis/eX-Project on 2/8/2005 4:40:15 PM
Edited by - Aravis/eX-Project on 2/8/2005 4:50:11 PM
import java.awt.*;
import javax.swing.*;
import BreezySwing.*;
public class EventHandling3 extends GBFrame
{
// instance variables
public JLabel right;
public JLabel wrong;
public JLabel score;
public IntegerField right2;
public IntegerField wrong2;
public IntegerField score2;
public JButton calc;
public JButton reset;
int z;
int x;
int y;
public EventHandling3()
{
right = addLabel ("Right",1,1,1,1);
right2 = addIntegerField (0,1,2,1,2);
wrong = addLabel ("Wrong",2,1,1,1);
wrong2 = addIntegerField (0,2,2,1,2);
score = addLabel ("Score",3,1,1,1);
score2 = addIntegerField (0,3,2,1,2);
calc = addButton ("Calculate",4,1,1,1);
reset = addButton ("Reset",4,2,1,1);
}
public void buttonClicked(JButton buttonObj)
{
if(buttonObj == calc)
{
z = right2.getNumber();
x = wrong2.getNumber();
y = (z * 6) - (x * 2);
score2.setNumber(y);
}
if(buttonObj == reset)
{
right2.setNumber(0);
wrong2.setNumber(0);
score2.setNumber(0);
}
}
}
// main method
public static void main(String [ args)
{
EventHandling3 app = new EventHandling3()
app.setSize(200,200);
app.setTitle("Arav"
app.setVisible(true);
}
Edit: This looks ugly, cause it did not copy the alignment.
________________________
Watch the head humpers Gordon!
Edited by - Aravis/eX-Project on 2/8/2005 4:40:15 PM
Edited by - Aravis/eX-Project on 2/8/2005 4:50:11 PM