Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #736

Re: coordinate system and

From "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this>
Subject Re: coordinate system and
Message-ID <6rWrh.760$LK5.733@newsfe04.lga> (permalink)
Newsgroups comp.lang.java.gui
References <13Wrh.22123$cv2.10007@newsfe13.lga>
Date 2011-04-27 15:29 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui

Knute Johnson wrote:
> Jeff Higgins wrote:
>> Andrew Thompson wrote:
>>> Jeff Higgins wrote:
>>>
>>>> Will someone explain what I'm doing wrong?
>>>  setLayout(new BorderLayout());
>>>
>>> ..in the the constructor of Ruler - and the red/black
>>> lines will then 'align'.
>>>
>>> Andrew T.
>>>
>> Thanks for the help
>> much appreciated.
>> JH
>
> You might also move your drawing code from paint() to paintComponent() for 
> Swing components.
>
> -- 
>
> Knute Johnson
> email s/nospam/knute/

When I started this, I had originally drawn the ruler's ticks
and cursor in one JPanel contained in the JScrollPanel' HeaderViews,
but I got a lot of flicker when I moved the mouse in the MousePad
Component so I thought to overlay the Ruler JPanel with another
RulerCursor JPanel which I did but had other problems, so I switched
to RulerCursor Component - Andrew's advice fixed the alignment problem.

Seeing your response makes me think that paintComponent() is what I was
missing in the first place, so I think I'll go back and try MousePad
extends JPanel, Ruler extends JPanel and paints both ticks and cursor.

Thanks,
Jeff Higgins

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Find similar


Thread

Re: coordinate system and "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
  Re: coordinate system and "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000

csiph-web