summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Listing3704.java
blob: 97c44b1c568a6fd3b7630a95c49abed7d53c7f23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Listing3704.java */

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class Listing3704
extends JFrame
{
  private static final String[] WDAYS = {
    "Montag",  "Dienstag", "Mittwoch", "Donnerstag",
    "Freitag", "Samstag",  "Sonntag"
  };

  public Listing3704()
  {
    super("JSpinner");
    addWindowListener(new WindowClosingAdapter(true));
    Container cp = getContentPane();
    cp.setLayout(new FlowLayout());
    //Default-Spinner f�r Ganzzahlen
    JSpinner spinner = new JSpinner();
    cp.add(spinner);
    //Spinner f�r einige Vielfache von 7
    spinner = new JSpinner(new SpinnerNumberModel(91, 49, 126, 7));
    cp.add(spinner);
    //Spinner f�r Datum/Uhrzeit
    spinner = new JSpinner(new SpinnerDateModel());
    cp.add(spinner);
    //Spinner f�r Wochentage
    spinner = new JSpinner(new SpinnerListModel(WDAYS));
    cp.add(spinner);
  }

  public static void main(String[] args)
  {
    Listing3704 frame = new Listing3704();
    frame.setLocation(100, 100);
    frame.setSize(300, 150);
    frame.setVisible(true);
  }
}