Adjusting testing cases for current state of OCCT
[occt.git] / samples / java / java / TransparencyDlg.java
1
2 //Title:        ImportExport sample
3 //Version:      
4 //Copyright:    Copyright (c) 1999
5 //Author:       
6 //Company:      Matra Datavision
7 //Description:  Your description
8
9 import java.awt.*;
10 import java.util.*;
11 import java.math.*;
12 import javax.swing.*;
13 import util.*;
14
15
16 public class TransparencyDlg extends StandardDlg
17 {
18     private RealSpin spnValue = new RealSpin("0.0", "0.1");
19     private double myValue = 0.0;
20     private boolean isOK = false;
21
22   //**********************************************************************
23     public TransparencyDlg(Frame parent, double value)
24     {
25       super(parent, "Transparency", true, true, false, true);
26       myValue = value;
27
28       InitDlg();
29
30       BigDecimal BD = new BigDecimal(myValue);
31       BD = BD.setScale(2, BigDecimal.ROUND_HALF_UP);
32       spnValue.setValue(BD.toString());
33
34       pack();
35     }
36
37 //**********************************************************************
38     private void InitDlg()
39     {
40       JPanel aPane = new JPanel(new GridLayout(2, 1, 0, 4));
41
42       aPane.add(new JLabel("Choose a value between 0 and 1"));
43
44       spnValue.setMinValue("0.0");
45       spnValue.setMaxValue("1.0");
46       spnValue.setColumns(5);
47       spnValue.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15));
48       aPane.add(spnValue);
49
50       aPane.setBorder(BorderFactory.createEmptyBorder(5, 7, 5, 7));
51       ControlsPanel.setLayout(new BorderLayout());
52       ControlsPanel.add(aPane, BorderLayout.CENTER);
53       pack();
54       setResizable(false);
55     }
56
57 //**********************************************************************
58     public void OkAction()
59     {
60       myValue = spnValue.getValue();
61       isOK = true;
62       dispose();
63     }
64
65 //**********************************************************************
66     public void CancelAction()
67     {
68       isOK = false;
69       dispose();
70     }
71
72
73 //**********************************************************************
74     public double getValue()
75     {
76       return myValue;
77     }
78
79 //**********************************************************************
80     public boolean isOK()
81     {
82       return isOK;
83     }
84
85
86 }