aboutsummaryrefslogtreecommitdiff
path: root/JBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-03-26 19:27:18 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2026-03-26 19:27:18 +0100
commit7167b4341ef290d56fb96e2af10883a4b925d83b (patch)
tree1eb1b9e5ab82ddd89540e68d6b22ae69514575c6 /JBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java
downloadancient-projects-master.tar.gz
ancient-projects-master.zip
I found my old code!HEADmaster
Diffstat (limited to 'JBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java')
-rwxr-xr-xJBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java140
1 files changed, 140 insertions, 0 deletions
diff --git a/JBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java b/JBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java
new file mode 100755
index 0000000..f41606e
--- /dev/null
+++ b/JBriscola/all_versions/0.2/0.2.1/src/OptionFrame.java
@@ -0,0 +1,140 @@
1/*
2Copyright 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of JBriscola.
5
6 JBriscola is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 JBriscola is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with JBriscola; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import java.util.Formatter;
23import javax.swing.*;
24import java.awt.*;
25import java.awt.event.*;
26
27public class OptionFrame extends JFrame {
28 public static Main main = new Main();
29 public static Formatter formatter;
30 public static JButton ok, annulla, scegliColore;
31 public static JLabel lingua, sfondo;
32 public static JComboBox selezionaLingua;
33 public static JCheckBox suono, tastiRapidi;
34 public static JPanel[] pannello = new JPanel[6];
35 public OptionFrame() {
36 super( "JBriscola - " + main.stringaModificaOpzioni );
37 ok = new JButton( "OK" );
38 ok.addActionListener( new ActionListener() {
39 public void actionPerformed( ActionEvent e ) {
40 try {
41 formatter = new Formatter( "JBriscolaConfig.txt" );
42 } catch ( Exception ex ) {
43 JOptionPane.showMessageDialog( OptionFrame.this, main.stringaImpossibileConfigurare + ex, "JBriscola - " + main.version, JOptionPane.ERROR_MESSAGE );
44 }
45 String lang;
46 switch ( selezionaLingua.getSelectedIndex() ) {
47 case 0:
48 lang = "it";
49 break;
50 case 1:
51 lang = "la";
52 break;
53 case 2:
54 lang = "bl";
55 break;
56 case 3:
57 lang = "bv";
58 break;
59 default:
60 lang = "it";
61 break;
62 }
63 String suonosiono, tastisiono;
64 if ( suono.isSelected() )
65 suonosiono = "suono=si";
66 else
67 suonosiono = "suono=no";
68 if ( tastiRapidi.isSelected() )
69 tastisiono = "tasti=si";
70 else
71 tastisiono = "tasti=no";
72 formatter.format( lang );
73 formatter.format( "\n" );
74 formatter.format( suonosiono );
75 formatter.format( "\n" );
76 formatter.format( tastisiono );
77 formatter.format( "\n" );
78 formatter.format( main.color.getRed() + " " + main.color.getGreen() + " " + main.color.getBlue() );
79 formatter.close();
80 main.settaOpzioni();
81 OptionFrame.this.dispose();
82 //JOptionPane.showMessageDialog( OptionFrame.this, main.stringaNecessarioRiavviare, "JBriscola 0.1", JOptionPane.INFORMATION_MESSAGE );
83 }
84 });
85 annulla = new JButton( main.stringaAnnulla );
86 annulla.addActionListener( new ActionListener() {
87 public void actionPerformed( ActionEvent e ) {
88 OptionFrame.this.dispose();
89 }
90 });
91 scegliColore = new JButton( " " );
92 scegliColore.setBackground( main.color );
93 scegliColore.addActionListener( new ActionListener() {
94 public void actionPerformed( ActionEvent e ) {
95 Color colore = JColorChooser.showDialog( OptionFrame.this, "JBriscola " + main.version, main.color );
96 if ( colore != null )
97 main.color = colore;
98 OptionFrame.scegliColore.setBackground( main.color );
99 }
100 } );
101 lingua = new JLabel( main.stringaLingua );
102 sfondo = new JLabel( main.stringaSfondo );
103 String[] lingueDaSelezionare = { main.stringaIt, main.stringaLa, main.stringaBL, main.stringaBV };
104 selezionaLingua = new JComboBox( lingueDaSelezionare );
105 int linguaPreselezionata = 0;
106 if ( main.lang.equals( "it" ) )
107 linguaPreselezionata = 0;
108 else if ( main.lang.equals( "la" ) )
109 linguaPreselezionata = 1;
110 else if ( main.lang.equals( "bl" ) )
111 linguaPreselezionata = 2;
112 else if ( main.lang.equals( "bv" ) )
113 linguaPreselezionata = 3;
114 selezionaLingua.setSelectedIndex( linguaPreselezionata );
115 suono = new JCheckBox( main.stringaSuono );
116 suono.setSelected( main.sound );
117 tastiRapidi = new JCheckBox( main.stringaTasti );
118 tastiRapidi.setSelected( main.keys );
119 pannello[0] = new JPanel( new GridLayout( 4, 1 ) );
120 pannello[1] = new JPanel( new FlowLayout() );
121 pannello[2] = new JPanel( new FlowLayout() );
122 pannello[3] = new JPanel( new FlowLayout() );
123 pannello[4] = new JPanel( new FlowLayout() );
124 pannello[5] = new JPanel( new FlowLayout() );
125 pannello[5].add( ok );
126 pannello[5].add( annulla );
127 pannello[4].add( sfondo );
128 pannello[4].add( scegliColore );
129 pannello[3].add( tastiRapidi );
130 pannello[2].add( suono );
131 pannello[1].add( lingua );
132 pannello[1].add( selezionaLingua );
133 pannello[0].add( pannello[1] );
134 pannello[0].add( pannello[2] );
135 pannello[0].add( pannello[3] );
136 pannello[0].add( pannello[4] );
137 add( pannello[0], BorderLayout.CENTER );
138 add( pannello[5], BorderLayout.SOUTH );
139 }
140}

Generated with cgit - Back to sebastiano.tronto.net