GWAK
March 6, 2022, 10:11pm
1
ref url : TableDialog
ref url2 : GitHub - Milchreis/uibooster-for-processing: 🚀 Creates fast and easy dialogs for utility tools for Processing
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.
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
GWAK
March 6, 2022, 10:43pm
3
@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();
}
public UiBooster(UiBoosterOptions.Theme options, String iconPath) {
this(options, iconPath, null);
}
/**
* Shows a dialog with a table view. It allows to change cell values, add rows and remove rows.
* The dialogs wait for user input.
*
* @param data expects the values in rows of columns -> [row_n][column_n]
* @param header expects the labels for the columns
* @param title expects a title for the window
* @return the accepted or changed data or null on cancel.
*/
public String[][] showTable(String[][] data, String[] header, String title) {
return showTable(data, Arrays.asList(header), title);
}
1 Like
GWAK
March 7, 2022, 8:02am
5
@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.
opened 10:10PM - 06 Mar 22 UTC
closed 06:50AM - 07 Mar 22 UTC
1. ref url : https://milchreis.github.io/uibooster-for-processing/reference/uibo… oster/components/TableDialog.html
2. ref url2 : https://github.com/Milchreis/uibooster-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");
```
2) 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 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.
GWAK
March 7, 2022, 8:29am
6
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.