Control Java GUI using Matlab GUI
Show older comments
Good day!
I would like to ask on how can I control Java GUI using Matlab GUI? I have these GUIs perfectly working independent of each other and now I would like to somewhat link them by enabling the buttons of the Java GUI using the buttons of Matlab GUI. It is more like controlling the Java GUI using Matlab GUI.
For an instance, the Java GUI has a start button and a "combo box" (aka pop-up menu in Matlab) that contains cases 0, 1, and 2. It is up to the user which case to choose and after choosing, he has to press the start button. But what I would like to happen is that the selection should now depend on what Matlab GUI the user is currently running.
While I have three Matlab GUIs (different *.fig files) that contain several handles. For each of the Matlab GUIs, I would like to assign a single push button to enable the Java GUI.
For an example: Matlab GUI_A's push button will trigger/enable case 0 and start button of Java GUI. Matlab GUI_B's push button will trigger/enable case 1 and start button of Java GUI. Matlab GUI_C's push button will trigger/enable case 2 and start button of Java GUI.
I have the following codes for the Java GUI:
private void btnStartListenActionPerformed(java.awt.event.ActionEvent evt) {
btnStartListen.setEnabled(false);
btnStopListen.setEnabled(true);
//combo box
new Thread() {
@Override
public void run() {
try {
int timeout = 0;
switch(comboListenTime.getSelectedIndex()) {
case 0:
timeout = 30000;
break;
case 1:
timeout = 60000;
break;
case 2:
timeout = 90000;
break;
default:
timeout = 30000;
}
startServer(timeout);
}
catch(Exception e) {
System.err.println(e);
}
}
}.start();
}
Now, my problem is how to construct the codes for the pushbutton_Callback function of three Matlab GUIs such that they will run each of the cases of the Java GUI.
Any form of help will do.
Thank you!
Answers (0)
Categories
Find more on Call Java from MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!