Graphics, AWT, Swing I part
what are the results, what can happen? I design using IBM s Visual Age for Java 3.0,
and I mix swing and awt in the same application/applet, it works fine when testing in
the IDE (I haven t tested it outside of the IDE yet). If you have tested
application/applets outside of the IDE, please let me know what happened?
Answer: There are fundamental incompatibilities in the way they draw themselves.
AWT java classes are not "pure" Java classes, they use underlaying C/C++ native
code (dependable on operation system) that can cause different appearence in
different OSs.
Swing is pure Java implementation and has no native code at all. Swing applications
look the same.
> If there is a problem mixing swing and awt... what are the results,
> what can happen? 
Some objects drawn on top of others are not properly occluded. This is most obvious
with drop down menus, which have a tendency to stay visible even after you have
selected a menu item. Another problem is that if you use AWT components on a
JTabbedPane they will not disappear when you switch tabs. There are many similar
issues.
 Again about difference between AWT and Swing
I have a question: What are the architectural differences between Swing and AWT??
Answer: by Odd Vinje 
There are no big architectural differences, the class hierarchy is almost the same.
The reason is that Swing is built upon AWT.
The most significant difference is how the components are drawn to the screen. AWT
is so called heavyweight components and have their own viewport which sends the
output to the screen. Swing is ligthweight components and does not write itself to the
screen, but redirect it to the component it builds on. Heavyweight components also
have their own z ordering. This is the reason why you can t combine AWT and Swing
in the same container. If you do, AWT will always be drawn on top of the Swing
components. 
You can combine AWT and Swing, just don t do it in the same container (e.g. panel,
groupbox, etc.) and don t put a heavyweight component inside a lightweight. 
Another difference is that Swing is pure Java, and therefore platform independent.
Swing looks identically on all platforms, while AWT looks different on different
platforms.
Swing is "lightweight" components. Its graphics primitives are implemented in
100% Pure Java. How does it draw pixels on screen?
Does it still rely on any native code to access the frame buffer?
Answer:  We mentioned before in our tips that Swing components is 100% pure
Java. 
It isn t fully correctly if we are speaking about containers on which they can draw.
Swing is still based on AWT, and even Swing components must have at least one
heavyweight container. In other words, JFrame, JApplet are *not* lightweight.
I need to put in a JtextField characters like cyrilic ...
How can I do this?
file:///F|/a_jsite/350_tips/graphics I.htm (3 of 5) [2001 07 08 11:24:55]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved