Mercurial Hosting > luan
changeset 1905:f7649b3ebd22 default tip
use JTextField for Label
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 15 Apr 2025 16:53:03 -0600 |
parents | ad1dc9f103b7 |
children | |
files | src/luan/modules/editor/window.luan src/luan/modules/swing/Label.luan src/luan/modules/swing/Text_field.luan |
diffstat | 3 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/modules/editor/window.luan Tue Apr 15 16:13:14 2025 -0600 +++ b/src/luan/modules/editor/window.luan Tue Apr 15 16:53:03 2025 -0600 @@ -49,7 +49,7 @@ end text_area.set_selection(0) local status_bar = new_label{ - --constraints = "span" + constraints = "span,growx" text = " " border = create_empty_border(2,16,4,16) }
--- a/src/luan/modules/swing/Label.luan Tue Apr 15 16:13:14 2025 -0600 +++ b/src/luan/modules/swing/Label.luan Tue Apr 15 16:53:03 2025 -0600 @@ -11,7 +11,11 @@ local super__new_index = Component.__new_index or error() local super_construct = Component.construct or error() require "java" -local JLabel = require "java:javax.swing.JLabel" +--local JLabel = require "java:javax.swing.JLabel" sucks because can't copy +local JTextField = require "java:javax.swing.JTextField" +local UIManager = require "java:javax.swing.UIManager" +local Logging = require "luan:logging/Logging.luan" +local logger = Logging.logger "swing/Label" local Label = {} @@ -38,7 +42,11 @@ local mt = make_metatable(Label) function Label.new(props) - local jlabel = JLabel.new() + local jlabel = JTextField.new() + jlabel.setEditable(false) + jlabel.setBorder(nil) + jlabel.setOpaque(false) + jlabel.setFont(UIManager.getFont("Label.font")) local label = { java = jlabel } super_construct(label,props) local text = delete(props,"text")
--- a/src/luan/modules/swing/Text_field.luan Tue Apr 15 16:13:14 2025 -0600 +++ b/src/luan/modules/swing/Text_field.luan Tue Apr 15 16:53:03 2025 -0600 @@ -11,6 +11,8 @@ local TextFieldLuan = require "java:luan.modules.swing.TextFieldLuan" local SwingLuan = require "java:luan.modules.swing.SwingLuan" local newActionListener = SwingLuan.newActionListener +local Logging = require "luan:logging/Logging.luan" +local logger = Logging.logger "swing/Text_field" local Text_field = {}