From 8c1790a725fbe16d77a88fc76ea19928625ff923 Mon Sep 17 00:00:00 2001 From: astrapi69 Date: Sat, 22 Jul 2023 16:08:56 +0200 Subject: [PATCH] created a new factory method for the JLabel in the LabelPanel --- .../astrapi69/swing/panel/label/LabelPanel.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/astrapi69/swing/panel/label/LabelPanel.java b/src/main/java/io/github/astrapi69/swing/panel/label/LabelPanel.java index 9559ae8..0935a6c 100644 --- a/src/main/java/io/github/astrapi69/swing/panel/label/LabelPanel.java +++ b/src/main/java/io/github/astrapi69/swing/panel/label/LabelPanel.java @@ -53,11 +53,22 @@ public LabelPanel(final IModel model) @Override protected void onInitializeComponents() { - lblText = new JLabel(); + lblText = newJLabel(); lblText.setText(getModelObject()); add(lblText); } + /** + * Factory method that creates a new {@link JLabel} object. You can overwrite this method and + * return your new custom {@link JLabel} object + * + * @return the {@link JLabel} object + */ + protected JLabel newJLabel() + { + return new JLabel(); + } + @Override protected void onInitializeLayout() {