
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a Titleless and Borderless JFrame in Java?
To create a Titleless and Borderless JFrame, use the setUndecorated() method and set it to TRUE −
JFrame frame = new JFrame("Register!"); frame.setUndecorated(true);
The following is an example to create a titleless and borderless JFrame −
Example
package my; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.SwingConstants; public class SwingDemo { public static void main(String[] args) throws Exception { JFrame frame = new JFrame("Register!"); 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 age = new JTextField(20); JPasswordField passwd = new JPasswordField(); passwd.setEchoChar('*'); frame.add(label1); frame.add(label2); frame.add(label3); frame.add(emailId); frame.add(age); frame.add(passwd); frame.setUndecorated(true); frame.setSize(550, 400); frame.setVisible(true); } }
Output
- Related Questions & Answers
- How to create a Borderless Window in Java?
- How to create JFrame with no border and title bar in Java?
- How to activate and deactivate JFrame in Java
- How to create a borderless fullscreen application using Python-3 Tkinter?
- How to maximize JFrame in Java Swing
- How to disable close button on a JFrame in Java?
- How to change JFrame background color in Java
- How to set FlowLayout for JFrame in Java?
- How to add background Image to JFrame in Java
- Java Program to draw a line on a JFrame in Java
- How to set minimum size limit for a JFrame in Java
- How to set location of JLabel in a JFrame with Java?
- How to display a JFrame to the center of a screen in Java?
- How to set default button for JFrame in Java?
- I want to resize and position a JFrame in Java. How can I achieve that?
Advertisements