Acess to JAVA handle, Matlab add text to multiline Edit box

2 次查看(过去 30 天)
Hi,
i plan to implement a kind of log-report for my GUI that shows what steps have been done recently.
this code actually implements the editbox with 4 elements, making use of the function 'findjobj' from here
Unfortunately i have no idea how to access this textbox and to add text every time a callback function of my GUI is executed and therefore a report has to be done.
% Begin initialization code - DO NOT EDIT % LOGBOX PROGRAMMATICALLY
str = {'multi','line','editbox', 'test', 'test2'};
hEdit = uicontrol('style','edit','Position',[50 17 851 29],'max',3,'string',str);
% Get the underlying Java control peer (a scroll-pane object)
jhEdit = findjobj(hEdit)
% Check that the scrollpane has a multiline edit control and 2 scrollbars
jhEdit.list
% Get the scroll-pane's internal edit control
jEdit = jhEdit.getComponent(0).getComponent(0)
% Now move the caret position to the end of the text
jEdit.setCaretPosition(jEdit.getDocument.getLength);
HOW CAN I ADD TEXT TO THE TEXTBOX ?
I am very glad for your help!
Best wishes, John

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by