Initial sources for planned 2.0 luaj vm release. Most interpreter features and library functions working.
This commit is contained in:
1
examples/lua/hello.lua
Normal file
1
examples/lua/hello.lua
Normal file
@@ -0,0 +1 @@
|
||||
print( 'hello, world' )
|
||||
29
examples/lua/swingapp.lua
Normal file
29
examples/lua/swingapp.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
frame = luajava.newInstance( "javax.swing.JFrame", "Texts" );
|
||||
pane = luajava.newInstance( "javax.swing.JPanel" );
|
||||
borderFactory = luajava.bindClass( "javax.swing.BorderFactory" )
|
||||
border = borderFactory:createEmptyBorder( 30, 30, 10, 30 )
|
||||
pane:setBorder( border )
|
||||
label = luajava.newInstance( "javax.swing.JLabel", "This is a Label" );
|
||||
|
||||
|
||||
layout = luajava.newInstance( "java.awt.GridLayout", 2, 2 );
|
||||
pane:setLayout( layout )
|
||||
pane:add( label )
|
||||
pane:setBounds( 20, 30, 10, 30 )
|
||||
|
||||
borderLayout = luajava.bindClass( "java.awt.BorderLayout" )
|
||||
frame:getContentPane():add(pane, borderLayout.CENTER )
|
||||
jframe = luajava.bindClass( "javax.swing.JFrame" )
|
||||
frame:setDefaultCloseOperation(jframe.EXIT_ON_CLOSE)
|
||||
frame:pack()
|
||||
frame:setVisible(true)
|
||||
|
||||
local listener = luajava.createProxy("java.awt.event.MouseListener",
|
||||
{
|
||||
mouseClicked = function(me)
|
||||
print("clicked!", me)
|
||||
end
|
||||
})
|
||||
|
||||
frame:addMouseListener(listener)
|
||||
Reference in New Issue
Block a user