• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Button Colors

 
keith withers
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to write my first applet, I want to diplay text and be able to click on it. I thought an easy method would be to use buttons and change the button colors to white but leave the text color black.
How do I do this, is there a button border color as well?
Many thanks
Keith
Code:-
setLayout(new BorderLayout());
Panel p = new Panel();
p.setLayout(new GridLayout(1,0));
p.add(new Button("Uncle Bob"));
 
LiL Kunji
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.
JButton bob = new JButton("Uncle Bob");
bob.setBackground(null);
bob.setBorder(null);
this will give u what u want but pay attention to what this does to the cell size. it might be a problem and it might not. u can change the color of the Uncle bob like this:
bob.setForeground(Color.red);
i used JButton u can try with Button
hope this helped
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic