![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Aug 2005
Posts: 2
Rep Power: 0
![]() |
program problem
i am (trying) to write a program that moves a circle left, right, up and down using buttons. Also i need it to be able to change the colour of the circle.
Im totally lost import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Balloons extends JFrame implements ActionListener {
private JButton growButton, moveButton;
private JPanel panel;
private Balloons balloon;
public static void main(String[] args) {
Balloons frame = new Balloons();
frame.setSize(200,220);
frame.createGUI();
frame.show();
}
private void createGUI() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container window = getContentPane();
window.setLayout(new FlowLayout());
panel = new JPanel();
panel.setPreferredSize(new Dimension(150, 150));
panel.setBackground(Color.white);
window.add(panel);
moveButton = new JButton("move");
window.add(moveButton);
moveButton.addActionListener(this);
growButton = new JButton("grow");
window.add(growButton);
growButton.addActionListener(this);
balloon = new Balloons();
}
public void actionPerformed(ActionEvent event) {
Graphics paper = panel.getGraphics();
if (event.getSource() == moveButton) {
balloon.MoveRight(20); <cannot resolve symbol method MoveRight(int)>
}
else {
balloon.changeSize(20);<cannot resolve symbol method changeSize (int)>
}
paper.setColor(Color.white);
paper.fillRect(0, 0, 150, 150);
balloon.display(paper);<cannot resolve symbol method display (java.awt.Graphics)>
}
}the errors are in red :o thanks for any help you can give ![]() |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4
![]() |
OOOOOOhh, who might you YOU possibly be?? :eek:
__________________
-Steven "Is this a piece of your brain?" - Basil Fawlty |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Aug 2005
Posts: 2
Rep Power: 0
![]() |
Im Nic, Chris (Hadrurus) is my boyfriend he said he uses this forum - were doing the same projects at university and he recommended this site for help
![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|