File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Drag and Resize JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Drag and Resize JPanel" Watch "Drag and Resize JPanel" New topic

Drag and Resize JPanel

Nilton Castro

Joined: Dec 15, 2012
Posts: 12
Hi good guys and girls!
I'm trying to change some features of JPane then i did the following:

mypane.getRootPane (). setWindowDecorationStyle (JRootPane.NONE);

This removed the title bar and the buttons to minimize, resize and close. This is exactly what I want, but I want to also be able to drag and resize mypane. I tried a lot of things and can not get desired result (mypane.setResize (true); etc.).
Any good soul can help me?
Recalling: I do not want the title bar and the buttons minimize, resize and close - but I want to drag and resize it.
Thanks guys and girls!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
there are a number of ways this can be done.

here's one of those ways, but depending on the rest of the program, may not suit.
(at least you'll have something to play around with)

Nilton Castro

Joined: Dec 15, 2012
Posts: 12
Good morning Michael Dunn!
Thanks for answering my question quickly, I will try to implement your suggestion as soon as possible and I inform you of the outcome. I know it does not matter but I have a little experience in game creation and commercial applications. In this case I am trying to create a commercial application with a different look. I use animated background and components with a certain level of transparency. All panels are volumetric (like a glass plate). Because of this the traditional title bar and buttons to maximize, resize and close are not allowed, but i do not want the user to lose mobility that would normally have to drag and resize the panels. As a game these decisions occur within the panel and I do not want to mix default and custom.
At first I thought that Java was a beautiful woman from afar and up close, a wild cat.
Then I thought Java was a beautiful woman from afar and up close, most beautiful and hot.
Today I think Java was created by lawyers (but still a beautiful and hot woman who likes spend all our time).
Thank you!
Nilton (a rookie today and forever)
Nilton Castro

Joined: Dec 15, 2012
Posts: 12
Good morning Michael Dunn!
I implemented the solution you suggested and it worked perfectly, thanks. Now I will make adjustments to the application to work with different screen resolutions and I'll be ready to start programming for android tablet. And just as was the case with java swing, I know nothing about android, but I'm motivated.
I wrote these lines to thank you and all those who help us anonymously, and for those who say that human beings are selfish, I'll show you guys and gurls.
I agree. Here's the link:
subject: Drag and Resize JPanel
It's not a secret anymore!