annotate src/luan/modules/swing/Abstract_button.luan @ 1863:928e73bfe7ea

swing work
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 31 Mar 2025 13:46:47 -0600
parents
children 03209933fe4a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1863
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local Utils = require "luan:swing/Utils.luan"
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local fail = Utils.fail or error()
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 require "java"
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 local Abstract_button = {}
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 function Abstract_button.__index(abstract_button,key)
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 if key == "text" then
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 return abstract_button.java.getText()
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 end
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 return fail
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 end
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 function Abstract_button.__new_index(abstract_button,key,value)
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 if key == "text" then
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 abstract_button.java.setText(value)
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 return
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 end
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 return fail
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 end
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24
928e73bfe7ea swing work
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 return Abstract_button