[JAVA] LIBRARY(UiBooster) - How do I get it to work?

  1. ref url : TableDialog
  2. ref url2 : GitHub - Milchreis/uibooster-for-processing: 🚀 Creates fast and easy dialogs for utility tools for Processing
  1. Package uibooster > Class UiBooster > showTable​
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");

The above source code works fine.

  1. Package uibooster.components > Class TableDialog > showTable​

static java.lang.String[][] showTable​(java.lang.String[][] data, java.util.List<java.lang.String> header, java.lang.String title, java.lang.String iconPath, boolean isEditable)

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","icon.png",false);

The above source code does not work. Why?
The function is not recognized. Does anyone have any idea how to use it?

Is “icon.png” inside subfolder “data/”?
If so, maybe dataPath() can help:
"Favorite movies", dataPath("icon.png"), false);

1 Like

@GoToLoop

The method showTable(String[][], String[], String) in the type UiBooster is not applicable for the arguments (String[][], String[], String, String, boolean)

Thank you for answer.

I think I need to change the ‘class’ content as above, but I don’t know how to do it.

I don’t have that UiBooster installed.

But I’ve blindly coded the example below following the signatures from its source code:

import uibooster.UiBooster;
import uibooster.model.UiBoosterOptions.Theme;

static final String TITLE = "Favorite movies", ICON_FILE = "icon.png";
static final String[] HEADER_TITLES = { "Name", "Age", "Favorite Movie" };

static final String[][] TABLE_DATA = {
  { "Jimmy Johnson", "35", "Zombieland" }, 
  { "Danny Durango", "23", "Hangover" }, 
  { "Larry Berry", "54", "" }
};

UiBooster tableDialog;

void setup() {
  tableDialog = new UiBooster(Theme.DEFAULT, dataPath(ICON_FILE));
  tableDialog.showTable(TABLE_DATA, HEADER_TITLES, TITLE);

  for (final String[] rowData : TABLE_DATA)  println(rowData);
  exit();
}
1 Like

@GoToLoop

You are a genius and an angel.

First of all, it was built on the basis of what you told me. The action is fine.

(The person who made the library provided the reference material.)
(I asked a question, and I answered it.)

The ‘icon’ setting was successful with the help of ‘GoToLoop’ and ‘Library Maker’.

import uibooster.UiBooster;
import uibooster.components.;
import uibooster.model.
;

static final String TITLE = “Favorite movies”, ICON_FILE = “icon.png”;
static final String HEADER_TITLES = { “Name”, “Age”, “Favorite Movie” };

static final String TABLE_DATA = {
{ “Jimmy Johnson”, “35”, “Zombieland” },
{ “Danny Durango”, “23”, “Hangover” },
{ “Larry Berry”, “54”, “” }
};

String tableData;

UiBooster tableDialog;

void setup() {

tableDialog = new UiBooster(UiBoosterOptions.Theme.DARK_THEME, dataPath(ICON_FILE));
tableDialog.showTable(TABLE_DATA, HEADER_TITLES, TITLE);

}

However, there is a function that prevents the table data value from being modified, so I think we need to find out how to do it.

import uibooster.UiBooster;
import uibooster.components.;
import uibooster.model.
;

static final String TITLE = “Favorite movies”, ICON_FILE = “icon.png”;
static final String HEADER_TITLES = { “Name”, “Age”, “Favorite Movie” };

static final String TABLE_DATA = {
{ “Jimmy Johnson”, “35”, “Zombieland” },
{ “Danny Durango”, “23”, “Hangover” },
{ “Larry Berry”, “54”, “” }
};

String tableData;

UiBooster tableDialog;

void setup() {

tableDialog = new UiBooster(UiBoosterOptions.Theme.DARK_THEME, dataPath(ICON_FILE));

tableDialog.showTableImmutable(TABLE_DATA, HEADER_TITLES, TITLE); // unmodifiable form

tableDialog.showTable(TABLE_DATA, HEADER_TITLES, TITLE); // editable form

}

@GoToLoop
Dear GoToLoop,
Very thank you.