import javax.swing.*;You can then use any of these classes, but you must make some changes in syntax. The following is a list of those that come to mind:
import javax.swing.* J = JFrame('Hi there') L = JLabel('A Label'); P = J.getContentPane P.add(L) J.setSize(200,200); J.setVisible(1)You can also import your own classes. There are two things that you must get working in order to do this.
javac -target 1.3.1 VectorChooser.java
>> import VectorChooser >> v = VectorChooser(4) v = VectorChooser[frame0,0,0,0x0,invalid,hidden,layout=java.awt.BorderLayout,resizable,title=Vector Chooser,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=null,alignmentY=null,border=,flags=2,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true] >> v.setVisible(1) >> v.setSize(250,200) >> v.getAll ans = 0 0 0 0 >> v.setAll(10*rand(1,4)) >> v.getAll ans = 9 2 6 4 >> v.setOne(1,0) >> g.getOne(0) and = 9 >> v.getOne(0)Try moving the sliders. You'll see that matlab can read them!
You can also have a java process running within matlab call matlab, but that is a story for another day.