Skip to Main Content Skip to Search
Product Documentation

javaObjectEDT - Java object constructor on Event Dispatch Thread (EDT)

Syntax

jObj = javaObjectEDT(ClassName,x1,...,xn)

Description

jObj = javaObjectEDT(ClassName,x1,...,xn) invokes the Java constructor for class ClassName with the signature matching the arguments x1,...,xn from the EDT and returns a Java object array.

Tips

Input Arguments

ClassName

Java class name.

x1,...,xn

Optional input arguments for class constructor. If none, MATLAB calls the no-argument constructor.

Output Arguments

jObj

Java object array. MATLAB invokes subsequent methods on this object from the EDT.

Examples

Construct and return a javax.swing.JFrame object array from the EDT.

f = javaObjectEDT('javax.swing.JFrame', 'New Title')
 

Create a JOption pane on the EDT and call the createDialog method.

% Create a JOption pane on the EDT
optPane = javaObjectEDT('javax.swing.JOptionPane');
% Call the createDialog method - automatically done on the EDT
dlg = optPane.createDialog([],'Sample Dialog');
% Tell MATLAB to dispatch methods on dlg from the EDT
javaObjectEDT(dlg);

See Also

import | isjava | javaMethodEDT | javaObject | methods

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS