Git Product home page Git Product logo

uibooster's Introduction

Release GitHub Snyk Known Vulnerabilities Ko-Fi

UiBooster is a lean library to create fast and easy dialogs for utility tools. It equips your applications blazing fast with GUI components to increase the comfort for your users.

It's based on Java swing components to run on current JREs without any struggle. This library encapsulates the long and sometimes complicated GUI code and leaves more clarity in your project.

I decided to create this project, because I missed something like zenity for my Java applications.

If you like this project, and you want to keep me awake ๐Ÿคช, please:

Buy Me a Coffee at ko-fi.com

Components

Information dialogs

screenshot info dialog screenshot warn dialog screenshot error dialog

new UiBooster().showInfoDialog("UiBooster is a lean library to ....");
new UiBooster().showWarningDialog("Your computer has a low battery ....", "WARN");
new UiBooster().showErrorDialog("The connection to SQL database is failed.", "ERROR");

Text input dialog

screenshot input dialog

String opinion = new UiBooster().showTextInputDialog("What do you think?");

Confirmation dialog

screenshot confirm dialog

new UiBooster().showConfirmDialog(
                "Do you really want this action?",
                "Are you sure?",
                () -> System.out.println("Action accepted"),
                () -> System.out.println("Action declined"));

Password input dialog

screenshot password dialog

String password = booster.showPasswordDialog("Whats your password?", "Password");

Selection dialog

screenshot selection dialog

String selection = new UiBooster().showSelectionDialog(
        "What's your favorite movie?",
        "Favorite Movie?",
        Arrays.asList("Pulp Fiction", "Bambi", "The Godfather", "Hangover"));

Multiple selection dialog

screenshot multiple selection dialog

 List<String> selectedElement = new UiBooster().showMultipleSelection(
            "What are your favorite hobbies?",
            "Your hobbies",
            "Reading", "Traveling", "Fishing", "Music", "Gardening", "Sport", "Television",
            "Video Games", "Crafting", "Bird Watching", "Collecting");

Slider dialog

screenshot slider dialog

Integer numberOfHotDogs = new UiBooster().showSlider("How many HotDogs do you want?", "Your order", 
                0, 10, 2, 5, 1);

Colorpicker

screenshot color dialog

Color selectedColor = new UiBooster().showColorPicker("Choose your favorite color", "Color picking");

library by @dheid: colorpicker

Font Chooser

screenshot font dialog

Font selectedFont = new UiBooster().showFontChooser("Choose your favorite font", "Font choosing");

library by @dheid: fontchooser

Datepicker

screenshot datepicker

Date birthday = new UiBooster().showDatePicker("What's your birthday?", "Birthday");

File and directory selection dialogs

screenshot file dialog

UiBooster booster = new UiBooster();
File file = booster.showFileSelection();
File directory = booster.showDirectorySelection();
File fileOrDirectory = booster.showFileOrDirectorySelection();

Text area dialog

screenshot text area dialog

new UiBooster().showTextArea("Want to read some lorem ipsum?", "Message for you",
    "Lorem ipsum dolor sit amet ...",
    10, 40, false);
);

HTML text dialog

screenshot html text dialog

new UiBooster().showHtmlText("My menu", "Menu overview",
    "<h1>๐Ÿ“œ Menu</h1>" +
    "<ul>" +
    "<li>๐Ÿ• Pizza </li>" +
    "<li>๐Ÿ” Cheeseburger</li>" +
    "<li>๐Ÿฅ— Caesar-Salat</li>" +
    "</ul>");

Exception dialog

screenshot exception dialog

new UiBooster().showException(
    "An error occurred", 
    "Exception message",
    new Exception("Something went wrong ...")
);

List dialog

screenshot list dialog

ListElement selectedElement = new UiBooster().showList(
    "Select a robot", 
    "Avatars from RoboHash.org",
    element -> System.out.println("Selected: " + element.toString()),
    new ListElement("Robo 1", "Green and strong",         "src/test/resources/avatar1.png"),
    new ListElement("Robo 2", "Shy without an avatar!"),
    new ListElement("Robo 3", "- Crazy\n- Fast\n- Funny", "src/test/resources/avatar2.png"),
    new ListElement("Robo 4", null,                       "src/test/resources/avatar3.png")
);

