File Exchange

image thumbnail

Widgets Toolbox

version 1.3.330 (571 KB) by Robyn Jackey
Modular components and controls to efficiently develop advanced user interfaces in MATLAB.


Updated 26 Apr 2019

View License

Widgets Toolbox helps you efficiently develop advanced user interfaces in MATLAB. The toolbox provides additional UI controls and higher-level modules that implement common building blocks needed in MATLAB apps. Widgets combine existing control functionalities together into a larger, reusable, common functionality to accelerate development of graphical user interfaces. Existing users of GUI Layout Toolbox will find Widgets Toolbox pairs nicely with GUI Layout Toolbox.

Example components are:
- A file selection control, consisting of a label, edit field, and browse button
- A listbox control combined with a label and a set of buttons for managing the list composition and ordering
- A tree control providing advanced functionalities like drag and drop, and checkbox nodes

Widgets Toolbox also provides
- Superclasses for a whole application, to provide and manage saving and loading session state to and from a MAT-file
- Dialog windows for several typical kinds of user selection (and more to come in future development)
- A logger, especially useful for complex or deployed apps, that will store application events/data (of a configurable severity level) to a log file and display them in the command window
- Framework for efficiently building your own widgets

Widgets Toolbox is most applicable to users who are writing hand code to develop complex, modular applications with hand code using object-oriented programming in MATLAB. This toolbox currently only supports traditional MATLAB figure windows (Java-based) and does not support web graphics used in uifigure containers or App Designer. Widgets may be added programmatically to a GUIDE-generated app, but they will not show up in the graphical GUIDE editor.

It is recommended you install this as a toolbox to automatically set up the proper MATLAB and Java paths. If you install this manually, please review the installation directions in the Getting Started guide.

Planning a complex or business-critical app? MathWorks Consulting can advise you on design and architecture:

Cite As

