• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Remove minimize button

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to remove window minimizing without removing decoration?
 
Saloon Keeper
Posts: 10539
224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't remove just the minimize button. Why would you want to?

You can either remove just the maximize button by making the stage unresizable, or you can remove all decorations except the close button by setting the stage style to StageStyle.Utility.

Anything else is inhibiting the user's right to use their OS as they want to and I strongly discourage you from doing that.
 
André Fagundes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating an application for a company, it is a button bar that calls windows that are below the button bar.
The bar will do almost every action, call windows, close, all via programming.
I have seen applications that do not have or are disabled these buttons.
Already solved with the maximize buttons (managed to remove) and close (managed to disable), just not finding how to remove or disable the minimize button.
Employees should only work with this application on the computer and nothing else.
I sent here an image of the application I am developing.
Application.png
[Thumbnail for Application.png]
Application
 
Master Rancher
Posts: 4223
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's an app bar in that screenshot.
Presumably the user can select the app they want to use, thus sending your app to the "back"?
I can't imagine a Java app would be able to prevent other apps being used?
 
André Fagundes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It won't stop, but the bar won't leave the screen until it's closed.
 
Bartender
Posts: 2348
102
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

André Fagundes wrote:...Employees should only work with this application on the computer and nothing else...

That's a very steep requirement for that employee. Nevertheless, I still think that the ability to display a window on top of all application would be operating system specific. As Dave pointed out, java is not designed to do such stuff. You're better off trying to limit your employees to a certain operating system only and use it's internal APIs to do your bidding.
 
André Fagundes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not need to prevent anything, I just do not want the bar to be maximized or minimized and to be closed only when everything is ready to close otherwise a message will be sent pointing out what the user forgot to do.
The maximize button is easily removed, the close button is easily disabled I see no reason why minimizing has no way to do such an action ...
 
Sheriff
Posts: 6191
164
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will using an undecorated stage style work for you?
 
André Fagundes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I use UNDECORATED it will disappear the border and the title too, I don't think it's cool.
 
Ranch Hand
Posts: 387
27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use StageStyle.UTILITY "Defines a Stage style with a solid white background and minimal platform decorations used for a utility window."
https://openjfx.io/javadoc/12/javafx.graphics/javafx/stage/StageStyle.html#UTILITY

On OS X this displays as a window with a title bar, close icon, resizable borders and no other decorations.
 
André Fagundes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using LinuxMint, and UTILITY doesn't work very well, the minimize some button, but the maximize button doesn't.
Not even using (primaryStage.setResizable (false);) in conjunction with (primaryStage.initStyle (StageStyle.UTILITY);).
I'll leave it there, there are millions of people on the net looking for how to do but no one has the solution.
I will leave with the same minimize and disable the close button and only.
 
John Damien Smith
Ranch Hand
Posts: 387
27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can listen to the iconified property and if it gets set to true, set it back to false again:
 https://openjfx.io/javadoc/12/javafx.graphics/javafx/stage/Stage.html#iconifiedProperty

You could also listen to changes to the windowHiding property and do something if it changes.
 https://openjfx.io/javadoc/12/javafx.graphics/javafx/stage/Window.html#onHidingProperty

You could also adding an event filter to the stage for the WINDOW_HIDING event and consuming it if it arrives (that may or may not do what you want, I haven't tried it).
 https://openjfx.io/javadoc/12/javafx.graphics/javafx/stage/WindowEvent.html#WINDOW_HIDING
 https://docs.oracle.com/javase/8/javafx/events-tutorial/filters.htm#BCFDCCEJ

Or you could put the window in full screen mode, which may or may not be what you want).
 https://openjfx.io/javadoc/12/javafx.graphics/javafx/stage/Stage.html#setFullScreen(boolean)

> I'm using LinuxMint, and UTILITY doesn't work very well, the minimize some button, but the maximize button doesn't.

Could be a limitation of the windowing system in LinuxMint rather than JavaFX then as this seems to work fine on OS X.

> there are millions of people on the net looking for how to do but no one has the solution.

It is unlikely that there are millions of people looking to do this :-)
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!