When I click on a Java button object in MATLAB, why does it not evaluate its callback?
古いコメントを表示
When I click on a Java button object in MATLAB, why does it not evaluate its callback?
The callback function for my Java button object is not responding to the button click.
What is the correct way to implement this?
I am using the following code:
function my_java_test()
import java.awt.*
import java.awt.event.*
import javax.swing.*;
f = JFrame(sprintf('Houston... we have a problem'));
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
b = JButton('Hello');
set(b,'ActionPerformedCallback', {@doHelloButtonClicked});
f.getContentPane.add(b)
f.pack
f.show
function doHelloButtonClicked(src, data)
src.setLabel(sprintf('Roger that... pizza has been ordered'));
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Call Java from MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!