I want to make a transparent background jTextArea.
I try to setBackground(new color(0,0,0,0));
jTextField is Working, jTextArea didn't working.
like this code.
// Not working.. Just remains gray.
// Working.. As it wants to be transparent.
JScrollPane is a composed component, it controls/contains a
JViewport which is the component that does the drawings. See API:
A common operation to want to do is to set the background color that will be used if the main viewport view is smaller than the viewport, or is not opaque. This can be accomplished by setting the background color of the viewport, via scrollPane.getViewport().setBackground(). The reason for setting the color of the viewport and not the scrollpane is that by default JViewport is opaque which, among other things, means it will completely fill in its background using its background color. Therefore when JScrollPane draws its background the viewport will usually draw over it.
So you should change the opaque and color properties of the
JViewportas well. You can access it with