Mercurial Hosting > luan
comparison src/luan/modules/swing/Label.luan @ 1616:915cb538e2a3
start swing
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 05 Jun 2021 21:42:29 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1615:38894708bade | 1616:915cb538e2a3 |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local set_metatable = Luan.set_metatable or error() | |
4 require "java" | |
5 local JLabel = require "java:javax.swing.JLabel" | |
6 | |
7 | |
8 local Label = {} | |
9 | |
10 local mt = {} | |
11 | |
12 function mt.__index(label,key) | |
13 error("'"..key.."' not defined") | |
14 end | |
15 | |
16 function mt.__new_index(label,key,value) | |
17 error("'"..key.."' not defined") | |
18 end | |
19 | |
20 function Label.new(text) | |
21 local jlabel = JLabel.new(text) | |
22 local label = { java = jlabel } | |
23 set_metatable(label,mt) | |
24 return label | |
25 end | |
26 | |
27 return Label |