Modern-Dialog-Windows is a JavaFX library with modern-looking alerts. They are a user-friendly alternative to the normal JavaFX alerts.
Similar to JavaFX alerts, but with more adaptability.
You can choose between two styles: rounded and classic and the color themes black and white.
Modern-Dialog-Windows does not use ButtonsType
objects but normal Button
objects, which is way simpler
to handle.
Based on Stages.
The idea behind Modern-Dialog-Windows is that you can customize everything you want.
And to do that, every alert can return a Stage with getStage()
. Example: If you want to change the dimensions
of the Stage, just add myAlert.getStage().setHeight(200);
to your code.
Huge range of alerts
This library not only contains a basic alert but a big collection of seven different alerts. If an alert
of your need is not in the library, just create one with the MDialogWindow
class. Following is a
list of all alerts.
Hierarchy | Name | Where to use? |
---|---|---|
1. Superclass | MDialogWindow | To create your own alerts. |
2. MDialogWindow | MAlert | Basic information or error alert. |
2. MDialogWindow | MTextInputAlert | Ask for input e.g. ask for a document name. |
2. MDialogWindow | MImageAlert | Show an image and give options e.g. share. |
2. MDialogWindow | MWebAlert | Show a website or HTML file e.g. for a login. |
2. MDialogWindow | MScrollPaneAlert | Lot of information in one alert. |
3. MScrollPaneAlert | MWelcomeAlert | Show text with an image in a scroll pane e.g. "What's New?" Screen |
3. MScrollPaneAlert | MMultiInformationAlert | Accordion in a scroll pane with a lot of space e.g. About Screen. |
Release 1.1.0 (Same, same but different)
⚠️ Before you update: Please read the full changelog, because a few method names changed, however, no functionality was removed.
The new release contains a new alert called MWebAlert
which can show websites or HTML files in your
alert. This allows you to create log-in alerts or other HTML, CSS and JavaScript based alerts.
The backend also changed a lot, however, nothing much changed for you, just use this version like any other before.
Read the official documentation for more help.
Version | Download | Current |
---|---|---|
1.1.0 | Download | Yes |
Version | Download | Current |
---|---|---|
1.1.0 | Download | Yes |
1.0.0 | Download | No |
Let's create a basic MAlert t could be displayed when a file creation fails:
MAlert mAlert = new MAlert(MAlert.MAlertType.ERROR, "Error"); // error alert with title
mAlert.setHeadline("Error while creating a new file."); // set the headliner
mAlert.setSecondHeadline("Check if you run this application as superuser and try it again."); // set the content text (wrap text is enabled)
mAlert.setInfoText("Error (23) - Contact our customer support if you need further help: +12 345 67890"); // adds some extra information
mAlert.addButton("Try again", event -> System.out.println("I need HEEELP"), true); // adds a button with a text and an ActionEvent (in this case printing something to the console)
mAlert.show(); // shows the stage
You can do the following if you want to make some stage changes, such as changing the
alert size or set the resizeable feature to true
:
mAlert.getStage().setHeight(100);
mAlert.getStage().setWidth(100);
mAlert.getStage().setResizable(true);
Here are a few projects who are using Modern-Dialog-Windows. Append this list when your project uses Modern-Dialog-Windows!
Word Guesser uses Modern-Dialog-Windows (Version: 0.1.1): Word Guesser on GitHub