Prev: matlab & pico pk101 projector
Next: sym,cell
From: David on 29 Jul 2010 08:56 I am trying to change the icon to a uitree node after creation. Using the setIcon method, which exists accouring to Yair's uiinspect tool, the ccode fails at parent.setIcon(javax.swing.ImageIcon(myIcon)); with this error: ?? No method 'setIcon' with matching signature found for class 'com.mathworks.hg.peer.UITreeNode'. Error in ==> Transceiver_v7_27>add_var_button_callback at 297 parent.setIcon(javax.swing.ImageIcon(myIcon)); ??? Error while evaluating uicontrol Callback Thanks >>>>>>This is the main tree code iconpath = [matlabroot, '/toolbox/matlab/icons/HDF_filenew.gif']; rootNode = uitreenode('v0','dummy', 'Root Node',iconpath, 0); data_struct.template = 0; set(rootNode,'UserData',data_struct) treeModel = DefaultTreeModel( rootNode ); tree = uitree('v0'); drawnow; tree.setModel( treeModel ); set(tree, 'Units', 'normalized',... 'position', [0 0 .36 1.0]); set( tree, 'NodeSelectedCallback',{@sel_cbk,h}); tree.setSelectedNode( rootNode ); >>>>>And This is from where I want to change the icon, where the error happens nodes = tree.getSelectedNodes; node = nodes(1); parent = node; %change Icon from leaf to branch myIcon = [matlabroot, '/toolbox/matlab/icons/foldericon.gif']; parent.setIcon(javax.swing.ImageIcon(myIcon));
From: Yair Altman on 29 Jul 2010 13:10 > I am trying to change the icon to a uitree node after creation. > Using the setIcon method, which exists accouring to Yair's uiinspect tool, the code fails at parent.setIcon(javax.swing.ImageIcon(myIcon)); > > with this error: > > ?? No method 'setIcon' with matching signature found for class 'com.mathworks.hg.peer.UITreeNode'. > > Error in ==> Transceiver_v7_27>add_var_button_callback at 297 > parent.setIcon(javax.swing.ImageIcon(myIcon)); Of course: if you'd actually used the uiinspect utility to look at the tree node handle, you would see that setIcon() expects a java.awt.Image object, which is different than what you try to give it (a javax.swing.ImageIcon). You can convert a Swing ImageIcon to an AWT Image using the ImageIcon's getImage() method. Yair Altman http://UndocumentedMatlab.com
From: David on 29 Jul 2010 14:23 "Yair Altman" <altmanyDEL(a)gmailDEL.comDEL> wrote in message <i2sclc$6p8$1(a)fred.mathworks.com>... > > I am trying to change the icon to a uitree node after creation. > > Using the setIcon method, which exists accouring to Yair's uiinspect tool, the code fails at parent.setIcon(javax.swing.ImageIcon(myIcon)); > > > > with this error: > > > > ?? No method 'setIcon' with matching signature found for class 'com.mathworks.hg.peer.UITreeNode'. > > > > Error in ==> Transceiver_v7_27>add_var_button_callback at 297 > > parent.setIcon(javax.swing.ImageIcon(myIcon)); > > > Of course: if you'd actually used the uiinspect utility to look at the tree node handle, you would see that setIcon() expects a java.awt.Image object, which is different than what you try to give it (a javax.swing.ImageIcon). > > You can convert a Swing ImageIcon to an AWT Image using the ImageIcon's getImage() method. > > Yair Altman > http://UndocumentedMatlab.com Of course, if I ACTUALLY knew what I was doing, I would not have to ACTUALLY ask.....
|
Pages: 1 Prev: matlab & pico pk101 projector Next: sym,cell |