Login dialog

screenshot login dialog

LoginCredentials credentials = new UiBooster().showLogin(
        "Login",
        "Internal area",
        "Username",
        "Password",
        "Go",
        "Cancel");

Waiting dialog

screenshot waiting dialog

WaitingDialog dialog = new UiBooster().showWaitingDialog("Starting", "Please wait");
dialog.setMessage("Ready");
dialog.close();

screenshot waiting with message dialog

WaitingDialog dialog = new UiBooster().showWaitingDialog("Starting", "Please wait");
dialog.setMessage("Initializing");
dialog.setLargeMessage("Some more information...\nMaybe from log files or other resources. \nBe transparent to the user to understand long processes...");
dialog.close();

Progress dialog

screenshot progress dialog

ProgressDialog dialog = new UiBooster().showProgressDialog("Please wait", "Waiting", 0, 120);
dialog.setProgress(10);
// ...
dialog.setProgress(120);
dialog.setMessage("Ready");
dialog.close();

Table dialog

screenshot table dialog

String[][] modifiedData = new UiBooster().showTable(    // showTableImmutable for immutable tables
        new String[][]{
                {"Jimmy Johnson", "35", "Zombieland"},
                {"Danny Durango", "23", "Hangover"},
                {"Larry Berry", "54", ""}
        },
        Arrays.asList("Name", "Age", "Favorite movie"),
        "Favorite movies");

Gallery dialog

screenshot gallery dialog

new UiBooster().showPictures(
        "My picture",
        Arrays.asList(
            new File("/home/nick/pictures/img-01.jpg"),
            new File("/home/nick/pictures/img-02.jpg")
        )
);

Form dialog

screenshot gallery dialog

UiBooster booster = new UiBooster();
Form form = booster.createForm("Personal information")
            .addText("Whats your first name?")
            .addTextArea("Tell me something about you")
            .addSelection(
                    "Whats your favorite movie?",
                    Arrays.asList("Pulp Fiction", "Bambi", "The Godfather", "Hangover"))
            .addLabel("Choose an action")
            .addButton("half full", () -> booster.showInfoDialog("Optimist"))
            .addButton("half empty", () -> booster.showInfoDialog("Pessimist"))
            .addSlider("How many liters did you drink today?", 0, 5, 1, 5, 1)
            .show();

// use .run() instead of show() to open the formBuilder without blocking.

The form is very powerful and provides a lot of features:

  • add your own elements (Example)
  • put multiple elements in one row (Example)
  • add a listener for any changes (Example)
  • add a listener on window close (Example)
  • set window setting, f.e. size and position (Example)
  • data-binding to manage inputs in form in dedicated variables (Example)

Splash screen

screenshot splash screen

Splashscreen splash = new UiBooster().showSplashscreen("/path/to/your/splash.png");
// do your stuff
splash.hide();

System tray

screenshot gallery dialog

UiBooster booster = new UiBooster();
booster.createTrayMenu("Food", "screenshots/color.jpg")
        .withPopupMenu()
        .addMenu("Hotdogs", () -> booster.showInfoDialog("Sausage in a roll"))
        .addMenu("Fries", () -> booster.showInfoDialog("Fried potatoes"))
        .addMenu("Pizza", () -> booster.showInfoDialog("Dough with tomato sauce"));

Notification

screenshot gallery dialog

new UiBooster().createNotification("It's hot and delicious", "Dinner is ready");

Options

UiBooster booster = new UiBooster(
    UiBoosterOptions.Theme.DARK_THEME,
    "/path/to/your/custom-window-icon.png"
);

See some examples for UiBoosterOptions here

More themes powered by flatlaf

  1. Add themes as maven dependency
<dependency>
    <groupId>com.formdev</groupId>
    <artifactId>flatlaf-intellij-themes</artifactId>
    <version>3.2.1</version>
