From: Yair Altman on 16 Mar 2010 17:30 > Still can't get multiple lines of text on a static guide text object. I tried using a cell array of strings (actually using the java example in cell help & using the more difficult cellstr function) in the static text create function but it doesn't work. Multi-line text labels are unsupported in the standard uicontrols, but you can use simple Java controls and HTML line-breaks for this: jLabel = javax.swing.JLabel('<html>This is a long<br>multi-line string'); [jhLabel,hcontainer] = javacomponent(jLabel,[10,10,100,30],gcf); If your multiple lines are stored in a cell-array, you can convert this into a multi-line HTML string as follows: strs = {'very long','multi-line','string'}; htmlStr = sprintf('<html>%s%s', sprintf('%s<br>',c{1:end-1}), c{end}); jLabel = javax.swing.JLabel(htmlStr); [hcomponent,hcontainer] = javacomponent(jLabel,[10,50,50,20],gcf); More about using HTML in Matlab labels: http://undocumentedmatlab.com/blog/customizing-matlab-labels/ Yair Altman http://UndocumentedMatlab.com
From: Doug Schwarz on 16 Mar 2010 17:50 Eric Diaz wrote: > Hi Doug, > > Still can't get multiple lines of text on a static guide text object. I > tried using a cell array of strings (actually using the java example in > cell help & using the more difficult cellstr function) in the static > text create function but it doesn't work. Eric, You must be using an older version -- it works in R2009a at least. It's even documented. > I looked at your uibutton gui but it doesn't really seem intuitive with > respect to its usage within guide. I guess I'm not too surprised uibutton doesn't play well with guide as I have never used it. It was worth a shot. -- Doug Schwarz dmschwarz&ieee,org Make obvious changes to get real email address.
From: Eric Diaz on 16 Mar 2010 19:33 Hi Doug, Actually, I have MATLAB Version 7.9.0.529 (R2009b). So, maybe the functionality broke between 2009a and 2009b. Thanks, Eric Doug Schwarz <see(a)sig.for.address.edu> wrote in message <j2Tnn.22381$NH1.5698(a)newsfe14.iad>... > Eric Diaz wrote: > > Hi Doug, > > > > Still can't get multiple lines of text on a static guide text object. I > > tried using a cell array of strings (actually using the java example in > > cell help & using the more difficult cellstr function) in the static > > text create function but it doesn't work. > > Eric, > > You must be using an older version -- it works in R2009a at least. It's > even documented. > > > > I looked at your uibutton gui but it doesn't really seem intuitive with > > respect to its usage within guide. > > I guess I'm not too surprised uibutton doesn't play well with guide as I > have never used it. It was worth a shot. > > -- > Doug Schwarz > dmschwarz&ieee,org > Make obvious changes to get real email address.
From: Eric Diaz on 16 Mar 2010 19:36
Hi Yair, Thanks for your input. I had actually seen the html stuff for guide on the website before when I had been looking, however, since I don't know html or java hardly at all, I was just lost. I appreciate that it there is a lot of documented undocumented functionality though on the website! Thanks again, Eric "Yair Altman" <altmanyDEL(a)gmailDEL.comDEL> wrote in message <hnot9n$34o$1(a)fred.mathworks.com>... > > Still can't get multiple lines of text on a static guide text object. I tried using a cell array of strings (actually using the java example in cell help & using the more difficult cellstr function) in the static text create function but it doesn't work. > > > Multi-line text labels are unsupported in the standard uicontrols, but you can use simple Java controls and HTML line-breaks for this: > > jLabel = javax.swing.JLabel('<html>This is a long<br>multi-line string'); > [jhLabel,hcontainer] = javacomponent(jLabel,[10,10,100,30],gcf); > > If your multiple lines are stored in a cell-array, you can convert this into a multi-line HTML string as follows: > > strs = {'very long','multi-line','string'}; > htmlStr = sprintf('<html>%s%s', sprintf('%s<br>',c{1:end-1}), c{end}); > jLabel = javax.swing.JLabel(htmlStr); > [hcomponent,hcontainer] = javacomponent(jLabel,[10,50,50,20],gcf); > > More about using HTML in Matlab labels: http://undocumentedmatlab.com/blog/customizing-matlab-labels/ > > Yair Altman > http://UndocumentedMatlab.com |