Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 15th, 2005, 12:04 PM   #1
Curly Nic
Newbie
 
Curly Nic's Avatar
 
Join Date: Aug 2005
Posts: 2
Rep Power: 0 Curly Nic is on a distinguished road
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
Curly Nic is offline   Reply With Quote
Old Aug 15th, 2005, 12:27 PM   #2
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
OOOOOOhh, who might you YOU possibly be?? :eek:
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Old Aug 15th, 2005, 12:38 PM   #3
Curly Nic
Newbie
 
Curly Nic's Avatar
 
Join Date: Aug 2005
Posts: 2
Rep Power: 0 Curly Nic is on a distinguished road
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
Curly Nic is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:19 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC