aspose file tools*
The moose likes Beginning Java and the fly likes Buttons and action events Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Buttons and action events" Watch "Buttons and action events" New topic
Author

Buttons and action events

jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24


it says that this code wont run this is what it exactly says:

--------------------Configuration: Sentinel_Controlled_Loops - JDK version 1.5.0_06 <Default>--------------------
C:\Documents and Settings\\Desktop\programs before applets\Sentinel Controlled Loops\TwoButtons.java:28: cannot find symbol
symbol : variable colour
location: class TwoButtons
getContentPane().setBackground( colour.red );
^
C:\Documents and Settings\\Desktop\programs before applets\Sentinel Controlled Loops\TwoButtons.java:30: cannot find symbol
symbol : variable colour
location: class TwoButtons
getContentPane().setBackground( colour.green );
^
2 errors

Process completed.
---------------------------------------------------------------------------
all im going to do is take apart this program so that i can have the border with the buttons. is there any easier way of just having the border and the buttons and when i click one of them it leads to another box and each button has a diffrent outcome
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39791
    
  28
Your error stopping it from running is surprisingly minor.
Go and look in the API specification (which you ought to have open on-screen in front of you whenever you are programming) and find the correct spelling of the class in java.awt which manipulates colours.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39791
    
  28
And don't try taking the program apart to change it before you get it to run first time.
Subhajit Mitra
Greenhorn

Joined: Jun 06, 2006
Posts: 21
java is case sensitive and with all those whole lot of classes and methods it becomes very messy for beginners, but if u follow conventions it becomes quite easier to read, write and debug codes as well as to remember class & method names

http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
sam logo
Greenhorn

Joined: Feb 01, 2006
Posts: 6
It is really simple to execute this programme.the code convention for colour in java.awt class is written as following
public void actionPerformed( ActionEvent evt)
{
// check which command has been sent
if ( evt.getActionCommand().equals( "red" ) )getContentPane().setBackground( Color.red );
else getContentPane().setBackground( Color.green );
repaint();
}

Try this
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Buttons and action events