You seem to be looking for JComponent.setBorder(null)
. However there are a number of ways to achieve the effect you seem to want..
- Opaque
JLabel
with a BG color.
- A custom painted component..
Here is an example of the two standard components.

import java.awt.*;
import javax.swing.*;
class TextFieldNoBorder {
public static void main(String[] args) {
Runnable r = new Runnable() {
@Override
public void run() {
String s = "Text without borders..";
JPanel gui = new JPanel(new GridLayout(0,1,5,5));
JTextField tf = new JTextField(s, 20);
tf.setBorder(null);
gui.add(tf);
JLabel l = new JLabel(s);
l.setOpaque(true);
l.setBackground(Color.YELLOW);
gui.add(l);
JOptionPane.showMessageDialog(null, gui);
}
};
// Swing GUIs should be created and updated on the EDT
// http://docs.oracle.com/javase/tutorial/uiswing/concurrency
SwingUtilities.invokeLater(r);
}
}