% Now let's prepare a tab panel with our label and close button Set (jCloseButton, (h,e ) delete (tab2 ) ) % Now let's prepare the close button: icon, size and callback IconsFolder = '/com/mathworks/mwt/resources/' JarFile = fullfile ( matlabroot, '/java/jar/mwt.jar' ) The solution is to set our own custom control as the requested tab, and add our icon (or other customizations) to it. Unfortunately, for some reason that I do not fully understand, jTabGroup. Icons and sub-components can be added to the tabs. ![]() Which leads us to our next customization: Icon images Similarly, we can also set a background gradient image for the tabs, using the CSS background-image directive. We can set the foreground text color using the CSS color directive. Uitabgroup with non-default forground and background tab colors and fonts % Equivalent manners to set a yellow tab background: Also remember that Java uses 0-based indexing so tab #1 is actually the second tab: Note that setForegroundAt() overrides anything set by setForeground(). We can set the tab font color using setForeground() and setForegroundAt(), or via HTML. JTabGroup = getappdata(handle(hTabGroup),'JTabbedPane') Foreground & background tab colors Uicontrol(tab2, 'String','Close', 'Callback','close(gcbf)') Tab2 = uitab(hTabGroup, 'title','Panel 2') Tab1 = uitab(hTabGroup, 'title','Panel 1') JTabGroup = getappdata (handle (hTabGroup ), 'JTabbedPane' ) % Get the underlying Java reference (use hidden property) ![]() Uicontrol (tab2, 'String', 'Close', 'Callback', 'close(gcbf)' ) ![]() Tab2 = uitab (hTabGroup, 'title', 'Panel 2' ) Tab1 = uitab (hTabGroup, 'title', 'Panel 1' ) Ī = axes ( 'parent', tab1 ) surf ( peaks ) % Prepare a tab-group consisting of two tabs % Prevent an annoying warning msg warning off MATLAB:uitabgroup:OldVersion
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |