Question: I'm working on a log in server & my `JTextFields` aren't transparent when I set Opaque to `false`.

My code:

```
//username  
    JTextField jUsername = new JTextField(10);  
    jUsername.setBounds(520, 284, 190, 25);  
    jUsername.setOpaque(false);  
    jUsername.setBorder(null);  
    getContentPane().add(jUsername);  

    //password  
    JTextField jPassword = new JTextField(15);  
    jPassword.setBounds(520, 374, 190, 25);  
    jPassword.setOpaque(false);  
    jPassword.setBorder(null); 
    //jPassword.setBackground(new Color(Color.TRANSLUCENT));
    getContentPane().add(jPassword);

```

An Image what is still happening:

![enter image description here](https://i.stack.imgur.com/2scA5.jpg)

Anyone ever seen this before or know how to fix it? I've looked around but no one had the same problem as I do, & the fixes for theirs didn't work for mine. ( I Know I'm not using `JPasswordField` for password, that's temporary )

Answer: 
Basically, the UI delegate of the text field paints not only the text but also the field area (within the border) regardless of the opaque setting.

What you can do, is set the background color to a transparent value, something like `new Color(0, 0, 0, 0)` for example, which is fully transparent.

For example...

```
JTextField jUsername = new JTextField(10);  
jUsername.setBounds(520, 284, 190, 25);  
jUsername.setBackground(new Color(0, 0, 0, 0));
jUsername.setOpaque(false);  
jUsername.setBorder(null);  
getContentPane().add(jUsername);  

//password  
JTextField jPassword = new JTextField(15);  
jPassword.setBounds(520, 374, 190, 25);  
jPassword.setBackground(new Color(0, 0, 0, 0));
jPassword.setOpaque(false);  
jPassword.setBorder(null); 
//jPassword.setBackground(new Color(Color.TRANSLUCENT));
getContentPane().add(jPassword);

```

You can affect the transparency of a color by changing the last parameter, for example `new Color(255, 255, 255, 128)` would white, 50% transparent...

You may also wish to change the caret color, take a look at [`JTextComponent#setCaretColor`](http://docs.oracle.com/javase/7/docs/api/javax/swing/text/JTextComponent.html#setCaretColor%28java.awt.Color%29) for more details
I tried with another option and it worked for me. 

You can modify the property `Background` of the `textfield`. Select the option custom code in the Selection Box and paste `new Color(0, 0, 0, 0)`in the `txtField.setBackground` property.

Then just change the border property to `No border`. and finally uncheck the `opaque` checkbox.

[Here a capture of my netbeans interface](http://i.stack.imgur.com/ZJfnD.png)