Main Content

javaObjectEDT

CallJavaconstructor on Event Dispatch Thread (EDT)

Description

example

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

Examples

collapse all

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

创建一个JOptionPaneon the EDT.

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

Call thecreateDialogmethod 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 byClassName, specified as any type. The class constructor argument list specifies the argument type.

More About

collapse all

EDT

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

Tips

  • MATLAB®calls methods onJavaObjfrom the EDT.

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

Version History

Introduced in R2009a