Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
jLabel (setVisible)

Subject: jLabel (setVisible)

From: wma

Date: 8 Feb, 2010 10:30:05

Message: 1 of 4

Hello,

is there a possibility to hide (disable) a jlabel which is created like this:

global output
global jLabel
global hcomponent
global hcontainer
output = '<html><p>test</p></html>';
jLabel = javaObjectEDT('javax.swing.JLabel',output);
[hcomponent,hcontainer] = javacomponent(jLabel,[10,10,610,420],gcf);

i already tried

jLabel.list but i cannot find anything.

I have several menuitems where i have to switch the text inside the label.
I need rich-text functions so i have to use something like jlabel right?

Does anyone can paste code for jtextea ?

Subject: jLabel (setVisible)

From: Yair Altman

Date: 8 Feb, 2010 10:50:04

Message: 2 of 4

"wma " <wma@wma.test> wrote in message <hkop3d$19a$1@fred.mathworks.com>...
> Hello,
>
> is there a possibility to hide (disable) a jlabel which is created like this:
>
> global output
> global jLabel
> global hcomponent
> global hcontainer
> output = '<html><p>test</p></html>';
> jLabel = javaObjectEDT('javax.swing.JLabel',output);
> [hcomponent,hcontainer] = javacomponent(jLabel,[10,10,610,420],gcf);
>
> i already tried
>
> jLabel.list but i cannot find anything.
>
> I have several menuitems where i have to switch the text inside the label.
> I need rich-text functions so i have to use something like jlabel right?
>
> Does anyone can paste code for jtextea ?

1. Use the UIInspect utility to understand which methods and properties are available on your object: http://www.mathworks.com/matlabcentral/fileexchange/17935-uiinspect-display-methodspropertiescallbacks-of-an-object . In your specific case, there are separate properties (and accessor methods) for hiding/showing and for enabling/disabling.
2. Dynamic menu items were explained here: http://undocumentedmatlab.com/blog/setting-listbox-mouse-actions/
3. Rich-text in Matlab text-areas (editboxes) was explained here: http://undocumentedmatlab.com/blog/rich-matlab-editbox-contents/

Yair Altman
http://UndocumentedMatlab.com

Subject: jLabel (setVisible)

From: wma

Date: 9 Feb, 2010 19:01:21

Message: 3 of 4

> 1. Use the UIInspect utility to understand which methods and properties are available on your object: http://www.mathworks.com/matlabcentral/fileexchange/17935-uiinspect-display-methodspropertiescallbacks-of-an-object . In your specific case, there are separate properties (and accessor methods) for hiding/showing and for enabling/disabling.
> 2. Dynamic menu items were explained here: http://undocumentedmatlab.com/blog/setting-listbox-mouse-actions/
> 3. Rich-text in Matlab text-areas (editboxes) was explained here: http://undocumentedmatlab.com/blog/rich-matlab-editbox-contents/
>
> Yair Altman
> http://UndocumentedMatlab.com

Thank you for your answer. thank you for this very interesting tool

Im still stuck here:

I created an object like this:
introtext=uicomponent('style','JLabel','Text',output,'Position'
[10,10,610,420],'Tag','introtext');

at a later point i want to delete or "unvisible" it, how do i manage to delet this object?

set(handles.introtext,'Visible','off') does not work.

Subject: jLabel (setVisible)

From: Yair Altman

Date: 9 Feb, 2010 19:24:04

Message: 4 of 4

"wma " <wma@wma.test> wrote in message <hksbe1$5d2$1@fred.mathworks.com>...
> > 1. Use the UIInspect utility to understand which methods and properties are available on your object: http://www.mathworks.com/matlabcentral/fileexchange/17935-uiinspect-display-methodspropertiescallbacks-of-an-object . In your specific case, there are separate properties (and accessor methods) for hiding/showing and for enabling/disabling.
> > 2. Dynamic menu items were explained here: http://undocumentedmatlab.com/blog/setting-listbox-mouse-actions/
> > 3. Rich-text in Matlab text-areas (editboxes) was explained here: http://undocumentedmatlab.com/blog/rich-matlab-editbox-contents/
> >
> > Yair Altman
> > http://UndocumentedMatlab.com
>
> Thank you for your answer. thank you for this very interesting tool
>
> I'm still stuck here:
>
> I created an object like this:
> introtext=uicomponent('style','JLabel','Text',output,'Position',[10,610,420],'Tag','introtext');
>
> at a later point i want to delete or "unvisible" it, how do i manage to delete this object?
>
> set(handles.introtext,'Visible','off') does not work.

set(introtext,'visible','off') works for me. In your case, handles.introtext may be an empty or invalid handle - set a breakpoint and check.

To completely delete the label, simply do delete(introtext), just like for any other Matlab control. As before, you need a valid handle or else it will not work.

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us