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/Listing2704.java | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Master/Reference Architectures and Patterns/hjp5/examples/Listing2704.java (limited to 'Master/Reference Architectures and Patterns/hjp5/examples/Listing2704.java') diff --git a/Master/Reference Architectures and Patterns/hjp5/examples/Listing2704.java b/Master/Reference Architectures and Patterns/hjp5/examples/Listing2704.java new file mode 100644 index 0000000..a8ee76a --- /dev/null +++ b/Master/Reference Architectures and Patterns/hjp5/examples/Listing2704.java @@ -0,0 +1,68 @@ +/* Listing2704.java */ + +import java.awt.*; +import java.awt.event.*; + +public class Listing2704 +extends Frame +{ + public static void main(String[] args) + { + Listing2704 wnd = new Listing2704(); + wnd.setSize(300,200); + wnd.setLocation(50,50); + wnd.setVisible(true); + } + + public Listing2704() + { + super(""); + assignTitle(); + assignIcon(); + assignCursor(); + assignColors(); + assignFont(); + addWindowListener(new WindowClosingAdapter(true)); + } + + private void assignTitle() + { + setTitle("Veränderte Fensterelemente"); + } + + private void assignIcon() + { + Image img = getToolkit().getImage("testicon.gif"); + MediaTracker mt = new MediaTracker(this); + + mt.addImage(img, 0); + try { + //Warten, bis das Image vollständig geladen ist, + mt.waitForAll(); + } catch (InterruptedException e) { + //nothing + } + setIconImage(img); + } + + private void assignCursor() + { + setCursor(new Cursor(Cursor.WAIT_CURSOR)); + } + + private void assignColors() + { + setForeground(Color.white); + setBackground(Color.black); + } + + private void assignFont() + { + setFont(new Font("Serif", Font.PLAIN, 28)); + } + + public void paint(Graphics g) + { + g.drawString("Test in Vordergrundfarbe",10,70); + } +} \ No newline at end of file -- cgit v1.2.3