Robyn Jackey (2020). Widgets Toolbox (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (143)

Robyn Jackey

@Nathan - thank you for your feedback! I am currently working on an updated version that would enable moving your app using Widgets Toolbox into a uifigure for R2020b onward. There will be a few limitations, notably with the Java components (table/tree). I essentially plan to have them pass through to the builtin uitree / uitable when placed in a uifigure.

I love this toolbox! Is there any plan to update this to the app designer framework? Probably a huge effort, but much of this toolbox will probably fail as Matlab transitions :( specifically when Matlab no longer let's users access the JFrame

Robyn Jackey

@Eivind, Ok, glad the OS update fixed that issue. I am not sure about the double-click issue, but it should go away in a future release when moving away from Java.

Comment on previous post:
By coincidence, I updated my OS (macOS Catalina Version: 10.15.5 (19F101) ) and now the pope-menu appears in the right place on all screens.

I have encountered a completely insignificant, although still quite itcy bug.
I am using the EditableTextWithHistory widget and it works nicely. However, when I move my app onto a secondary screen, the widgets popup menu always appears in a fixed position in the bottom of that screen.
One more thing, and I don't know if this is expected or not.
When I double click on the widget, it selects the second item in the list of items in the widgets History property. The popup menu is not displayed in this process.

Best regards, Eivind

One more thing, and I don't know if this is expected or not.
When I double click on the widget, it selects the second item in the list of items in the widgets History property. The popup menu is not displayed in this process.

Robyn Jackey

@Kiron - I expect it will continue to work for the work as-is for the next few releases. I have been working on a compatibility update that will allow you to switch your existing apps from figure to uifigure with minimal code changes needed. My goal is to have the compatibility update for R2020b. Most of the capabilities of Widgets Toolbox tree, table, and editable popup components are now available in the uifigure versions, and I am working on a "pass-through" solution to use those when a widget component is placed into a uifigure. The best solution for additional functionality in uifigure is the new uihtml component.

@Robin, any updates on the "Warning: JAVACOMPONENT will be removed in a future release." effort? Matlab's uifigure based apps are still lacking the functionality that this toolbox offers, but I don't want a new release to suddenly break this toolbox, and thus my application.

Robyn Jackey

@pk68 - Sorry for the delay. I will take a look soon.


Robyn, if any of the columns in the table is of Popup Editor Class, then this change breaks it.


Robyn, commenting out those lines is working as expected

Robyn Jackey

@pk68, it is likely due to an optimization where table columns of the same type are reusing the same Java editor. Can you try commenting out a few lines of uiw.enum.TableColumnFormat - lines 294 and 311-313. If it works I will push the fix in the next release.


Robyn, I am running into an issue when I have 2 tables. Within a table I can change multiple cell values and when I press enter the values update correctly. However with 2 tables, when I change the value of a single cell and then click on the other table without pressing return to change a value, both the tables display the same value. Is there a work around for this?

Robyn Jackey

It might be possible to change alignment with HTML in the cell. I haven't tested that specifically.


Ok. Thanks Robyn. Can I left/center/right align individual cells (or columns) when they're char/string?

Robyn Jackey

@PGrant - unfortunately the only real option for this is to format the column as text and then convert the numbers to the format you want in text. There is a request for this improvement to the new uitable (appdesigner/uifigure), but it is not available yet.


Can some provide an example on how to apply number formats to individual cells (not columns) please?
Thanks in advance!

Robyn Jackey

You're very welcome David!


Robyn, creating a subclass worked like a charm! Thank you for your help and advice!

Robyn Jackey

David, the best way to handle this is to make a subclass of uiw.model.Preferences and add standard properties. Then set the preferences to the correct type in the constructor of your app, like this:

% Constructor
function obj = App(varargin)

% Use custom preferences class
myPrefs = myPackageName.Preferences();

% Call superclass constructor


Robyn, changing the Preferences class file in the toolbox to create a default value for the RecentSessionPaths property allowed that one to be retained between closing/re-opening my app, however the same change does not work for the custom preferences that I'd defined. It seems like if the preference isn't defined within that Preferences class from the toolbox, then they are created as a "dynamic property", which are not allowed to have default values (according to the documentation for "meta.dynamicProperty"). Since they can't have default values, they can never satisfy that requirement and are always ignored. I've tried removing the requirement for HasDefault to be true, but then I just run into issues later when the code tries to access a default value of the "dynamic property" that doesn't exist. Any advice?

Robyn Jackey

@David, looks like your comment with the solution didn't post, but anyways as you found, the preferences may need to have a default value set. It sounds like you found a resolution but if there's still an issue let me know.


In response to my last comment: I was mistaken, RecentSessionPaths is defined in the Preferences class, not SessionManagement.


Robyn, both my development machine and the one running the compiled application have MATLAB installed on them. I've opened the matlabprefs.mat file on the compiled machine and it looks like only the Position and LastFolder preferences are being saved for the compiled app, so the recent files list the SingleSessionApp class creates and the custom preferences that I've defined are being ignored. Would the fix be as simple as adding the custom preferences to the matlabprefs.mat struct and re-saving it back to the mat file?

Robyn Jackey

David, the behavior may be different on a machine with MATLAB installed vs. not. If on your computer, it is likely copying them from your MATLAB installation each time.
I'm not sure whether it will work as you want on a machine that's not had MATLAB installed. Have you tested it? If it doesn't work I will try to get more info - let me know.


Robyn, I am seeing some inconsistency with the mixin HasPreferences class from compiled applications, sometimes the preferences aren't retained after closing the app and re-opening it. I don't see this issue when running the un-compiled code though, and so I'm not sure if what I'm seeing is a symptom of something else between the compiler and addpref/getpref or if it is specific to this toolbox's use of those functions.

@Robyn : thank you, it seems to be working fine, no error message when running 2 demo files.
I can start playing with this :D

Robyn Jackey

@Julien - for that demo, you also need to install GUI Layout Toolbox. For the Java error, it's preferred you install this as a toolbox or from MATLAB Add-Ons tool. If you need to manually install, you must add the Java .jar file to the Java path manually.

Hello, I'm looking forward to using this toolbox but I can't make it work. I'm on 2019b, unzipped files and installed the toolbox as well.
In GettingStarted.mlx, I get this error message :
unable to resolve the name uix.HBoxFlex. (line 14)

In demoTree.mlx, I get this message :
Error using javaObjectEDT
No class can be located on the Java class path

I've read all messages below, but I still have problems...

Great toolbox! I recommend increasing your java heap size if you do anything complicated with this though. You can do this by typing preferences in the command window, then in the window that opens select General->Java Heap Memory.

Kevin Phung

@Robyn Jackey -- Thank you for the quick response! I am currently using R2018a on windows 10 v1809. I suppose it's not a big deal if no one else experiences this-- I decided to just keep the column as 'editable' to avoid the flashing.

Robyn Jackey

@Kevin - What MATLAB release are you using? I don't see this flashing at all when I try your code. I tried lengthening the table by 10000x over your example, and it appears ok to me.

Kevin Phung

Hi Robyn, I have noticed what I believe to be a visual bug, which can be seen with this short piece of code:

t = uiw.widget.Table('Parent',f);
t.ColumnName = { 'a', 'b'};
b = num2cell(false(30,1));
t.Data = [a b];
t.ColumnFormat = {'integer','logical'};
t.ColumnEditable = [1 0];

When I try to change a numeric value in column a to a different value:

t.Data{1,1} = some_different_number

while having a logical checkbox column that is 'uneditable', the box seems to do a flash, as if it becomes editable and then back to uneditable in a split second.
The 'flashing' seems to occur more often if I have more rows. There is no flashing when there is only 1 row. There is also no flashing if I change the value to be the value it already is.
Functionally, everything seems fine. Just visually it is a bit annoying to see. Let me know if you have any insights.

Robyn Jackey

Please be aware, as of R2019b, you will receive a warning when using Java-based widgets:

Warning: JAVACOMPONENT will be removed in a future release. For more information, see Recommendations for Java and ActiveX Users on

If you like you can disable this when launching your app:

>> warning('off','MATLAB:ui:javacomponent:FunctionToBeRemoved')

I am currently working on a future plan for this.

@Robert - I did not provide a property for the header height, but the table is manipulating header size in the onStyleChanged method. You may be able to make your own mods to do that. The best way would be to subclass my table and override onStyleChanged to also do what you need.

@David Thanks for your suggestion. I fixed it by adding "obj.applyColumnFormats();" at the the end of the "set.ColumnName" method. That makes it update dynamically no matter how many columns you have at runtime.
@Robyn - is there a way to increase the height of the columns header - so you can use html to have multiple lines in the columnName: '<HTML>row1<br>row2</HTML'


@Robyn I am seeing a warning with the Widgets Toolbox and Matlab 2019b, stating that JAVACOMPONENT will be removed in future releases. Will the toolbox continue to be supported in future releases? I am seeing this warning with the Table and CheckboxTree widgets.


@Robert I had run the same situation with the Table widget, and traced it back to creating the widget without specifying something for the Data property. Doing this seems to lock ColumnEditable, meaning you can't change which columns are editable later. The work around that I found was adding " 'Data', cell.empty(0,table_width),... " to the constructor (table_width would be 3 in your case as your example had 3 columns).

It looks really good, but i think I have found a bug, using the folllowing code:

f = figure;
w = uiw.widget.Table(...
'ColumnName', {'A'}, ...
'Label','Table:', ...
'Units','normalized', ...
'Position',[0 0 1 1]);
w.Visible = 'on';
w.ColumnName = {'A','B','C'};
w.ColumnEditable = [1 1 1];
w.Data = magic(3);

I can only edit the first column, is there a method I am missing to update it so I can edit all the columns? Thanks

Robyn Jackey

@Alban, this should work for now:

@Robin, Thanks for your answer. I did not know that. Do you know how I could get the windows display scaling setting from Matlab?

Robyn Jackey

@Alban - I had not encountered this before, however I suspect it is due to your display scaling setting. MATLAB adjusts the size of pixel values by your display scaling, while the underlying Java for the table control does not. I don't think I accounted for that when the table control sets the underlying Java column widths.

Hello @Robyn, Thanks a lot for this toolbox.
I am using the table widget. How do you explain that the width of the table is not equal to the sum of the column width?
If I set up the Position(3) property to the sum of the column width it is a lot too wide.
Thnaks in advance.


Robyn Jackey

@Ryan, Sorry for the delay. Is there still an issue to resolve? Perhaps you can run the deployed app from a windows command prompt to see any error messages? If there's still a problem feel free to email me from my author page.

Ryan Muir

@Robyn, I've actually copied & pasted the image file to the same directory as the executable. I know that it finds it, because if I change the image file name or move the image file, it throws an error message at me when I run the executable. I'm on windows 10, and I've tried compiling using Matlab R2017a as well as R2019a. Something that's odd is when I run the executable with the image file in a location that it can find, it doesn't give me any error messages, but it does play the windows error sound shortly before displaying the GUI.

Siam Aumi

Robyn Jackey

@Ryan, are you sure the image was included and loaded? It is necessary to manually include the "resource" folder within Widgets Toolbox installation when deploying a standalone app. If it is already included, what platform and MATLAB release are you using? Do you receive any errors?

Ryan Muir

Thank you for this amazing toolbox Robyn! I've put together a nice GUI using this toolbox, and successfully compiled it using the matlab mcc standalone compiler. It looks great!

Running it on Matlab is flawless, and the standalone compiled version looks and works great, except for the toolbar buttons. The buttons still all work as intended, but they won't show the image. The image file is still being correctly located, but it just won't display on the button. Do you know what's happening? Thanks again!

Robyn Jackey

New Widgets Toolbox add-on available: Volume Visualization and Annotation Widgets

Volume Visualization and Annotation Widgets provides components for working with slices of volume imagery and with isosurfaces.

Robyn Jackey

@Alain - I recommend you use the table method setCellColor to change the background color if that can meet your needs. I'm not sure about the Java approach. I no longer plan to enhance the Java-based table and am beginning to look at compatibility for Widgets Toolbox to work with web-based uifigure (where Java is not available). It would be best to stick to the available interfaces if possible.

@Mohammad - You need to manually include the resource folder in the Widgets Toolbox install. It contains the Java .jar file and various icons, but it may not be automatically found by the dependency analysis. The same thing applies to GUI Layout Toolbox, if you're using that.

Hello Robyn

many thanks for this toolbox. I want to use the widget in a standalone application but it is giving me the following error: "Error using javaObjectEDT
No class can be located on the Java class path"
how can I solve this issue please ?

thank you again

Hi Robyn,
I am currently using the table widget. I have tried to customize by columns font and color using java approach for example: jtable=obj.JScrollPane.getViewport.getView
renderer = javax.swing.table.DefaultTableCellRenderer
jtable.getColumnModel.getColumn(k-1).setCellRenderer(renderer);%for some k
(No error) no effects!! Is there anyway to do that?
Best regards
PS a suggestion adding rowname to avoid adding a specific column

Yanjun Han

Dear Robyn,
How to change the default icon in the list with the button?

Robyn Jackey

@Alain - There may be a slight buffer around the java-based tree that I don't have control over. You can set the Label of the widget and then it will afford additoinal space for it. I typically use GUI Layout Toolbox to position the widgets in the figure, and set some pixel-based Padding and Spacing to make the contents look consistent.

I'm not sure about the font size and font weight, as you mention. Are you saying they don't change the font of the label, or don't change the font within the tree?

@Robyn I have updated my soft from your previous version "Tree controls…". Two questions, with position [0 0 1 1] only about 98% of the parent height is used? Is it to add some title if yes how to do that? Changing label properties fontweight, fontsize … have no effects as previously? Any idea? Is there a special way to do that?

@Robyn Thanks a lot, I had only searched within the checkboxtree demo which was the specific case I currently use via your tree java interface.

Robyn Jackey

@Alain - please see demoTree.mlx for an example of the setIcon method.

Another excellent job. I currently use your previous submission about tree. I have tried the widget tree in order to compare results.
I have not found how to add icon? Is it possible? This option is very useful in practice.

Robyn Jackey

@patta - Yes I got some other feedback asking to make uiw.abstract.SessionManagement.addRecentSessionPath a protected method so it can be overridden. If you have any more feedback on the session management, feel free to contact me directly via my author page. I plan to better document SingleSessionApp and MultiSessionApp classes in the future.


Oh, I see that it is made protected in the current version. Sorry.

Robyn Jackey

@Suresh - I received your direct email as well, but my reply bounced back. I am confused about your question.

You can certainly use Widgets Toolbox components in your GUI. You need to create them just like in the demo examples, and set the widget’s parent to be a figure, panel, or GUI Layout Toolbox component. For example:

>> f = figure;
>> vLayout = uix.VBox('Parent',f);
>> t = uiw.widget.Table('Parent',vLayout);
>> t.Data = magic(5);
>> fs = uiw.widget.FileSelector('Parent',vLayout);
>> vLayout.Heights = [-1 25];

Does this answer your question?

Hi Robyn, Can you say the process , how to embed widgets tool box into the GUI model ?

Robyn Jackey

@David, you may format the column for text and non-editable, and use HTML to set font color.

Hi Robyn, Is it possible to expose an option to set the text colour of each cell independently in a table, similar to setCellColor(obj,rIdx,cIdx,color).
Many thanks,

Robyn Jackey

@Vyshakh, after setting SelectionMode and SelectionType to what you want, if you set SelectedColumns or SelectedRows it should call an internal method scrollToSelection(). If it's not working, please contact me via the author page and you could email me a simple script to reproduce the issue.

Robyn Jackey

@Kevin, I highly recommend you look at GUI Layout Toolbox if you are doing your GUI programmatically. It makes it easy to configure things to resize the way you want them. Typically I build apps with a fixed font size (10 point or bigger).

Vyshakh Pv

How to programmatically Highlight a Cell or Row in the Table? (uiw.widget.Table)
(If the row to be selected is out of the visible area, table should automatically scroll)

Kevin Phung

Robyn, I made a GUI programmatically without GUIDE or appdesigner. I have my graphic objects' Units and FontUnits to normalized so that it resizes properly if my figure were to be resized. Your widget toolbox was very useful because I used it to replace the uitable from Matlab. However, the font sizes of the data in the table seem to stay the same regardless of whether or not the table size increases/decreases.

Robyn Jackey

Hi Kevin, I've never actually used FontUnits as anything other than pixels. Is there a particular reason you chose normalized instead? The FontUnits appears to be removed in MATLAB for the controls used in web graphics (uifigure), so I would recommend sticking with pixels for future compatibility.

Kevin Phung

Hi Robyn, regarding your Table widget, even though I have set the font units to normalized, the font size of the data in the table does not seem to change, even though the size of the table and my figure is changing. Is there a property that I am missing?

Vyshakh Pv

Robyn Jackey

Hi Mohammad, you will need to access the tree object directly to get the SelectedNodes property. If your menu item's callback is the method of an object that knows about the tree, it could simply look like this:
uimenu(treeContextMenu,'Label','My menu item','Callback',@(h,e)myCallback(obj, e));
Otherwise you could just provide the tree as an additional argument in the callback:
uimenu(treeContextMenu,'Label','My menu item','Callback',@(h,e)myCallback(e, treeObj));

I think I unintentionally commented out the Editable property on Tree in the current release. The behavior of that feature, editing the node text directly, has had some known issues. After uncommenting Editable and the set.Editable method on my local copy, it seems to only retain the text types if I press enter after I finish making the edits. If I instead click elsewhere in the tree, the edits are lost. I can reenable Editable in the next version, however I am not sure I'll be able to improve this behavior if you click off of the node you're editing.

Hi Roman,
Yes, I like this idea. I've added it to my list of enhancements to make.


Finally, I can view my data in table without headache in MATLAB, very nice.


Hello Robyn

great toolbox. very useful
a question please, I am using "Tree", when I select from the menu, how can I get the name of the selected node and the parentof this selected node
also, if I change w.Editable to true; I still cannot change the name by double clicking on the node

thank you


Hi, Robyn.

Could you add a "LabelBackgroundColor" property to the "uiw.abstract.BaseLabel" class?
If you do this, also please consider removing this line in "uiw.abstract.WidgetContainer/onStyleChanged":

107 % Also modify label
108 obj.hLabel.BackgroundColor = obj.BackgroundColor;

I think it would make sense to have the background color of the main control and its label separate. I notice this especially with the popup control.

Best regards

Robyn Jackey

@David - Thank you, I've made this change for the next release.


Please see results of the tests below, the first throws the warning but the second does not. I am running 2018b.

>> dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution()
Warning: A value of class "" was indexed with no subscripts specified. Currently the result of
this operation is the indexed value itself, but in a future release, it will be an error.

dpi =


>> wToolkit = java.awt.Toolkit.getDefaultToolkit();
dpi = wToolkit.getScreenResolution()

dpi =


On a separate topic is it possible to edit the font colour and font weight of individual cells for a uiw.widget.Table?

Robyn Jackey

@David - I have not seen this error. Which MATLAB release are you using?

If you execute this at the command line, does it error?
dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution()

What about this?
wToolkit = java.awt.Toolkit.getDefaultToolkit();
dpi = wToolkit.getScreenResolution();


This looks like a very useful toolbox, thank you. I get the below warning when right clicking to open the context menu on a table, note this can be achieved by executing the example code for the table. Doesn't look like it causes an issue now but may do in the future.

Many thanks,

Warning: A value of class "" was indexed with no subscripts specified. Currently the result of this operation is the indexed value itself, but in a future
release, it will be an error.
> In uiw.abstract.JavaControl/showContextMenu (line 181)
In uiw.widget.Table/onMouseEvent (line 334)
In uiw.widget.Table>@(h,e)onMouseEvent(obj,h,e)

Robyn Jackey

@Andreas, unfortunately there is not. However, for fastest performance with so many nodes, I recommend you create top branch(es) first but don't add them to the tree. Then create all the nodes first with node(idx) = uiw.widget.TreeNode('Name',thisNodeName,'Parent',branch) where 'Name' is the first input. Then after all nodes creation, set the branch(es) parent to the tree.

is there a way to creat many tree nodes at one time? E.g.:
But in this case i create 1000 referances to one node, because TreeNode inherit from handle.
Is there any way?

Robyn Jackey

@Kevin - Yes you can set text color using html, and cell background color using the method setCellColor(obj,rIdx,cIdx,color)

Robyn Jackey

@ Adam, nothing that I'm aware of. That sounds like an interesting use case though. I totally agree about expanding a branch without modifying the selection. This is happening because the tree is deselecting everything programatically on clicks on white space that are not on a node. I can change this behavior to not deselect on clicks on the whitespace. I don't think that will be too problematic because you can still CTRL-click a node to deselect it. I'm testing this out and plan to submit this update shortly.

@ David, thank you so much for your feedback and the fixes on this. Your suggestion is good and I have incorporated it for the upcoming version. We can avoid the dynamic resizing by preallocating an array of or just doing the loop index backwards like this: for idx = numel(propNames):-1:1

Kevin Phung



Is there any way that individual tree nodes can be made un-selectable? I'm thinking really of those that are non-leaf nodes with an expandable branch, for which selection of the parent is not valid for my purposes. Also is there a way to retain existing selections when a branch is expanded or collapsed? Currently if I make some selections then expand a branch to add one of its children to the selection I have to reselect everything. It's not a big deal, my users can soon get used to the fact they have to expand the branches they want before selecting. Just wondering if I am missing functionality that is currently available.


Robyn, I've managed to find a work around for both of the pieces I was working on with the Preferences class, I'll include them below for your reference.

*Open Recent menu's contents not persisting through closing/re-opening the app: Change all of the times that uiw.abstract.SessionManagement checks the RecentSessionPath preference to look at RecentSessionPaths, so it's always looking at the same list. (lines 214, 413, 422, 499, and 517)

*Custom Preferences not persisting: Edit lines 125-126 in uiw.model.Preferences, this probably isn't a desired long term solution because now propList gets resized as it loops through the list of properties, but the metaclass() function doesn't seem to grab the dynamic properties that addprop adds to the Preferences instance.
mc = metaclass(obj);
propList = mc.PropertyList;

propNames = properties(obj);
for i = 1:numel(propNames)
propList(i) = findprop(obj,propNames{i}); %#ok<AGROW>


Robyn, I have been looking using the HasPreferences mix-in class that comes with SingleSessionApp and I believe I've noticed a bit of inconsistency with the way SessionManagement uses its' preferences. It looks like that when SessionManagement is attempting to populate the File > Open Recent menu it sometimes looks for the preference 'RecentSessionPath' and sometimes for 'RecentSessionPaths', so it ends up with two lists that don't match up most of the time. End result is the list of recent files in that Open Recent menu, and the additional preferences that I'm trying to define, don't always persist between closing/re-opening the app. Not sure if the two are directly related, I think I may be missing how to add the preferences I'm defining to the list returned by the Preferences class's getPreferenceProperties function, as the only ones it returns for me now are Position, LastFolder, and RecentSessionPaths.

Robyn Jackey

@Giuseppe - I am looking into future compatibility to use widgets within the web figures (uifigure) that app designer uses. The Java components (primarily Tree, Table) will not work in web figures. I will investigate whether I can map those to the web figure uitree and uitable, as they are being actively developed and each release getting closer to feature parity with the widgets Tree and Table.

Hello Robin, any plan to make it compatible with appdesigner? I am currently using Matlab 2017b and the Tree in appdesigner has been introduced only in Matlab 2018...Thanks

Robyn Jackey

@Kevin - thank you for your feedback! I will take a look at the ButtonDownFcn.

Kevin Phung

@Robyn, I think there may be a bug in which the ButtonDownFcn for your table widget to execute 3 times in a row

Kevin Phung

Hi Robyn, just wanted to say thanks for this amazing toolbox. Was looking for an alternative to matlabs poorly designed uitable, and this was it! Currently have no constructive criticism regarding your program, just wanted to express my gratitude.

Robyn Jackey

@Eddie - The ZIP file download appears to be broken as it removed the + from package directories and the @ from class directories. For now, if you need to manual install, I recommend you instead download the toolbox file and rename the .mltbx extension to .zip. Go into there and into the fsroot folder, and you will have all of the correct source files/folders. If you manually install you will need to manually add the included Java JAR file to the Java path.

@Markus - I will take a look at this in my next round of updates. Thanks for reporting it!

@Daniel - Thanks for the feedback. As you noted, I decided to require case sensitivity in the parameter/value pairs, although most built-in MATLAB components accept lowercase or shortened names. In my opinion I think sticking to the exact name makes for more readable & maintainable code. But I'll give your suggestion some further thought.

@Mohammed - Excellent! Glad you were able to get it working!


I tried to install this manually - but the class folders included in the zip file do not start with '+' but start with an empty space, therefore matlab cannot find the class. Do I need to manually batch rename those folders to include the '+' sign?


@Robyn: Very useful toolbox. Thank you!
I use the Table class with an UIcontexmenu and I would like to select multiple lines with control + left mouse click.
In my opinion I detected an litte little mistake in your code. The problem occurs in the function "onMouseEvent" of the class Table line 328.
It is not possible to select multiple lines without the context menu opening automatically.

I changed the line 328 and now it works. Hope I could help

OLD (your code):
% Launch context menu in certain cases
if strcmp(mouseEvent.SelectionType,'alt')

NEW (fix):
% Launch context menu in certain cases
if strcmp(mouseEvent.SelectionType,'alt') && mouseEvent.ControlOn~=1


would love to see support for reordering of treenodes. Right now I am using un-parenting and re-parenting trick to get around this issue.


Great toolbox!
Perhaps it's just me (being lazy) but it might be nice if the Name,Value syntax accepted lower-case parameters names.
For example:
>> uiw.widgets.Slider('parent',gcf);
returns an error, while
>> uiw.widgets.Slider('Parent',gcf);
is ok.

The behavior of most native MATLAB functions ignore the case of parameter names.

Thanks for your feedback. I was exploring on my own and managed to get the handle of jTable; If your table is saved in a variable "w', then jTable = w.JControl. Maybe your suggestion to explore getJavaObjects will work, too, but I got it working so I'm happy. Thanks for your help, anyway :D

If someone faces the same problem, here's my code:
% add the custom class "LookupFieldCellEditor" by Yair Altman to your java classpath

% create a java hashtable to hold the different lists
hashTable = java.util.Hashtable;

% add each list to its corresponding row value
for i:1:rowCount
% rowValue: in my case, it is the value of the first column in each row
% horizontalList: a 1-by-n cell array holding your list

% add your pair of rowValue & horizontal list to the hash table
hashTable.put(rowValue, horizontalList);

% create an instance of the custom java class
% first arg. is the hash table
% second arg. is the column index where the cell editor will be looking to select the right list to display. (don't forget java index starts from 0)
cellEditor = LookupFieldCellEditor(hashTable, 0);

jTable = w.JControl;
jColModel = javaMethodEDT('getColumnModel', jTable);

% In my case, I wanted different lists to be displayed in my fourth column, so it's my target column
targetCol = javaMethodEDT('getColumn', jColModel , 3);
% sets the custom cell editor for the target column
javaMethodEDT('setCellEditor', targetCol, cellEditor);

Robyn Jackey

@Mohammed - Thank you for your feedback! I have not attempted row- or cell-specific lists before. If it helps, there's a method you can call (getJavaObjects I think) to return the Java editors, etc. If necessary you could also subclass the Table widget to override any functionality. Sorry I don't have a better answer. I'll have a look at the color issue on my next round of bugfixes.

@Adam - yes this is strange. The renderer I think is different for the Checkbox Tree vs. normal Tree. There must be an issue there. It is kind of niche as you say and could be complicated to fix. I think it is unlikely I'll be able to dig deep to fix this one. Sorry for that.

Thanks for the great toolbox. For the Table widget, I tried to set up a different list for each row, but I could not find a way. I usually do this by getting the jTable (from jscroll = findjobj(mTable); jTable = jscroll.getViewport.getView) and then setting the cell editor for the right column using the LookupFieldCellEditor by Yair Altman. If there is a way you can help, I'd really appreciate it.

Also, I noticed when you add a column for Color in a Table and the user selects a new color, the new data will be saved in the 0-255 range instead of being normalized to 0-1. This somehow causes a problem when dealing with a logical column in the same table when trying to set the logical value programmatically to false ONLY (setting it to true doesn't cause a problem). The table will notice that the numbers of the new color is out of range for Java causing a Java exception


I am also noticing strange behaviour with the CheckboxTree that is not present with the Tree. I am using a html string such as:

sprintf( '<html><Font color = "rgb(0,180,0)">%s</font></html>', name )

It works fine for most nodes, but some exhibit strange behaviour with the CheckboxTree. In particular a node which has a child and has a space in its string truncates to only the first word, but then if I click on the name (not the checkbox) the full name appears, then disappears again sometimes if I click on it a second time or always if I expand the node. Also some of the other even short strings are being visually clipped in a seemingly arbitrary way. All works fine for the regular tree though. It also works fine without using html strings so it is a bit of a niche bug, I just wanted part of my strings to be a different colour.

I like the look of the toolbox on the whole though.

Robyn Jackey

@Manuel - Thank you for reporting this. I had not noticed this before, but will take a look when I have some time.

Hi Robyn,
Thank you so much for this great submission! Really helpful!
I noticed a weird behavior of the CheckboxTree about the FontSize property: everything works fine with Tree (properties are updated correctly in the object and visually), however with CheckboxTree the object is correctly updated but the size of the font do not changed. Is it possible to actually change it ?

Robyn Jackey

@Roman - thank you for reporting this. That was unintentional and I will try to fix this soon. Please bear with me as the end of year is very busy.

The current version is NOT compatible with R2017a. It uses isStringScalar, which was introduced in R2017b.

Robyn Jackey

@Carsten - Ideally you should retain the handles of each tree node and track them with your data hierarchy. You could also store anything you like in the UserData property of the nodes.

@Giuseppe - For deployment, you will need to manually select the Java JAR file you mentioned from the Widgets toolbox installation directory. You may also need to manually include any icon files you are using in your GUI, if they don't get picked up automatically by the deployment tool.

Hi Robyn,

Thanks for a great toolbox!

I have a very simple (I think!) question: I want to be able to determine the state of a checkbox in a CheckboxTreeNode, but as the nodes have no 'Tag' I'm not able to find them!? I don't want to find them by the 'Name' property, as this sometimes changes. I will also like to be able to programmtically check and uncheck the checkboxes - how can I accomplish that?


Hello Robyn

I developed an app that uses your toolbox, I packed it and sent to one of my colleagues. He managed to install it, but he gets the following error:

Error using javaObjectEDT
No class can be located on the Java class path

I solved it adding programmatically the file "MathWorksConsultingWidgets.jar" in the java class path. Is this the only way to get rid of the problem?


Robyn Jackey

Kiron - The new version just posted 1.1.257 should fix this issue.

Hi Robyn, great toolbox! I am trying to prevent the display of what seems to be an active display of mouse events in the Table widget. I get command window output of "up", "down", "click", when manipulating the table. All the callbacks that I have access to are empty, so I am wondering if it is a level deeper? Thanks!

Robyn Jackey

Release 1.0.245 just posted contains minor changes. Please see the release notes at the bottom of this page. A larger update with significant bugfixes, improvements, and additional functionality is in review now.

Robyn Jackey

Hi Dani - yes, sorry for this. The approval process for publishing version 1.1 has delayed the release for several months. I anticipate another few weeks. (A temporary release 1.0.x will be arriving within a few days but has minimal changes.)


Takes a long time for that 1.1 release to come out?

Robyn Jackey

Hi Tyler, thanks for letting me know. I have it fixed in the upcoming release.

Tyler Cumby

Hi Robyn, I just noticed that uiw.mixin.HasLabel's LabelFontWeight property is defined as "double" instead of "char".

Robyn Jackey

Thank you Tyler!

Tyler Cumby

I just wanted to voice my appreciation of Table and TableColumFormat: you've made it really easy to incorporate our own custom table cell editors and renderers. Thanks!

Robyn Jackey

@Kai - The "Compatible with any release" is an error. I've corrected this in version 1.1 which is currently going through submission approval process. It does require R2017a because many of the classes use property validators. This feature is a very useful programming aid and also permits automatic conversions to the property's datatype, which makes using them easier. That said, I understand some users are fixed on an earlier release for other reasons. Your earlier comment about the tree control may have been overwritten by this one. I'd like to follow up and see if I can reproduce that problem. Can you please PM me to discuss both of these by clicking on my name above and click "Contact Author"?

Additionally, it says on the right to be compatible with any Matlab release, yet it requires 2017a to work, which is a quite limiting restriction.

Robyn Jackey

@Rebecca, I have not encountered this before. Are you using R2017a or greater? If you are still having trouble, please PM me (click on my name above, then click the Contact button below my photo)

Hi Robyn, we're testing the toolbox on a new computer that downloaded the .mtlbx file, and are getting the following error, do you have any tips?

Error using hgconvertunits
Input was not a valid graphics object
Error in getpixelposition
Error in uiw.abstract.BaseContainer/getPixelSize (line 78)
pos = getpixelposition(obj,false);
Error in uiw.abstract.WidgetContainer/onContainerResized (line 194)
[wC,hC] = obj.getPixelSize();
Error in uiw.mixin.HasLabel (line 77)
Error in uiw.abstract.WidgetContainer (line 37)
Error in uiw.widget.Toolstrip (line 49)
function obj = Toolstrip(varargin)
Error in demoToolstrip (line 22)
w = uiw.widget.Toolstrip(...

@Robyn, perfect, thank you! I will use the JControl for now and await the next version.

Robyn Jackey

@Rebecca - You would want to set a keyboard callback on the table itself, rather than the figure. The upcoming release (currently in final testing) has this. If you need it right away, you can do something like this: w.JControl.KeyPressedCallback = @(h,e)disp(e). Or if you PM me I will send you a prerelease version.

Works great, thanks Robyn! I have one more question: it seems that clicking on a row does something to the window key press listener, such that any callbacks for key presses are not activated while the row/cells are highlighted. I've tried adding a 'WindowKeyPress' listener to the main figure, and that causes the callback to execute, but only after clicking out of the table. What I'd like to do is to be able to select a row, hit delete, and activate a callback that deletes that row (which I have written), but I can't get the delete key press callback to activate. Do you know how to get around this?

Robyn Jackey

@Rebecca - Great idea! I think I can add a new property to set the grid color. For now, this is undocumented, but you can do this:
w.JControl.setGridColor( uiw.abstract.JavaControl.rgbToJavaColor([1 0 0]) )

Is there a way to add borders to the table cells? Right now the white cells and very close-to-white borders make all of the cell contents run together and hard to distinguish columns, such as in the example


Robyn Jackey

@David - I haven't been able to reproduce it myself, but it may help to put in an extra guard to avoid the Java exception. If you insert this just before line 448 in Table.m, it should just return if that error condition occurs:

% Re-verify the number of rows and columns
if rIdx > obj.JTableModel.getRowCount() || cIdx > obj.JTableModel.getColumnCount()

Please let me know if this helps.

Robyn Jackey

@David - I think you're doing everything correctly. I have had a similar report from another user about a Java error like this, that I need to investigate. I don't know if it would make a difference, but you might try setting the "Data" property instead of "DataTable". The "Data" property has had more testing, while "DataTable" was added as a convenience but it may be doing more under the hood since it also sets the ColumnName. I will post back when I find more. If you can reliably reproduce this, it would be great to get an example. You can PM me from the author page (click on my name above) to email me.


For the Table widget, what should the procedure be to remove a row from the table? I have created a pushbutton uicontrol that first reads the SelectedRows from the widget, removes that row from the Matlab table that is my data source, then re-sends the now shortened table to the widget via the DataTable property. Even though everything seems to work as expected (the selected row is removed from the Table widget and the figure updates correctly), I am getting a Java 'IndexOutOfBounds' exception in the command window from the widget's source file, line 448 (onTableModelChanged function). I'm not sure if this is an issue with the widget or my approach though.

Robyn Jackey

@Giuseppe - I may need a bit more info to reproduce this issue. Can you PM me and send some example code?

Still didn't manage to find a way to deselect the checked boxes when I select a new box with the CheckboxTree....As far as I know there is no option yet to do that so I am trying to do it myself....I have the impression it is a bit unstable, though

Robyn Jackey

@Marnoch - Glad you are liking the Widgets Toolbox! You're right that the Tree in Widgets Toolbox does not currently support lazy loading of nodes. Actually, I've had very few requests for it, but it is something I will consider for a future update.

This looks like a very useful set of functionality, but I have an issue. I am developing an application where we have a potentially very large number of nodes and branches. I have been using the depreciated uitree and related functions, but was hoping to switch to using this toolbox. The problem I have is that it is very advantagous for us to use lazy noding, or dynamic node creation, so that nodes are not created until their parent is expanded. I have been acheving this by manipulating the AllowsChildren and isLeaf properties of uitree nodes, however there is no equivilent property to isLeaf that is settable on either type of tree included in this toolbox. This means that the user is not shown a control to expand a node until child nodes are actually added, which prevents the lazy noding technique being used. Is there a way to acheive somethig similar?



Thanks for the install instructions.
One more thing. Could be useful if in Toolstrip the Background color of the sections and the object behind them could be controlled separately as to make the sections stand out more.

Robyn Jackey

@Dani - Thanks for the feedback! I'll have a look and make some improvements.

For installation, I recommend downloading the toolbox file and installing that way, which handles everything. This method also adds the Java .jar file under \resource to the static Java path for the next launch. If you download as a zip, you need to add everything to the MATLAB path, adding the one .jar file either via javaaddpath (dynamic Java path) or to javaclasspath.txt (static Java path - preferred).


Nice! I especially like the Toolstrip. Few comments:

1. Would be nice to have some installation instructions (which paths to add) so that one can run the demos out of the box. With several demos I get
Error using javaObjectEDT

No class can be located on the Java class path
No class can be located on the Java class path

2. demoColorSelector gives an error because roundn of the Mapping Toolbox is not available. Would be nice if this would run without special toolbox functions.

3. In several examples, e.g. demoEditablePopup, the objects are not high enough and the bottom line of the box around the popup does not show. On my system is I have to use 'Position',[10 10 300 26]); instead of the default 25. Would be nice if one could query the objects for how large they should be. Popups and normal edit boxes often behave differently with popups needing a bit more height.

4. What is FixedText?

5. FolderSelector
Would be nice to have a folder selector that also shows the contents of the individual folders. I often only know which folder I want to use once I see what it contains.

6. Make objects not focusable? When one clicks in demoPopup or demoSlider they get a stippeled rim around them. Deactivate?




Added ListSelector widget and dialog. Added a few new utilities. Various other small bugfixes and improvements. See release notes in GettingStarted.mlx


Bugfixes to Table for editing with numeric data format and for color column format


Minor bugfixes: string support, R2017a, SessionManagement, CheckboxTree, Table
See GettingStarted.mlx for release notes.


Various bugfixes. See release notes in GettingStarted.mlx


Add application superclasses and demo
Add logging capabilities
New widgets: ImageSelector, ProgressBar
New dialogs: About, SearchList, TableSelection
Various bugfixes
Rename FixedText widget to Text
(Release notes in GettingStarted.mlx)


Toolstrip renamed Toolbar to accurately reflect its capability. Toolbar also now enables toggling group visibility to show/hide sections.

Added Contents.m file to allow toolbox and version number to be registered with "ver" command in MATLAB.

Minor bugfix to List, Popup, Table.

MATLAB Release Compatibility
Created with R2019a
Compatible with R2017a to any release
Platform Compatibility
Windows macOS Linux