Articles
|
News
|
Weblogs
|
Books
|
Forums
Artima Forums
|
Articles
|
Weblogs
|
Java Answers
|
News
Sponsored Link
•
Java Answers Forum
Color in button
3
replies on
1
page.
Most recent reply
: Jan 6, 2004 8:59 PM by
Honey Maverick
Welcome
Guest
Sign In
Back to Topic List
Reply to this Topic
Search Forum
Threaded View
Previous Topic
Next Topic
Flat View: This topic has
3
replies on
1
page
Honey Maverick
Posts: 8
Nickname: maverick01
Registered: Jan, 2004
Color in button
Posted: Jan 5, 2004 8:20 PM
Reply
Advertisement
Here in this small program, how can i make my button in color. setColor method seems doesnt work. Pls explain detail coz i m jst a beginner in java.
public class ButtonCount extends Applet
{
private Button tester;
private int count=0;
public void init()
{
tester=new Button("Press me");
add(tester);
}
public void paint (Graphics g)
{
g.drawString("No of Button press is"+count,20,50);
}
public boolean action (Event event,Object arg)
{
if (event.target==tester)
count++;
repaint();
return true;
}
}
Delie
Posts: 12
Nickname: tuti
Registered: Oct, 2003
Re: Color in button
Posted: Jan 6, 2004 8:31 AM
Reply
Hello, did you drag and drop the button in the gui? if so its, easy. You click on the button and you change the color of the background of the button in the Properties tab in Design mode.
I hope you understood and i hope that I helped you
Delie
Posts: 12
Nickname: tuti
Registered: Oct, 2003
Re: Color in button
Posted: Jan 6, 2004 8:38 AM
Reply
hello again,
You can do it in the source too:
for example;
OkButton.setBackground(Color.red);
reply if it helped
Honey Maverick
Posts: 8
Nickname: maverick01
Registered: Jan, 2004
Thanx Tuti
Posted: Jan 6, 2004 8:59 PM
Reply
Great!!
I got it :D
Million Thanx,
Flat View: This topic has
3
replies on
1
page
Previous Topic
Next Topic
Sponsored Links
Web
Artima.com
Copyright
© 1996-2019 Artima, Inc. All Rights Reserved. -
Privacy Policy
-
Terms of Use