</dependency>
  1. Create a new UiBooster with theme as UiBoosterOption
UiBooster booster = new UiBooster(new UiBoosterOptions(new com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialOceanicIJTheme(), null, null));
booster.showInfoDialog("Info Message Empty Constructor");

screenshot custom theme

List with beautiful themes

Include to project

Maven

If you want to use UiBooster than add the following to your pom.xml.

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
<dependency>
    <groupId>com.github.milchreis</groupId>
  <artifactId>uibooster</artifactId>
  <version>1.21.1</version>
</dependency>

Gradle

If you want to use UiBooster with gradle than add the repo, and the dependency to your root build.gradle file.

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
        implementation 'com.github.milchreis:uibooster:1.21.1'
}

uibooster's People

Contributors

dependabot[bot] avatar dheid avatar kotzaboss avatar leonitousconforti avatar milchreis avatar nicholasveronico avatar xdudssx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

uibooster's Issues

Checkbox grid

UiBooster needs a component for 2d checkbox grids. This component should be used as dialog and component in form.
Example
image

Form.close() doesnt work

We have the following form creation.

formMain = booster.createForm("Title")
      .addButton("Add", () -> {
          chosenCMD = new AddCommand();
        }
      ).setID("add")
      .setChangeListener((element, value, form) -> {
        if (element.getId().equals("add")) {
          form.close();
        }
      });

Its just a simple display with buttons to choose approrpriate commands.The idea is that when a button is clicked a Command
is chosen and the form should close. After some investigating i found the following.

This is the close method for the form.

public void close() {
    if (window != null)
        window.dispose();
}

The problem is the window will always be null due to how the Form is constructed.

public Form show() {
    final Form form = new Form(null, formElements, null);
    ...
}

The first argument being the window is null so the close or hide functions of the form will never work because in order to
close or hide the form the window should be not null.

Am i missing smth?

Multiple elements in one row

Each element is below another. It would be nice to add multiple elements in one row. A practicale example could be in input form for an address. Street and street number should be in the same row.

Loading icon for dark theme

The loading icon does not look good on the dark theme. Especially for darcula the icon should swap with a better one.

NPE using UiBooster on Linux

Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.bulenkov.iconloader.IconLoader.<clinit>(IconLoader.java:53)
	at com.bulenkov.darcula.DarculaLaf.getDefaults(DarculaLaf.java:97)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:539)
	at de.milchreis.uibooster.UiBooster.<init>(UiBooster.java:38)
	at de.milchreis.uibooster.UiBooster.<init>(UiBooster.java:28)
	at de.nako.mrt.Main.main(Main.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:128)
Caused by: java.lang.NullPointerException
	at com.bulenkov.iconloader.util.UIUtil.initSystemFontData(UIUtil.java:254)
	at com.bulenkov.iconloader.util.JBUI.calculateScaleFactor(JBUI.java:47)
	at com.bulenkov.iconloader.util.JBUI.<clinit>(JBUI.java:33)
	... 11 more

window dimensions

I'm using the processing version. is there any way to specify the window/form dimensions?

Font size

Can you control the font size programmaticly? And in a global way?

DraculaLaf not found 1.12

So i cloned the repo and added a Main class to test some of the new functionalities of version 1.12 but i get this error.

Exception in thread "main" java.lang.NoClassDefFoundError: com/bulenkov/darcula/DarculaLaf
	at de.milchreis.uibooster.Main.main(Main.java:9)
Caused by: java.lang.ClassNotFoundException: com.bulenkov.darcula.DarculaLaf
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 1 more

I tried adding

<repository>
            <id>maven.com</id>
            <url>https://mvnrepository.com</url>
</repository>

to the pom.xml but no luck.

Disable resizing components in forms.

The form component is great, but I'd like things like the image and buttons to remain initial size when form is resized. You can see below when form is resized the components resize as well.

Screenshot from 2021-09-07 13-00-33

Support for other Look & Feels

