• Post Reply Bookmark Topic Watch Topic
  • New Topic

SWING appearence  RSS feed

 
Prashanth Bhanu
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

In JSps we have a way to define the body,Background colour etc ...by creating CSS file and using it across the JSp pages.
But in swing is there any way to achieve the same concept??.Please show me the way to do that.

Thanks in advance

Prashanth
 
Stephen Zhang
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Prashanth,

you can use different themes, hope following reference can give you some idea.

http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html#example

http://java.sun.com/products/jfc/jws/SwingSet2.jnlp
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
modify the UIManager defaults
e.g.
UIManager.put("Button.foreground", new javax.swing.plaf.ColorUIResource(Color.YELLOW));

will give you yellow text on JButtons

you'll find a link to a program that shows the defaults here

http://www.coderanch.com/t/341831/GUI/java/All-Widgets-Properties

if you just wanted to change the text color for a single button, you'd just use
button.setForeground(Color.YELLOW);
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben Galbraith spoke about this in a Swing presentation I saw at JavaOne 2006 - you can go here's a PDF of the presentation. The "CSS for Swing" related stuff starts around page 15. However, the source code he references isn't on his site (as of the time I write this... ) but maybe the presentation will give you some ideas of how to do this yourself...
 
Prashanth Bhanu
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

Thanks for those replies.One must read the PDF recommanded by Nathan Pruett.Got a way to start with CSS stuff for my Swing application.
Thanks once again.............
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!