Search Results

Search found 2 results on 1 pages for 'kovike'.

Page 1/1 | 1 

  • How to draw on JPanel on fixed position?

    - by kovike
    I have JPanel wrapped in JScrollPane and I want the rectangle to be drawn always on the same position = moving with scrollbars wont affect the visibility of the rectangle. I tried following code: public void paintComponent(Graphics g) { g.setColor(Color.red); g.drawRect(50, (int)getVisibleRect().getY(), 20 , 20); } but it only repaints the rectangle when size of whole JPanel is changed.

    Read the article

1