source: git/Singular/LIB/surfex/OptionButtonPane.java @ 7661e1

fieker-DuValspielwiese
Last change on this file since 7661e1 was 3de2ca, checked in by Hans Schönemann <hannes@…>, 16 years ago
*hannes: surfex_0_90_00 git-svn-id: file:///usr/local/Singular/svn/trunk@11070 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.8 KB
Line 
1////////////////////////////////////////////////////////////////////////
2//
3// This file OptionButtonPane.java is part of SURFEX.
4//
5////////////////////////////////////////////////////////////////////////
6
7////////////////////////////////////////////////////////////////////////
8//
9// SURFEX version 0.90.00
10// =================
11//
12// Saarland University at Saarbruecken, Germany
13// Department of Mathematics and Computer Science
14//
15// SURFEX on the web: www.surfex.AlgebraicSurface.net
16//
17// Authors: Oliver Labs (2001-2008), Stephan Holzer (2004-2005)
18//
19// Copyright (C) 2001-2008
20//
21//
22// *NOTICE*
23// ========
24// 
25// This program is free software; you can redistribute it and/or modify it
26// under the terms of the GNU General Public License as published by the
27// Free Software Foundation ( version 3 or later of the License ).
28//
29// See LICENCE.TXT for details.
30//
31/////////////////////////////////////////////////////////////////////////
32
33import java.awt.BorderLayout;
34import java.awt.Container;
35import java.awt.GridLayout;
36import java.awt.event.ActionEvent;
37import java.awt.event.ActionListener;
38import java.io.PrintWriter;
39import java.util.Hashtable;
40
41import javax.swing.ButtonGroup;
42import javax.swing.JButton;
43import javax.swing.JFrame;
44import javax.swing.JLabel;
45import javax.swing.JPanel;
46import javax.swing.JRadioButton;
47import javax.swing.JSlider;
48import javax.swing.JTextField;
49
50//////////////////////////////////////////////////////////////
51//
52// class OptionButtonPane
53//
54//////////////////////////////////////////////////////////////
55
56public class OptionButtonPane extends JFrame {
57
58        ButtonGroup group = new ButtonGroup();
59
60        JRadioButton bt1;
61
62        JRadioButton bt2;
63
64        JTextField clipingRadiusTextField;
65
66        JSlider slider1;
67
68        public void saveYourself(PrintWriter pw) {
69                pw.println(bt1.isSelected());
70                pw.println(clipingRadiusTextField.getText());
71                pw.println(slider1.getValue());
72        }
73
74        public String saveYourself() {
75                String str = "";
76                str += bt1.isSelected() + "\n";
77                str += clipingRadiusTextField.getText() + "\n";
78                str += slider1.getValue() + "\n";
79                return (str);
80        }
81
82        OptionButtonPane(boolean preselectedAppearance,
83                        double presettedClipingRadius, int presettedSliderValue) {
84                super("More Options for the appearance");
85
86                setSize(400, 170);
87                Container cp = getContentPane();
88                cp.setLayout(new BorderLayout());
89
90                JPanel panel3 = new JPanel();
91                panel3.setLayout(new GridLayout(5, 3));
92                panel3.add(new JLabel("               Clip surface with"));
93
94                if (preselectedAppearance) {
95                        bt1 = new JRadioButton("Ball", true);
96                        bt2 = new JRadioButton("Box");
97                } else {
98                        bt1 = new JRadioButton("Ball");
99                        bt2 = new JRadioButton("Box", true);
100                }
101                bt1.setEnabled(false);
102                bt2.setEnabled(false);
103                group.add(bt1);
104                panel3.add(bt1);
105                panel3.add(new JLabel(""));
106                group.add(bt2);
107                panel3.add(bt2);
108                panel3.add(new JLabel("               cliping radius"));
109                clipingRadiusTextField = new JTextField((String) Double
110                                .toString(presettedClipingRadius));
111                clipingRadiusTextField.setEnabled(false);
112                panel3.add(clipingRadiusTextField);
113
114                panel3.add(new JLabel("               transparence"));
115                slider1 = new JSlider(0, 100);
116                slider1.setValue(presettedSliderValue);
117                slider1.setMinorTickSpacing(1);
118                slider1.setMajorTickSpacing(10);
119                slider1.setPaintTicks(true);
120                // Bei 50 und 100 einen Text setzen
121                Hashtable labelTable = new Hashtable();
122                labelTable.put(new Integer(50), new JLabel("50%"));
123                labelTable.put(new Integer(100), new JLabel("100%"));
124                slider1.setLabelTable(labelTable);
125                panel3.add(slider1);
126
127                JButton OKButton = new JButton("OK");
128                OKButton.addActionListener(new ActionListener() {
129                        public void actionPerformed(ActionEvent evt) {
130                                setVisible(false);
131                        }
132                });
133
134                cp.add(panel3, BorderLayout.CENTER);
135                cp.add(OKButton, BorderLayout.SOUTH);
136                setLocation(70, 200);
137                setVisible(false);
138                repaint();
139        }
140} // end class OptionButtonPane
141
Note: See TracBrowser for help on using the repository browser.