01: /*
02: * Lucane - a collaborative platform
03: * Copyright (C) 2004 Vincent Fiack <vfiack@mail15.com>
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */
19: package org.lucane.applications.audioconf.gui;
20:
21: import javax.swing.*;
22: import java.awt.*;
23: import java.awt.event.*;
24:
25: import org.lucane.applications.audioconf.AcceptationThread;
26: import org.lucane.applications.audioconf.AudioConf;
27: import org.lucane.client.Client;
28:
29: public class ConfigDialog extends JDialog implements ActionListener {
30: private AudioConf plugin;
31:
32: private AudioConfigPanel config;
33: private JButton btnOk;
34: private JButton btnCancel;
35:
36: public ConfigDialog(AudioConf plugin) {
37: this .setTitle(plugin.getTitle());
38:
39: this .plugin = plugin;
40: this .config = new AudioConfigPanel(plugin);
41:
42: this .getContentPane().setLayout(new BorderLayout());
43: this .getContentPane().add(this .config, BorderLayout.CENTER);
44: this .initButtons();
45: this .pack();
46: }
47:
48: private void initButtons() {
49: this .btnOk = new JButton(tr("btn.ok"), Client
50: .getImageIcon("ok.png"));
51: this .btnCancel = new JButton(tr("btn.cancel"), Client
52: .getImageIcon("cancel.png"));
53:
54: btnOk.addActionListener(this );
55: btnCancel.addActionListener(this );
56:
57: JPanel buttons = new JPanel(new GridLayout(1, 2));
58: buttons.add(btnOk);
59: buttons.add(btnCancel);
60:
61: JPanel container = new JPanel(new BorderLayout());
62: container.add(buttons, BorderLayout.EAST);
63:
64: this .getContentPane().add(container, BorderLayout.SOUTH);
65: }
66:
67: public void actionPerformed(ActionEvent e) {
68: if (e.getSource().equals(btnOk))
69: new AcceptationThread(plugin, this .config.getAudioConfig())
70: .start();
71: else if (e.getSource().equals(btnCancel))
72: plugin.exit();
73:
74: this .dispose();
75: }
76:
77: private String tr(String s) {
78: return plugin.tr(s);
79: }
80: }
|