• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

one last try  RSS feed

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i will give it one last try.. and rephrase the question.
i have a set of lines on a jframe frame. now once iam in main after show(), i want to redraw these lines with new cordinates. how do i do this.
thank u
and sorry for the trouble
 
author and iconoclast
Posts: 24203
43
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do it the same way you drew them the first time, but with new coordinates?
Sorry, I know that's not helpful, but this isn't a very clear question. Apparently you've asked it before and not gotten an answer (by the way, if you had posted this as a follow-up to your earlier question, then I'd be able to read all the different versions together, and maybe all together, they'd make sense. But this one by itself, I can't really understand.)
Maybe if you showed us some code, in a reply on this same thread, then your question would make more sense. Also, please use the UBB "CODE" tags to format your code -- otherwise, we won't be able to read it.
 
Pranav Sharma
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u ernest.
iam a beginner at this. I understand that i will have to redraw with the new cordinates.
the problem is i dunno how exactly to do that.
my code is simple the paint method contains calls to draw lines and oval shapes.
and then in
public static void main(){
(code)
.
.
.
obj.show()
}
this creates the frame and then the figures in them.
now after show if i have to redraw the shapes what and where to do i add the code to repaint.
hope this is clears it up a lil bit
thank u
 
Pranav Sharma
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

this is the code i have, now i want to redraw the lines and oval points with new cordinates. what piece of code would i have to add for this and where would i have to add.
thank u
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
43
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, OK. Well, there are several ways you could do this, but here's one simple suggestion: replace your paint() method with this:

And in main(), when you want the picture to change, set paintMode to some non-zero value and then call f.repaint().
OK?
 
Pranav Sharma
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
works like a charm
thank u
any books you can recommend on java
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
43
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look around the Bunkhouse.
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!