Hello,
I was wondering if there is any way to use the currently installed look and feel for the dialog components. I haven't looked at the code but I understand there are 3 themes to pick from using the UIBoosterOptions. I presume the library must be installing specific UIs for individual dialog components or something.

Anyway, wouldn't it be possible to just let the components use the currently installed "global" look and feel and UIs currently installed? I'd say that would make this library a lot more useful since it's important that the application and dialog look and feels match.

Release of new features

Hey @Milchreis, do you have any release schedule for the recently integrated features? I'm currently struggling with textarea rows in my processing project and have seen that this landed a couple of commits ago. Any change this gets relased soonish?

Form differentiation between OK and X for exit

Is it possible to know after a Form has been filled whether the user clicked OK or the X button?

The Form seems perfect for what im trying to make which is a Recipe app for an university assignment. However its important to know whether the user accepted or denied the form and i dont think its something i can deduce from the values alone for example what if 90% through filling in the fields he chooses to cancel.

GTKLookAndFeel error

This is with your latest code. You may want to fix this before release. Try against JDK 17.

Running de.milchreis.uibooster.ThemeTest
java.lang.IllegalAccessException: class de.milchreis.uibooster.model.options.OSNativeUiBoosterOptions cannot access class com.sun.java.swing.plaf.gtk.GTKLookAndFeel (in module java.desktop) because module java.desktop does not export com.sun.java.swing.plaf.gtk to unnamed module @2a48d10f
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:489)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at de.milchreis.uibooster.model.options.OSNativeUiBoosterOptions.OSNativeLookAndFeel(OSNativeUiBoosterOptions.java:22)

Incorrect validation

Original from UiBooster-for-processing by @ralfleggett

Hi Nick,

Not done this before so sorry if this is overkill / the wrong way of doing things for such a small correction, but spotted this bug while working with your library! If it's not too much bother I'd really appreciate if you'd recompile the library as I cannot due to restrictions on my work computer

Thanks very much!

Ralf

Feature request: Add toggles

Hi there!
I'm very interested in using this library in my project (Processing, though) to create a settings menu, but I just noticed that there is no real toggle dialog. Would it be possible to add this?

Of course there is already the Multiple selection dialog, but that just doesn't look quite right for a settings menu.

image

Here's a rough image I mashed up to show what I'm thinking of:
fr

As you can see, I added two different buttons of how it might look.
For my project, I would prefer the top version, but I can imagine other projects might rather use the bottom one.

Image panel for forms

  • adding an image by path or inputstream
  • optional align image (center, left or right)
  • optional fit image to panel

Blah, blah Dracula acting up.

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.bulenkov.darcula.DarculaLaf (file:/home/servadmin/.m2/repository/com/github/ice1k/darcula/2018.2/darcula-2018.2.jar) to field javax.swing.text.html.HTMLEditorKit.DEFAULT_STYLES_KEY
WARNING: Please consider reporting this to the maintainers of com.bulenkov.darcula.DarculaLaf
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Seems > Java 8 issue. I see on Java 11. Reference bulenkov/Darcula#41

Dialog window icon

The default dialog window icon is the java logo. It's not pretty.

  • The default icon should a ui booster logo
  • The user should pass in the UiBoosterOptions a custom logo

Form: change values with set-functions

Currently there is no way to change a value from a filled form. In some cases is could be useful to change back a value from code, f.e. for validation.

Specify version for unit-jupiter

Some problems were encountered while building the effective model for de.milchreis:UiBooster:jar:1.13.1
'dependencies.dependency.version' for org.junit.jupiter:junit-jupiter:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 35, column 22

It is highly recommended to fix these problems because they threaten the stability of your build.

For this reason, future Maven versions might no longer support building such malformed projects.

Processing 4 - Does UiBooster continue to work?

I just found UiBooster and tried an example (TextInput) on the brand new Processing 4. It worked but I got a lot of warnings. I would love to use UiBooster in future, but I'm a bit concerned if it is still going to work in future implementations of Processing 4. What are your thoughts and plans about this topic?

Thanks for your great work!

Martin

Bildschirmfoto 2021-09-23 um 10 54 44

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.