UICOMPONENT - expands uicontrol to all Java classes

버전 1.8.0.0 (59.6 KB) 작성자: Yair Altman
Enhanced replacement for uicontrol & javacomponent, accepting all Java (Swing/AWT) style components
다운로드 수: 12K
업데이트 날짜: 2016/3/30

라이선스 보기

UICOMPONENT is intended as a direct replacement of Matlab's built-in UICONTROL and JAVACOMPONENT functions. It accepts all parameters and styles that UICONTROL accepts, as well as any other displayable Java (Swing/AWT) component class. The calling convention and syntax of UICONTROL were preserved for full backwards compatibility.

UICOMPONENT uses the built-in UICONTROL whenever possible (i.e, for all the standard styles), and uses JAVACOMPONENT to create and display all the other java classes. UICOMPONENT supports the entire Swing/AWT and any user-defined classes, in several equivalent case-insensitive formats. For example, 'Spinner', 'spiNNer', 'JSpinner' and 'javax.swing.jspinner' are all equivalent and recognized.
Notable new styles that are now available (unavailable in built-in UICONTROL): spinner, slider, editable comboBox, passwordField, tree, table, fileChooser, colorChooser, progressBar, applet. But there are so many more - whatever is available in Java is now seamlessly available in your Matlab GUI.

Examples (more examples in attached screenshot & in the help comment):
- uicomponent('style','jspinner','value',7); % simple spinner with initial value
- uicomponent('style','javax.swing.jslider','tag','myObj'); % simple horizontal slider
- uicomponent('style','JComboBox',{1,pi,'text'},'editable',true); % editable drop-down
The screenshot can be recreated using the createScreenshot script that is included in this submission. It is provided to illustrate the use of UICOMPONENT for various different components.

Callbacks:
Over 30 callback hooks are exposed to the user for all components (the exact list depends on the specific java component used). These callbacks include mouse movement/clicks, keyboard events, focus gain/loss, data changes etc.

Warning:
This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7+, but use at your own risk!

Technical description:
http://undocumentedmatlab.com/blog/javacomponent

Change log:
See the bottom of this page
Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)

인용 양식

Yair Altman (2024). UICOMPONENT - expands uicontrol to all Java classes (https://www.mathworks.com/matlabcentral/fileexchange/14583-uicomponent-expands-uicontrol-to-all-java-classes), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2007a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.8.0.0

Added support for all HG2 containers (inc. uiextras) as parents, per suggestion by D. Sampson

1.7.0.0

Added missing Java files to the zip file; clarified about the createScreenshot script in main description text.

1.6.0.0

Added tabs and panels as acceptable parent containers per suggestion by Amir G.

1.2.0.0

Fixed a bug in setting the JavaComponent field

1.1.0.0

Fixed for R2014b (HG2)

1.0.0.0

Handle shortened property names per suggestion by H. Marx