From: Arne Vajhøj on 2 Jul 2010 20:13 On 02-07-2010 02:17, peter wrote: > On Jul 2, 4:58 am, Arne Vajh�j<a...(a)vajhoej.dk> wrote: >> On 01-07-2010 05:37, peter wrote: >> >>> I want to know how the swing eninge draw each component on the >>> screen, what classes I have to look at? >> >> SUN Java ships with source code for stuff written in Java. That >> should be sufficient to understand Swing. >> >> If you need to dig into the native part, then go to OpenJDK >> and look at the source there. > > Thanks everyone first, that mean If I want to override the original > swing-drawing-engine, I need to write all the stub in C++. So far I > know, the AWT engine's paint() method call C function to paint > everything. I think the short version of Swing is that: - Java Swing code translates from text, lines etc. to pixels - native AWT code renders the pixels So if you for some reason want to write some code that renders the pixels differently then you need to write C code. But if you want to change the way things look, then you can change in the Java code. Note that Swing comes with a pluggable Look & Feel model that allows you to change things in a very nice way without cloning standard Swing code. Arne
From: peter on 3 Jul 2010 22:48 On Jul 3, 8:13 am, Arne Vajhøj <a...(a)vajhoej.dk> wrote: > On 02-07-2010 02:17, peter wrote: > > > > > > > On Jul 2, 4:58 am, Arne Vajh j<a...(a)vajhoej.dk> wrote: > >> On 01-07-2010 05:37, peter wrote: > > >>> I want to know how the swing eninge draw each component on the > >>> screen, what classes I have to look at? > > >> SUN Java ships with source code for stuff written in Java. That > >> should be sufficient to understand Swing. > > >> If you need to dig into the native part, then go to OpenJDK > >> and look at the source there. > > > Thanks everyone first, that mean If I want to override the original > > swing-drawing-engine, I need to write all the stub in C++. So far I > > know, the AWT engine's paint() method call C function to paint > > everything. > > I think the short version of Swing is that: > - Java Swing code translates from text, lines etc. to pixels > - native AWT code renders the pixels > > So if you for some reason want to write some code that > renders the pixels differently then you need to write C > code. > > But if you want to change the way things look, then you > can change in the Java code. > > Note that Swing comes with a pluggable Look & Feel model > that allows you to change things in a very nice way without > cloning standard Swing code. > > Arne I have written my L&F. I am think to write a 3D L&F thanks
From: Roedy Green on 4 Jul 2010 06:09
On Thu, 1 Jul 2010 02:37:29 -0700 (PDT), peter <cmk128(a)gmail.com> wrote, quoted or indirectly quoted someone who said : > I want to know how the swing eninge draw each component on the >screen, what classes I have to look at? Start at http://mindprod.com/jgloss/swing.html First learn how the various components work at the API level. Then view the source code for each component, and work your way back the inheritance tree. -- Roedy Green Canadian Mind Products http://mindprod.com There is no harm in being sometimes wrong especially if one is promptly found out. ~ John Maynard Keynes (born: 1883-06-05 died: 1946-04-21 at age: 62) |