Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to display text on image which keeps on getting changed ?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have successfully manage to display a text on JLabel but when ever i m changing that text , the other text is displayed on the same image to try to rub the orignally writen text with
but that is not helping me , the originally written text is not going out so that other text which i m drawing appears clearly
my code, can any one has done it before ?

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
super.paintComponent(g);
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:super.paintComponent(g);

still not getting the desire result
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you're calling displayTextOnImage() directly,
instead of calling panel.repaint(), which will call
displayTextOnImage()
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:you're calling displayTextOnImage() directly,
instead of calling panel.repaint(), which will call
displayTextOnImage()

done what you have said but still when i write Loading ... then after few second if I write Welcome then "welcome " appears over loading which makes every thing blur



 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is what you had


this is how it should be
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:this is what you had


this is how it should be


what i did ...




still the out come is not desired , facing same problem , if you want to look at the entire working code please tell me , i will put here
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> still the out come is not desired , facing same problem ,

if it's still blurred, you must be calling displayTextOnImage() directly, elsewhere.

just to make sure we're talking about them same thing, run this, click 'next' a couple of times,
then check the 'clear' checkbox and click 'next' a few more times.
the text will get increasingly more blurred until the checkbox is checked, then will be clear,
until checkbox is unchecked.

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> still the out come is not desired , facing same problem ,

if it's still blurred, you must be calling displayTextOnImage() directly, elsewhere.

just to make sure we're talking about them same thing, run this, click 'next' a couple of times,
then check the 'clear' checkbox and click 'next' a few more times.
the text will get increasingly more blurred until the checkbox is checked, then will be clear,
until checkbox is unchecked.


I guess this is where you are getting it all wrong or I have not get what you are saying
what you are doing is painting the surface of a panel
whereas
i m painting the image which is on label which in turn is on panel , so i guess instead of repaint image or panel we should repaint label with different image which contain different text...
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> still the out come is not desired , facing same problem ,

if it's still blurred, you must be calling displayTextOnImage() directly, elsewhere.

just to make sure we're talking about them same thing, run this, click 'next' a couple of times,
then check the 'clear' checkbox and click 'next' a few more times.
the text will get increasingly more blurred until the checkbox is checked, then will be clear,
until checkbox is unchecked.


viola ! we have done it , I was correct instead of painting component we should repaint image and reload it in jlabel , if you have not putted this above code then i would never realize what you were thinking .....thanks buddy .....
we have done it .....:)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic