GUI with System Tray Icon
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I made a standalone application which create system tray icon with java language. In GUI Figure I made an button 'Minimize' to hide figure from window(make figure invisible) in myGUI.m file and also made system tray menu 'Open' to make figure visible again in another m file with calling 'myGUI'. But the problem is that my exe file terminate unexpectedly. dos cmd says, matlab standalone application is supposed to terminate when there is no figure. But I really want to use exe file without figure, only with SytemTray Icon menu.
is there anyone who knows how fix the problem?
The following code is part of my code
- main m file for compiler name : createSystray
-----------------------------
Main_GUI
sysTray = java.awt.SystemTray.getSystemTray;
myIcon = fullfile('abc.png');
iconImage = java.awt.Toolkit.getDefaultToolkit.createImage(myIcon);
trayIcon = java.awt.TrayIcon(iconImage);
openMenu = java.awt.M
set(openMenu, 'ActionPerformedCallback', 'Main_GUI')
workMenu = java.awt.MenuItem('Work');
set(workMenu, 'ActionPerformedCallback', 'Work') <- there is another m file with name Work
jmenu = java.awt.PopupMenu;
jmenu.add(openMenu);
jmenu.addSeparator;
jmenu.add(workMenu);
trayIcon.setPopupMenu(jmenu);
--------------------------------------------------
- part of GUI m file for standalone application name : Main_GUI
*******
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% createSystray
set(handles.figure1,'visible','off')
waitfor(handles.text1,'visible','off')
***************
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su MATLAB Compiler in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!