Pages

Java : Transparent JTextField

Complete source code below, will show you how to create a transparent text field in Java.

***********************************************************************
COMPLETE SOURCE CODE FOR : TransparentJTextField.java
***********************************************************************


import javax.swing.*;

import java.awt.*;

public class TransparentJTextField
{
public static void main(String[]args)
{
JFrame myFrame=new JFrame("Transparent JTextField");

JTextField test=new JTextField(10);

//MAKE JTextField TRANSPARENT
test.setOpaque(false);

myFrame.setLayout(new FlowLayout());
myFrame.add(test);
myFrame.setSize(400,100);
myFrame.setLocationRelativeTo(null);
myFrame.setVisible(true);
}
}


***********************************************************************
JUST COMPILE AND EXECUTE IT
***********************************************************************
Related Posts Plugin for WordPress, Blogger...