01: /**
02: * $RCSfile: XuiLanguagePanel.java,v $
03: * @creation 01/02/00
04: * @modification $Date: 2002/06/20 17:35:45 $
05: */
06:
07: /**
08: * This is a panel where a language can be choosen from.
09: * @see com.memoire.vainstall.VALanguageStep
10: */package com.memoire.vainstall.xui;
11:
12: import java.awt.*;
13: import javax.swing.*;
14: import javax.swing.border.*;
15: import com.memoire.vainstall.VAGlobals;
16: import com.memoire.vainstall.VALanguageStep;
17:
18: /**
19: * Based on mode 'Graphic' by Axel von Arnim.
20: * @version $Id: XuiLanguagePanel.java,v 1.8 2002/06/20 17:35:45 desnoix Exp $
21: * @author Guillaume Desnoix
22: */
23:
24: public class XuiLanguagePanel extends XuiAbstractPanel implements
25: VALanguageStep {
26:
27: /**
28: * The listbox from where we can select languages.
29: */
30: JList languageJList;
31:
32: /**
33: * Default constructor
34: */
35: public XuiLanguagePanel() {
36: super ();
37:
38: setLayout(new BorderLayout());
39:
40: JPanel pnMain = new XuiPanel();
41: pnMain.setLayout(new BorderLayout());
42: pnMain.setBorder(new EmptyBorder(5, 5, 5, 5));
43: pnMain.setForeground(new Color(128, 255, 255));
44:
45: XuiTitle lbTitle = new XuiTitle(VAGlobals.i18n("UI_Language"),
46: XuiTitle.LEFT);
47: lbTitle.setFont(new Font("SansSerif", Font.PLAIN, 16));
48:
49: languageJList = new XuiList(VAGlobals.getSupportedLanguages());
50: languageJList
51: .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
52: languageJList.setSelectedIndex(3);
53: JScrollPane spLanguage = new JScrollPane(languageJList);
54: spLanguage.setBorder(new LineBorder(Color.black, 2));
55:
56: pnMain.add(BorderLayout.NORTH, lbTitle);
57: // pnMain.add(BorderLayout.CENTER, lbProg);
58: pnMain.add(BorderLayout.CENTER, spLanguage);
59: // pnMain.add(BorderLayout.SOUTH , new XuiLabel(
60: // VAGlobals.getString("Click \"Next\" to start...")));
61:
62: JPanel pnImage = XuiImagePanel.IMAGE_PANEL;
63: add(pnImage, BorderLayout.WEST);
64: add(pnMain, BorderLayout.CENTER);
65: }
66:
67: /**
68: * Returns the selected language in the same format as written
69: * in the *.vai file.
70: * @return String
71: */
72: public String getLanguage() {
73: // set default language
74: String language = "english";
75:
76: if (languageJList.getSelectedIndex() != -1) {
77: for (int i = 0; i < VAGlobals.languages.length; i++) {
78: if (VAGlobals.languages[i][1].equals(languageJList
79: .getSelectedValue()) == true) {
80: language = VAGlobals.languages[i][0];
81: }
82: }
83: }
84:
85: return language;
86: }
87:
88: }
|