How to move an undecorated JFrame in Java Tutorial
This tutorial is all about How to move an undecorated JFrame in Java Tutorial.In this tutorial you will learn How to move an undecorated JFrame in Java Tutorial. Sometimes you want to make your own customize frame to create your own design, to look good, to be comfortable of what the client wants. and the problem is when you set the frame to undecorated it cannot be move or drag it anymore, you can’t drag it. So in this tutorial it will help you to move your undecorated jframe to make your application more user friendly This tutorial uses one panel component and NetBeans IDE. Please follow all the steps below to complete this tutorial.
How to move an undecorated JFrame in Java Tutorial steps
The first step is to create your project by clicking file at the top of your project and then click new project, you can name your project whatever you want. Create you form by right clicking the Source Packages and by selecting New JFrame Form and then drag panel component in your form.
then you will need to create a two event for your panel the Mouse Dragged and Mouse Pressed, copy paste the code below:
[java]
int xMouse;
int yMouse;
private void framedragMouseDragged(java.awt.event.MouseEvent evt) {
int x = evt.getXOnScreen();
int y = evt.getYOnScreen();
this.setLocation(x – xMouse , y – yMouse);
}
private void framedragMousePressed(java.awt.event.MouseEvent evt) {
xMouse = evt.getX();
yMouse = evt.getY();
}
[ /java]
Then you’re done. Run your project and see if it works.
About How to move an undecorated JFrame In Java
Project Name: | How to move an undecorated JFrame |
Language/s Used: | JAVA |
Database: | None |
Type: | Desktop Application |
Developer: | IT SOURCECODE |
Updates: | 0 |
For questions or any other concerns or thesis/capstone creation with documentation, you can contact me through the following:
E-Mail: [email protected]
Facebook: facebook.com/RyyanSalem
Contact No.: +639098911050
Ryan A. Salem
BSIT Graduate, soon to be MIT.
Java Developer / System Developer
Related topic(s) that you make like:
1.) Create MySQL Connection in Java
2.) How to use Word Count in Java Tutorial using NetBeans IDE