may be the other constructor
new Color(1.0, 1.0, 1.0, 0.8)
is admitted?
By the way, in the original call the 4th parameter should have been 204 (80% of 255).
;JOOP!
Main Topics
Browse All TopicsI saw this in a code example for changing the alpha value of the color propery to
80%
private javax.swing.JPanel myPanel;
myPanel.setBackground(new Color(255,255,255,80));
But when In netbeans 5.0, after right clicking on my panel and selecting
the properties menu, I try to add 4th parameter to the color propery
and it won't allow it, further more in the source code it's in the area
of auto generated code and not modifyable.
So I was wondering how to assign an alpha value to components from within
netbeans or is it not possible?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
<< Can you verify your code by compiling and running from the command line?
>>(using javac & java).
I did verify from the command line that adding the 4th parameter worked in
the function call.
>>is admitted?
not sure what is meant by that?
Is there a way to change the settings in netbeans that allows modification
of autogenerated code?
My verification of the function call was in a different program, the
one I'm working with in netbeans has a lot of errors when trying to
compile out of netbeans, I guess I would have to de-netbean it to get it to
run unless I'm supposed to use an ant script. This is my first GUI app and first app using the netbeans IDE so I don't know much about that.
you can do it a few ways:
1. place this line of code
myPanel.setBackground(new Color(255,255,255,80));
after initComponents(); in the class constructor
Eg:
/** Creates new form NewJFrame */
public NewJFrame() {
initComponents();
jPanel1.setBackground(new java.awt.Color(0, 0, 0, 204));
}
2. at the properties panel, click the [...] button for setting the background color, then click on [Advanced], and enter the code under "Generate Pre-initialization Code"
jPanel1.setBackground(new java.awt.Color(0, 0, 0, 204));
Business Accounts
Answer for Membership
by: sciuriwarePosted on 2005-10-26 at 11:00:30ID: 15164969
Your code seems right acc. to the 5.0 JAVADOC.
There is no note that this constructor is very new,
so it must be a bug in Netbeans (?)
Can you verify your code by compiling and running from the command line? (using javac & java).
;JOOP!