GUI with System Tray Icon
조회 수: 10 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!