From 7167b4341ef290d56fb96e2af10883a4b925d83b Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 26 Mar 2026 19:27:18 +0100 Subject: I found my old code! --- .../all_versions/0.1/0.1.1/src/OptionFrame.java | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 JBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java (limited to 'JBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java') diff --git a/JBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java b/JBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java new file mode 100755 index 0000000..bd6f0da --- /dev/null +++ b/JBriscola/all_versions/0.1/0.1.1/src/OptionFrame.java @@ -0,0 +1,87 @@ +/* +Copyright 2009 Sebastiano Tronto + +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 ); + } +} -- cgit v1.3