This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Call Java constructor on Event Dispatch Thread (EDT)


JavaObj = javaObjectEDT(ClassName,x1,...,xN)



JavaObj = javaObjectEDT(ClassName,x1,...,xN) returns Java® object array, JavaObj, created from the EDT by the Java constructor for the class with the signature matching the arguments x1,...,xN.


collapse all

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

Create a JOptionPane on the EDT.

optPane = javaObjectEDT('javax.swing.JOptionPane');

Call the createDialog method on the EDT.

dlg = optPane.createDialog([],'Sample Dialog');

Input Arguments

collapse all

Java class name, specified as a string or character vector.

Data Types: char

Java constructor input arguments, 1 through N (if any), required by ClassName, specified as any type. The class constructor argument list specifies the argument type.

More About

collapse all


The EDT is the Event Dispatch Thread, used in Java.


  • MATLAB® calls methods on JavaObj from the EDT.

  • Static methods on the specified class or Java object run on the MATLAB thread unless called using the javaMethodEDT function.

Introduced in R2009a