opaque : Java Glossary
home O words local find no local find frame, full screen Google search web for topic jump to footer translate with Babelfish by Roedy Green ©1996-2008 Canadian Mind Products
Go to : punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
opaque
In Swing, you can do a JComponent.setOpaque( true ) to notify everyone that when your component paints, it covers the entire region with no background showing through. This replaces the AWT update/ paint mechanism.

setOpaque Usage
setOpaque(?) call super.paintComponent
in paintComponent?
Meaning
false There is no point in doing this.
false You will paint only some of the pixels or use some transparent pixels to deliberately let what is painted underneath show through.
true You paint every pixel of the region, with no transparent pixels, and you want Swing to clear the region to the background colour for you automatically.
true You paint every pixel of the region, with no transparent pixels, and you will clear the background as needed with clearRect yourself in your paintComponent method.
The symptom of failing to call setOpaque( true ) is flicker, where the image gets repeatedly repainted to the background colour. The symptom of calling setOpaque( true ), when you should not are artifacts — little bits of left over painting from other work in where your component should be. These are areas you did not paint, which should have been background.

If in your TableCellRenderer you create your own JLabels to return, rather than using the one from DefaultTableCellRenderer, make sure you call JLabel.setOpaque( true ) or else your JLabel.setBackground will be ignored.


CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.16] Spread the Net
You are visitor number 9,779.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/jgloss/opaque.html J:\mindprod\jgloss\opaque.html