• Post Reply Bookmark Topic Watch Topic
  • New Topic

swiing repaint

 
kumar mars
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

have a problem with swing repaintig
i have jpanel attached to jframe. jpanel has a paint function and a function to draw a line(this has nothing to do with the whole component it just drtaws a vertical line in panel). when a call is made to repaint followed by a call to draw the line the repaint is never executed immediatly.
it is getting executing only at the end of the function in which the calls are made.
how can i make it executed immediatly.
immediate response please
the lines from code are
panel.repaint();
panel.drawline();
i want secound istructruction to be executed only after the painting is over
its urgent please help
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kumar,
The only way to have it happen in the correct order is to place the call to drawline at the end of your paint method.

That way you can know your painting will get done first!
Regards,
Manfred.
 
kumar mars
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried tat way but no use the function is getting called but line is not coming up
 
d kiruthika
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try
repaint();
drawline();
repaint(); //again

Originally posted by kumar mars:
i tried tat way but no use the function is getting called but line is not coming up

 
Brian Snyder
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everybody!!!
I have an applet that creates a JTable from a servlet with information from a database. Within the same applet I'm having more than one method create a JTable to the JApplet. I try getContentPane().remove() to reset the data in the chart as well as getCOntentPane().validate() and even getContentPane().repaint..... My problem is that if the table previous to the new one has more rows of information than the new one, the old data is still visible.
I did a search on this site for an answer and haven't found a clear and exact one yet. Could someone take the time to kindly respond to this problem??
Many thanks in advance!!!
 
Brian Snyder
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everybody!!!
I have an applet that creates a JTable from a servlet with information from a database. Within the same applet I'm having more than one method create a JTable to the JApplet. I try getContentPane().remove() to reset the data in the chart as well as getCOntentPane().validate() and even getContentPane().repaint..... My problem is that if the table previous to the new one has more rows of information than the new one, the old data is still visible.
I did a search on this site for an answer and haven't found a clear and exact one yet. Could someone take the time to kindly respond to this problem??
Many thanks in advance!!!
 
Amit Agarwal
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian,
try using:
AbstractTableModel.fireTableDataChanged();
replace AbstractTableModel by your table model instance
----------
Amit
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!