create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / gui / components / compass / Tester.java
1 package net.sf.openrocket.gui.components.compass;
2
3 import java.awt.Dimension;
4 import java.lang.reflect.InvocationTargetException;
5
6 import javax.swing.JFrame;
7 import javax.swing.JPanel;
8 import javax.swing.JSpinner;
9 import javax.swing.SwingUtilities;
10
11 import net.miginfocom.swing.MigLayout;
12 import net.sf.openrocket.gui.adaptors.DoubleModel;
13 import net.sf.openrocket.gui.util.GUIUtil;
14 import net.sf.openrocket.l10n.ResourceBundleTranslator;
15 import net.sf.openrocket.startup.Application;
16 import net.sf.openrocket.unit.UnitGroup;
17
18 public class Tester {
19         
20
21         public static void main(String[] args) throws InterruptedException, InvocationTargetException {
22                 
23                 Application.setBaseTranslator(new ResourceBundleTranslator("l10n.messages"));
24                 
25                 GUIUtil.setBestLAF();
26                 
27                 SwingUtilities.invokeAndWait(new Runnable() {
28                         @Override
29                         public void run() {
30                                 JFrame frame = new JFrame();
31                                 
32                                 JPanel panel = new JPanel(new MigLayout("fill"));
33                                 DoubleModel model = new DoubleModel(Math.toRadians(45), UnitGroup.UNITS_ANGLE);
34                                 DoubleModel second = new DoubleModel(Math.toRadians(30), UnitGroup.UNITS_ANGLE);
35                                 
36
37                                 CompassPointer rose = new CompassSelector(model);
38                                 rose.setPreferredSize(new Dimension(300, 300));
39                                 rose.setSecondaryModel(second);
40                                 panel.add(rose);
41                                 
42                                 rose = new CompassPointer(model);
43                                 rose.setPreferredSize(new Dimension(24, 24));
44                                 panel.add(rose);
45                                 rose.setMarkerFont(null);
46                                 rose.setPointerArrow(false);
47                                 rose.setPointerWidth(0.45f);
48                                 rose.setScaler(1.0f);
49                                 
50                                 JSpinner spin = new JSpinner(model.getSpinnerModel());
51                                 spin.setPreferredSize(new Dimension(50, 20));
52                                 panel.add(spin, "wrap para");
53                                 
54
55                                 CompassSelectionButton button = new CompassSelectionButton(model);
56                                 panel.add(button);
57                                 
58
59                                 frame.add(panel);
60                                 frame.pack();
61                                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
62                                 frame.setVisible(true);
63                         }
64                 });
65         }
66 }