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
***********************************************************************

For loop act as while loop


public class ForActAsWhile
{
public static void main(String[]args)
{
/*
* while(true)
* {
* System.out.println("HELLO WORLD");
* }
*
*
*Now we will create for loop
*that will act like while loop at above
*/

/*
*For loop at below is an unstopable loop.
*It will act like while loop at above.
*It has no i++ at last.So (i) value is always 0.
*And 0 is less then 1.This condition is always true.
*NOTE : <<DON'T EXECUTE IT!!>>.This is only for learning.
*/
for(int i=0;i<1;)
{
System.out.println("HELLO WORLD");
}
}
}

RELAXING NATURE VIDEO