function [handles,levels,parentIdx,listing] = findjobj(container,varargin)
%findjobj Find java objects contained within a specified java container or Matlab GUI handle
%
% Syntax:
% [handles, levels, parentIds, listing] = findjobj(container, 'PropName',PropValue(s), ...)
%
% Input parameters:
% container - optional handle to java container uipanel or figure. If unsupplied then current figure will be used
% 'PropName',PropValue - optional list of property pairs (case insensitive). PropName may also be named -PropName
% 'position' - filter results based on those elements that contain the specified X,Y position or a java element
% Note: specify a Matlab position (X,Y = pixels from bottom left corner), not a java one
% 'size' - filter results based on those elements that have the specified W,H (in pixels)
% 'class' - filter results based on those elements that contain the substring (or java class) PropValue
% Note1: filtering is case insensitive and relies on regexp, so you can pass wildcards etc.
% Note2: '-class' is an undocumented findobj PropName, but only works on Matlab (not java) classes
% 'property' - filter results based on those elements that possess the specified case-insensitive property string
% Note1: passing a property value is possible if the argument following 'property' is a cell in the
% format of {'propName','propValue'}. Example: FINDJOBJ(...,'property',{'Text','click me'})
% Note2: partial property names (e.g. 'Tex') are accepted, as long as they're not ambiguous
% 'depth' - filter results based on specified depth. 0=top-level, Inf=all levels (default=Inf)
% 'flat' - same as specifying: 'depth',0
% 'not' - negates the following filter: 'not','class','c' returns all elements EXCEPT those with class 'c'
% 'persist' - persist figure components information, allowing much faster results for subsequent invocations
% 'nomenu' - skip menu processing, for "lean" list of handles & much faster processing;
% This option is the default for HG containers but not for figure, Java or no container
% 'print' - display all java elements in a hierarchical list, indented appropriately
% Note1: optional PropValue of element index or handle to java container
% Note2: normally this option would be placed last, after all filtering is complete. Placing this
% option before some filters enables debug print-outs of interim filtering results.
% Note3: output is to the Matlab command window unless the 'listing' (4th) output arg is requested
% 'list' - same as 'print'
% 'debug' - list found component positions in the Command Window
%
% Output parameters:
% handles - list of handles to java elements
% levels - list of corresponding hierarchy level of the java elements (top=0)
% parentIds - list of indexes (in unfiltered handles) of the parent container of the corresponding java element
% listing - results of 'print'/'list' options (empty if these options were not specified)
%
% Note: If no output parameter is specified, then an interactive window will be displayed with a
% ^^^^ tree view of all container components, their properties and callbacks.
%
% Examples:
% findjobj; % display list of all javaelements of currrent figure in an interactive GUI
% handles = findjobj; % get list of all java elements of current figure (inc. menus, toolbars etc.)
% findjobj('print'); % list all java elements in current figure
% findjobj('print',6); % list all java elements in current figure, contained within its 6th element
% handles = findjobj(hButton); % hButton is a matlab button
% handles = findjobj(gcf,'position',getpixelposition(hButton,1)); % same as above but also return hButton's panel
% handles = findjobj(hButton,'persist'); % same as above, persist info for future reuse
% handles = findjobj('class','pushbutton'); % get all pushbuttons in current figure
% handles = findjobj('class','pushbutton','position',123,456); % get all pushbuttons at the specified position
% handles = findjobj(gcf,'class','pushbutton','size',23,15); % get all pushbuttons with the specified size
% handles = findjobj('property','Text','not','class','button'); % get all non-button elements with 'text' property
% handles = findjobj('-property',{'Text','click me'}); % get all elements with 'text' property = 'click me'
%
% Sample usage:
% hButton = uicontrol('string','click me');
% jButton = findjobj(hButton,'nomenu');
% % or: jButton = findjobj('property',{'Text','click me'});
% jButton.setFlyOverAppearance(1);
% jButton.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.HAND_CURSOR));
% set(jButton,'FocusGainedCallback',@myMatlabFunction); % some 30 callback points available...
% jButton.get; % list all changeable properties...
%
% hEditbox = uicontrol('style',edit');
% jEditbox = findjobj(hEditbox,'nomenu');
% jEditbox.setCaretColor(java.awt.Color.red);
% jEditbox.KeyTypedCallback = @myCallbackFunc; % many more callbacks where this came from...
% jEdit.requestFocus;
%
% Known issues/limitations:
% - Cannot currently process multiple container objects - just one at a time
% - Initial processing is a bit slow when the figure is laden with many UI components (so better use 'persist')
% - Passing a simple container Matlab handle is currently filtered by its position+size: should find a better way to do this
% - Matlab uipanels are not implemented as simple java panels, and so they can't be found using this utility
% - Labels have a write-only text property in java, so they can't be found using the 'property',{'Text','string'} notation
%
% Warning:
% This code heavily relies on undocumented and unsupported Matlab functionality.
% It works on Matlab 7+, but use at your own risk!
%
% Bugs and suggestions:
% Please send to Yair Altman (altmany at gmail dot com)
%
% Change log:
% 2010-04-21: Minor fix to support combo-boxes (aka drop-down, popup-menu) on Windows
% 2010-03-17: Important release: Fixes for R2010a, debug listing, objects not found, component containers that should be ignored etc.
% 2010-02-04: Forced an EDT redraw before processing; warned if requested handle is invisible
% 2010-01-18: Found a way to display label text next to the relevant node name
% 2009-10-28: Fixed uitreenode warning
% 2009-10-27: Fixed auto-collapse of invisible container nodes; added dynamic tree tooltips & context-menu; minor fix to version-check display
% 2009-09-30: Fix for Matlab 7.0 as suggested by Oliver W; minor GUI fix (classname font)
% 2009-08-07: Fixed edge-case of missing JIDE tables
% 2009-05-24: Added support for future Matlab versions that will not support JavaFrame
% 2009-05-15: Added sanity checks for axes items
% 2009-04-28: Added 'debug' input arg; increased size tolerance 1px => 2px
% 2009-04-23: Fixed location of popupmenus (always 20px high despite what's reported by Matlab...); fixed uiinspect processing issues; added blog link; narrower action buttons
% 2009-04-09: Automatic 'nomenu' for uicontrol inputs; significant performance improvement
% 2009-03-31: Fixed position of some Java components; fixed properties tooltip; fixed node visibility indication
% 2009-02-26: Indicated components visibility (& auto-collapse non-visible containers); auto-highlight selected component; fixes in node icons, figure title & tree refresh; improved error handling; display FindJObj version update descript
没有合适的资源?快使用搜索试试~ 我知道了~
iOS游戏应用源代码——twyatt-tictactoe-5f716b5.zip
共49个文件
m:39个
fig:3个
wav:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 143 浏览量
2023-07-05
23:24:40
上传
评论
收藏 1.27MB ZIP 举报
温馨提示
iOS游戏应用源代码——twyatt-tictactoe-5f716b5.zip
资源推荐
资源详情
资源评论
收起资源包目录
iOS游戏应用源代码——twyatt-tictactoe-5f716b5.zip (49个子文件)
twyatt-tictactoe-5f716b5
boardIsFull.m 238B
credits.fig 370KB
instructions.png 144KB
click.wav 63KB
newGame.m 248B
initSquare.m 71B
game.fig 5KB
initInstructions.m 56B
loadAudio.m 135B
mouseclick.dll 24KB
lose.wav 80KB
boardRender.m 530B
closePlayerNames.m 535B
setPlayerName.m 446B
activateUndo.m 128B
instructions.fig 3KB
lineScore.m 564B
initGame.m 226B
minimax.m 1021B
boardScore.m 552B
boardColor.m 602B
findWins.m 1KB
findjobj.m 139KB
flattenPushButtons.m 96B
setfocus.m 2KB
getHandleForSquareAt.m 260B
boardChildren.m 1KB
setGameType.m 699B
gameOver.m 72B
win.wav 529KB
callbackPlayerName.m 661B
deactivateUndo.m 98B
computerRandomMove.m 275B
callbackBoard.m 1KB
switchTurn.m 65B
callbackInstructions.m 29B
.gitignore 5B
scoreboardUpdate.m 474B
boardAvailableSquares.m 190B
same.m 333B
callbackClose.m 6B
callbackUndo.m 205B
credits.png 333KB
findWinner.m 615B
initCredits.m 52B
clearBoard.m 263B
callbackCredits.m 24B
computersMove.m 1KB
callbackHint.m 452B
共 49 条
- 1
资源评论
快乐无限出发
- 粉丝: 1143
- 资源: 7294
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功