Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Add a background image to a JPanel & JTextArea

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I just am writting a chat program. Like in MSN I want to give the user to change the background of the Text area where they are chatting. In the same time, is it possible to add a background image to a panel. So the interface looks good.
Thank you very much.
 
Carlos Failde
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Subclass the relevant component and override the paint(Graphics g) method to draw the background image.
An example
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Swing / JFC / AWT forum...
 
no wonder he is so sad, he hasn't seen this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!