Thread View: pl.comp.lang.java
1 messages
1 total messages
Started by Artur Tyloch
Mon, 22 Sep 1997 19:03
paint -> update || update -> paint
Author: Artur Tyloch
Date: Mon, 22 Sep 1997 19:03
Date: Mon, 22 Sep 1997 19:03
45 lines
1675 bytes
1675 bytes
Jaka jest roznica miedzy implementacja gdy metoda paint wola
metode update a sytuacja gdy update wola paint:
// w watku zmieniana jest zmienna m_Y
// okreslajaca miejsce wykreslania napisu
// i zm. m_oldY (stare miejsce do zamazania)
public void paint(Graphics g)
{
// bo AWT niekiedy woła paint() bezposrednio
update(g);
}
public void update(Graphics g)
{
//wymazywanie
g.setColor(getBackground() );
g.drawString("ARTUR TYLOCH", 20, m_oldY);
// rysowanie na nowej pozycji
g.setColor(Color.white);
g.drawString("ARTUR TYLOCH", 20, m_Y);
}
a.....
public void paint(Graphics g)
{
//wymazywanie
g.setColor(getBackground() );
g.drawString("ARTUR TYLOCH", 20, m_oldY);
// rysowanie na nowej pozycji
g.setColor(Color.white);
g.drawString("ARTUR TYLOCH", 20, m_Y);
}
public void update(Graphics g)
{
paint(g)
}
Ta pierwsza metodologia jest w Tutorialu Sun'a
w rozdziale poswieconym eliminowaniu migotania
przy rysowaniu.
Ten drugi sposob tez jest czesto spotykany.
Artur
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads