7fd59977 |
1 | |
2 | //Title: AISDisplayMode sample |
3 | //Version: |
4 | //Copyright: Copyright (c) 1999 |
5 | //Author: |
6 | //Company: Matra Datavision |
7 | //Description: |
8 | |
9 | import java.awt.*; |
10 | import java.awt.event.*; |
11 | import java.util.*; |
12 | import java.math.*; |
13 | import javax.swing.*; |
14 | import javax.swing.event.*; |
15 | import util.*; |
16 | |
17 | |
18 | public class DeviationDlg extends StandardDlg |
19 | { |
20 | //-----------------------------------------------------------// |
21 | // GUI components |
22 | //-----------------------------------------------------------// |
23 | JSlider sldDeviation; |
24 | |
25 | private int myValue = 1; |
26 | private boolean isOK = false; |
27 | |
28 | //=======================================================================// |
29 | // Construction |
30 | //=======================================================================// |
31 | public DeviationDlg(Frame parent, int value) |
32 | { |
33 | super(parent, "Deviation Coefficient", true, true, false, true); |
34 | myValue = value; |
35 | |
36 | InitDlg(); |
37 | |
38 | sldDeviation.setValue(myValue); |
39 | |
40 | pack(); |
41 | } |
42 | |
43 | //********************************************************************** |
44 | private void InitDlg() |
45 | { |
46 | JPanel aPane = new JPanel(new GridBagLayout()); |
47 | |
48 | sldDeviation = new JSlider(0, 100, 26); |
49 | aPane.add(sldDeviation, new GridBagConstraints(0, 0, 3, 1, 0.0, 1.0, |
50 | GridBagConstraints.CENTER, GridBagConstraints.NONE, |
51 | new Insets(5, 0, 5, 0), 0, 0)); |
52 | |
53 | aPane.add(new JLabel("Fine"), new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, |
54 | GridBagConstraints.WEST, GridBagConstraints.NONE, |
55 | new Insets(5, 5, 5, 5), 0, 0)); |
56 | |
57 | aPane.add(new JLabel("Default"), new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, |
58 | GridBagConstraints.CENTER, GridBagConstraints.NONE, |
59 | new Insets(5, 5, 5, 5), 0, 0)); |
60 | |
61 | aPane.add(new JLabel("Unpolished"), new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, |
62 | GridBagConstraints.EAST, GridBagConstraints.NONE, |
63 | new Insets(5, 5, 5, 5), 0, 0)); |
64 | |
65 | aPane.setBorder(BorderFactory.createEmptyBorder(5, 7, 5, 7)); |
66 | ControlsPanel.setLayout(new BorderLayout()); |
67 | ControlsPanel.add(aPane, BorderLayout.CENTER); |
68 | pack(); |
69 | setResizable(false); |
70 | } |
71 | |
72 | //********************************************************************** |
73 | public void OkAction() |
74 | { |
75 | myValue = sldDeviation.getValue(); |
76 | |
77 | isOK = true; |
78 | dispose(); |
79 | } |
80 | |
81 | //********************************************************************** |
82 | public void CancelAction() |
83 | { |
84 | isOK = false; |
85 | dispose(); |
86 | } |
87 | |
88 | |
89 | //********************************************************************** |
90 | public int getValue() |
91 | { |
92 | return myValue; |
93 | } |
94 | |
95 | //********************************************************************** |
96 | public boolean isOK() |
97 | { |
98 | return isOK; |
99 | } |
100 | |
101 | } |