aboutsummaryrefslogtreecommitdiff
path: root/JBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java
blob: bd6f0da0d5536c2591702c391f2c03a704ed3011 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>

This file is part of JBriscola.

    JBriscola is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    JBriscola is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with JBriscola; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/

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

public class OptionFrame extends JFrame {
	public static Main main = new Main();
	public static Formatter formatter;
	public static JButton ok, annulla;
	public static JLabel lingua;
	public static JComboBox selezionaLingua;
	public static JPanel pannello1, pannello2;
	public OptionFrame() {
		super( "JBriscola - " + main.stringaModificaOpzioni );
		ok = new JButton( "OK" );
		ok.addActionListener( new ActionListener() {
			public void actionPerformed( ActionEvent e ) {
				try {
					formatter = new Formatter( "JBriscolaConfig.txt" );
				} catch ( Exception ex ) {
					JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex );
				}
				String lang;
				switch ( selezionaLingua.getSelectedIndex() ) {
					case 0:
						lang = "it";
						break;
					case 1:
						lang = "la";
						break;
					case 2:
						lang = "bl";
						break;
					case 3:
						lang = "bv";
						break;
					default:
						lang = "it";
						break;
				}
				formatter.format( lang );
				formatter.close();
				main.settaOpzioni();
				OptionFrame.this.dispose();
				JOptionPane.showMessageDialog( OptionFrame.this, main.stringaNecessarioRiavviare, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
			}
		});
		annulla = new JButton( main.stringaAnnulla );
		annulla.addActionListener( new ActionListener() {
			public void actionPerformed( ActionEvent e ) {
				OptionFrame.this.dispose();
			}
		});
		lingua = new JLabel( main.stringaLingua );
		String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa, main.stringaBL, main.stringaBV };
		selezionaLingua = new JComboBox( lingueDaSelezionare );
		pannello1 = new JPanel( new FlowLayout() );
		pannello1.add( lingua );
		pannello1.add( selezionaLingua );
		pannello2 = new JPanel( new FlowLayout() );
		pannello2.add( ok );
		pannello2.add( annulla );
		add( pannello1, BorderLayout.CENTER );
		add( pannello2, BorderLayout.SOUTH );
	}
}

Generated with cgit - Back to sebastiano.tronto.net