Comments on: Panel-level uicontrols https://undocumentedmatlab.com/blog_old/panel-level-uicontrols Charting Matlab's unsupported hidden underbelly Thu, 02 May 2024 08:00:01 +0000 hourly 1 https://wordpress.org/?v=4.4.1 By: Matthttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-405837 Tue, 02 May 2017 23:35:58 +0000 https://undocumentedmatlab.com/?p=1976#comment-405837 Garuve, one easy way to put a control on top of a panel simply put the panel as the parent.

exampleFigure = figure;
hp = uipanel('Title','Main Panel','FontSize',12,...
             'BackgroundColor','white',...
             'Position',[.25 .1 .67 .67],...
             'Units', 'Normalized');
cb = uicontrol(hp,'style','checkbox','position',[100,100, 20,20])
]]>
By: Garuvehttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-405788 Tue, 02 May 2017 07:52:32 +0000 https://undocumentedmatlab.com/?p=1976#comment-405788 @Yair: Could you provide an example of doing this (in HG2)? I can’t get it to work (i.e. I don’t know how to put a checkbox uicontrol ‘on top of’ the panel?
Very much appreciated!

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-345906 Mon, 23 Feb 2015 12:33:50 +0000 https://undocumentedmatlab.com/?p=1976#comment-345906 @Kusi – no: in HG2 (R2014b) the Matlab uipanel is (finally!) implemented as a true Java Swing component (deriving from JPanel), and the title is implemented as a standard Java titled-border. In other words, it is no longer a separate uicontrol.

Instead, you can simply place a dedicated checkbox uicontrol on top of the panel, you just need to ensure the position is correct and normalized so that it moves with the panel when it changes its size/position.

]]>
By: Kusihttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-345904 Mon, 23 Feb 2015 11:38:28 +0000 https://undocumentedmatlab.com/?p=1976#comment-345904 In R2014b, it seems like the TitleHandle property is gone. Is there another way to have panel-level check boxes?

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-326156 Wed, 11 Jun 2014 13:54:53 +0000 https://undocumentedmatlab.com/?p=1976#comment-326156 @Patrick – just do as I suggested, read the link I provided.

]]>
By: Patrick Hollandhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-326153 Wed, 11 Jun 2014 13:49:23 +0000 https://undocumentedmatlab.com/?p=1976#comment-326153 Hello Mr. Altman,
i don’t understand. It’s from your own post here.

https://www.mathworks.com/matlabcentral/newsreader/view_thread/148636

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-326152 Wed, 11 Jun 2014 13:46:35 +0000 https://undocumentedmatlab.com/?p=1976#comment-326152 @Patrick – you used javacomponent incorrectly. Read about the correct usage here: https://undocumentedmatlab.com/blog/javacomponent

If you’d like my consulting help with setting up a scroll-panel and other such advanced GUI stuff, please contact me offline – my email link is at the top-right of this page.

]]>
By: Patrick Hollandhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-326150 Wed, 11 Jun 2014 13:31:17 +0000 https://undocumentedmatlab.com/?p=1976#comment-326150 Hello Mr. Altman,
I don’t know where exactly to ask, so I ask here.
I found in the internet one respond from you

[jPanel,hPanel] = javacomponent(javax.swing.JPanel);
set(hPanel, 'units','normalized','position',[.1,.1,.8,.8]);
hControl = uicontrol('style','pushbutton', 'parent',hPanel, 'string','click me');

I have tried this code with Matlab 2013b and the Panel is empty somehow. I don’t know why.
But my question IS… I want to add an undetermined amount of editboxes and labels to a panel. It can be 1 or 32 or even more.
I don’t want to resize them according to the space because then they would be extremely too small. So i need a Scrollbar.

I thought to use a JPanel and put it in a JScrollpane, but i failed at the first step up there. The jPanel is empty.
Do you know what’s wrong?

greetings

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-315961 Wed, 26 Feb 2014 07:30:48 +0000 https://undocumentedmatlab.com/?p=1976#comment-315961 @Ninad – you can try to use property-change listeners.

]]>
By: Ninad kubalhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-315949 Wed, 26 Feb 2014 05:44:00 +0000 https://undocumentedmatlab.com/?p=1976#comment-315949 Can i add callback on any property change of matlab uipanel or uicontrol?

]]>
By: Using Java 7 in Matlab R2013a and earlier | Undocumented Matlabhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-214950 Wed, 19 Jun 2013 19:11:49 +0000 https://undocumentedmatlab.com/?p=1976#comment-214950 […] Notice that the panel names are still missing. So far no solution for this has been found. Perhaps this can be overcome using the fact that uipanel titles are simply hidden children of the panel object. […]

]]>
By: Alexhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-25159 Thu, 09 Dec 2010 13:42:52 +0000 https://undocumentedmatlab.com/?p=1976#comment-25159 I looked at jTabGroup using

uiinspect(jTabGroup)

is there a property to make the separator line appear?

]]>
By: Alexhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-24252 Wed, 01 Dec 2010 10:40:32 +0000 https://undocumentedmatlab.com/?p=1976#comment-24252 Is it in the schema.m? I tried to modify the line

jpanel = javax.swing.JPanel(java.awt.BorderLayout);
[comp2, h.HgContainer] = javacomponent(jpanel,[1 1 1 1], h.parent);

but I couldn’t see the effect.
I’m new to Java, so could you please give me more hints?

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-24202 Tue, 30 Nov 2010 22:26:13 +0000 https://undocumentedmatlab.com/?p=1976#comment-24202 Alex – Matlab uicontrols and axes cannot be added to Java containers (well, at least not without a herculean effort).

This is why MathWorks implemented uitab so that uicontrols/axes are not added directly to the tabs but rather to invisible Matlab containers that are handled by the tab callbacks.

Under the hood, uitab is a simple JTabbedPane that has no containers, only tabs. So, fixing it such that the missing separator line appears should be a simple enough exercise for you.

Please post the necessary changes to the uitab.m file (or its relatives) here if and when you succeed.

]]>
By: Alexhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-23706 Fri, 26 Nov 2010 08:30:35 +0000 https://undocumentedmatlab.com/?p=1976#comment-23706 Thanks, that’s exactly what I was looking for. Can you give ma an example how to add a Matlab uicontrol and axes to a tab? Can I set the ‘parent’ property to an uicontrol or is there another way now?

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-23650 Thu, 25 Nov 2010 16:20:51 +0000 https://undocumentedmatlab.com/?p=1976#comment-23650 Alex – The uitab control (explained here, with additional articles earlier this month that showed how to customize the tab appearance and behavior), hides the separator line in its internal implementation. In the example on this page I used a Java JTabbedPane directly, and this preserves the separator line. Here’s a simple example:

[jTabbedPane, hContainer] = javacomponent('javax.swing.JTabbedPane', [20,50,200,200], gcf);
jTabbedPane.addTab('tab #1',javax.swing.JPanel);
jTabbedPane.addTab('tab #2',javax.swing.JPanel);
]]>
By: Alexhttps://undocumentedmatlab.com/blog_old/panel-level-uicontrols#comment-23620 Thu, 25 Nov 2010 09:20:02 +0000 https://undocumentedmatlab.com/?p=1976#comment-23620 In the first image in this article, how did you achieve the horizontal line under the tabs that are not active?

]]>