From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../hjp5/examples/Listing3701.java | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Master/Reference Architectures and Patterns/hjp5/examples/Listing3701.java (limited to 'Master/Reference Architectures and Patterns/hjp5/examples/Listing3701.java') diff --git a/Master/Reference Architectures and Patterns/hjp5/examples/Listing3701.java b/Master/Reference Architectures and Patterns/hjp5/examples/Listing3701.java new file mode 100644 index 0000000..58c57d9 --- /dev/null +++ b/Master/Reference Architectures and Patterns/hjp5/examples/Listing3701.java @@ -0,0 +1,51 @@ +/* Listing3701.java */ + +import java.awt.*; +import javax.swing.*; + +public class Listing3701 +extends JFrame +{ + public Listing3701() + { + super("JLabel"); + addWindowListener(new WindowClosingAdapter(true)); + Container cp = getContentPane(); + cp.setLayout(new GridLayout(5, 1)); + JLabel label; + //Standardlabel + label = new JLabel("Standard-Label"); + cp.add(label); + //Label mit Icon + label = new JLabel( + "Label mit Icon", + new ImageIcon("lock.gif"), + JLabel.CENTER + ); + cp.add(label); + //Nur-Icon + label = new JLabel(new ImageIcon("lock.gif")); + cp.add(label); + //Icon auf der rechten Seite + label = new JLabel( + "Label mit Icon rechts", + new ImageIcon("lock.gif"), + JLabel.CENTER + ); + label.setHorizontalTextPosition(JLabel.LEFT); + cp.add(label); + //Label rechts unten + label = new JLabel("Label rechts unten"); + label.setHorizontalAlignment(JLabel.RIGHT); + label.setVerticalAlignment(JLabel.BOTTOM); + cp.add(label); + } + + public static void main(String[] args) + { + Listing3701 frame = new Listing3701(); + frame.setLocation(100, 100); + frame.setSize(300, 200); + frame.setVisible(true); + } +} \ No newline at end of file -- cgit v1.2.3