MATLAB 设置窗口图标

% --- Executes just before GUI_MAIN is made visible.
function GUI_MAIN_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to GUI_MAIN (see VARARGIN)

% Choose default command line output for GUI_MAIN
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);
%%
%修改图标
h = handles.GUI_MAIN;                            %返回其句柄?
newIcon = javax.swing.ImageIcon('ship.png');
figFrame = get(h,'JavaFrame');                  %取得Figure的JavaFrame。?
figFrame.setFigureIcon(newIcon);             %修改图标?

你可能感兴趣的:(MATLAB)