Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to create a Borderless Window in Java?
To create a borderless window in Java, do not decorate the window. The following is an example to create a BorderLess Window −
Example
package my;
import java.awt.GraphicsEnvironment;
import java.awt.GridLayout;
import java.awt.Point;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.JWindow;
import javax.swing.SwingConstants;
public class SwingDemo {
public static void main(String[] args) throws Exception {
JWindow frame = new JWindow();
JLabel label1, label2, label3;
frame.setLayout(new GridLayout(2, 2));
label1 = new JLabel("Id", SwingConstants.CENTER);
label2 = new JLabel("Age", SwingConstants.CENTER);
label3 = new JLabel("Password", SwingConstants.CENTER);
JTextField emailId = new JTextField(20);
JTextField rank = new JTextField(20);
JPasswordField passwd = new JPasswordField();
passwd.setEchoChar('*');
frame.add(label1);
frame.add(label2);
frame.add(label3);
frame.add(emailId);
frame.add(rank);
frame.add(passwd);
Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
int width = 500;
int height = 200;
frame.setBounds(center.x - width / 2, center.y - height / 2, width, height);
frame.setVisible(true);
}
}
Output

Advertisements
