isjava not correct?

2 ビュー (過去 30 日間)
Daniel
Daniel 2016 年 5 月 18 日
コメント済み: Daniel 2016 年 5 月 18 日
When I run the following code:
fH = figure;
textAreaHandle = javaObjectEDT('javax.swing.JTextArea');
scrollPaneHandle = javaObjectEDT('javax.swing.JScrollPane', textAreaHandle);
[javaHandle,matlabHandle] = javacomponent(scrollPaneHandle,[20,20,300,50],fH);
I get a figure with a java text area. When I look at the value of javaHandle it is the following:
javaHandle =
javahandle_withcallbacks.javax.swing.JScrollPane
When I run the isjava command on javaHandle, it returns a false, which is incorrect.
>> isjava(javaHandle)
ans =
0
I am wondering how can I fix this so that isjava returns true when run with this javaHandle variable? Is there another function I can use?
I am running 2015b
Thanks in advance

採用された回答

Walter Roberson
Walter Roberson 2016 年 5 月 18 日
javacomponent is not a documented routine, and the output of it is not specifically a java object (it is a handle to a component, but the handle could be a MATLAB handle.)
You can get the java object by using the java method on the javaHandle
  1 件のコメント
Daniel
Daniel 2016 年 5 月 18 日
Thank you! The following code returned what I wanted
>> isjava(javaHandle.java)
ans =
1

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by