• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Translucent and Opaque components

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I stop objects from over-lying each other, I see that my Swing opjects have an opaque property, is this how?
For example, say I have a Applet 600x400, and I have a JScrollPane (bounds are 600x150) on it, and in that JScrollPane , I have a JTable which is set to 600x150 too and a white background. When I run the application I expect to see a white background, but all I get is the same lightgrey that the Applet and JScrollpane have, what's going on?
Related problem...
In general, the API doesn't explain visually what certain objects
look like or how they behave (visually). Since we are after all creating visual componets there must be a visual explanation somewhere (besides the Java Tutorial), in a form like the API
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glenn,
Are you using Applet or JApplet? Sun recommends not mixing 'heavyweight' AWT components and 'lightweight' Swing components in the same UI... This may be the cause of your problem... the 'heavyweight' Applet is showing over the 'lightweight' JTable...
HTH,
-Nate
 
Glenn Wearen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two attempts at the same project
1. Attempts to use Swing components only
2. Attempts to use AWT components only
I have not mixed components so far (so good!)
I've recently read on this board that using swing JApplet (and related J-components add alot of overhead, is this true? while I like the option to add Swing enhancements later if needs be, I don't really need them right now.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glenn,
Hmmm... could you post the code that is giving you problems?
Here's the jive on Swing... Swing components do add alot of overhead, but they add alot more functionality than AWT. Also, the AWT components are 'heavyweight', meaning they are dependent on native operating system components, and there are small differences between platforms. Swing is completely Java based, so Swing is completely platform independent. There are also some new components that are Swing only (like JTree and JTable). The only problem with Swing (in addition to the overhead)is that browsers can't recognize it without the Java2 Plugin. (except maybe Netscape 6 will work without it... I have heard that it's JVM is Java2 compliant...)
 
Quick! Before anybody notices! Cover it up with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic