001: /*
002: JSmooth: a VM wrapper toolkit for Windows
003: Copyright (C) 2003-2007 Rodrigo Reyes <reyes@charabia.net>
004:
005: This program is free software; you can redistribute it and/or modify
006: it under the terms of the GNU General Public License as published by
007: the Free Software Foundation; either version 2 of the License, or
008: (at your option) any later version.
009:
010: This program is distributed in the hope that it will be useful,
011: but WITHOUT ANY WARRANTY; without even the implied warranty of
012: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013: GNU General Public License for more details.
014:
015: You should have received a copy of the GNU General Public License
016: along with this program; if not, write to the Free Software
017: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
018:
019: */
020:
021: package net.charabia.jsmoothgen.application.gui.skeleditors;
022:
023: import javax.swing.*;
024: import javax.swing.event.*;
025: import javax.swing.text.*;
026: import java.util.*;
027: import java.awt.event.*;
028:
029: public class AutoDownloadURLEditor extends SkelPropEditor {
030: protected String[] m_autourls = new String[] {
031: "JRE 1.6.0",
032: "http://java.sun.com/update/1.6.0/jinstall-6-windows-i586.cab",
033: "JRE 1.5.0_11",
034: "http://java.sun.com/update/1.5.0/jinstall-1_5_0_11-windows-i586.cab",
035: "JRE 1.5.0_10",
036: "http://java.sun.com/update/1.5.0/jinstall-1_5_0_10-windows-i586.cab",
037: "JRE 1.5.0_07",
038: "http://java.sun.com/update/1.5.0/jinstall-1_5_0_07-windows-i586.cab",
039: "JRE 1.5.0_06",
040: "http://java.sun.com/update/1.5.0/jinstall-1_5_0_06-windows-i586.cab",
041: "JRE 1.5.0_03",
042: "http://java.sun.com/update/1.5.0/jinstall-1_5_0_03-windows-i586.cab",
043: "JRE 1.5.0_02",
044: "http://java.sun.com/update/1.5.0/jinstall-1_5_0_02-windows-i586.cab",
045: "JRE 1.5.0_01",
046: "http://java.sun.com/update/1.5.0/jinstall-1_5_0_01-windows-i586.cab",
047: "JRE 1.5.0",
048: "http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab",
049: "JRE 1.4.2_03",
050: "http://java.sun.com/update/1.4.2/jinstall-1_4_2_03-windows-i586.cab",
051: "JRE 1.4.2_02",
052: "http://java.sun.com/update/1.4.2/jinstall-1_4_2_02-windows-i586.cab",
053: "JRE 1.4.2_01",
054: "http://java.sun.com/update/1.4.2/jinstall-1_4_2_01-windows-i586.cab",
055: "JRE 1.4.2",
056: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab",
057: "JRE 1.4.1_03",
058: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1_03-windows-i586.cab",
059: "JRE 1.4.1_02",
060: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1_02-windows-i586.cab",
061: "JRE 1.4.1_01",
062: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1_01-windows-i586.cab",
063: "JRE 1.4.1",
064: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1-windows-i586.cab",
065: "JRE 1.4.0_04",
066: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0_04-win.cab",
067: "JRE 1.4.0_03",
068: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0_03-win.cab",
069: "JRE 1.4.0_02",
070: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0_02-win.cab",
071: "JRE 1.4.0_01",
072: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0_01-win.cab",
073: "JRE 1.4.0",
074: "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0-win.cab",
075: "JRE 1.3.1_08",
076: "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_08-windows-i586.cab",
077: "JRE 1.3.1_07",
078: "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_07-windows-i586.cab",
079: "JRE 1.3.1_06",
080: "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_06-windows-i586.cab",
081: "JRE 1.3.1_05",
082: "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_05-windows-i586.cab",
083: "JRE 1.3.1_04",
084: "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_04-win.cab",
085: "JRE 1.3.1_03",
086: "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab",
087: "JRE 1.3.1_02",
088: "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_02-win.cab",
089: "JRE 1.3.1_01",
090: "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_01-win.cab",
091: "JRE 1.3.0_05",
092: "http://java.sun.com/products/plugin/autodl/jinstall-1_3_0_05-win.cab" };
093:
094: protected JComboBox m_comp;
095:
096: public AutoDownloadURLEditor() {
097: String[] s = new String[m_autourls.length / 2];
098: for (int i = 0; i < s.length; i++)
099: s[i] = m_autourls[i * 2];
100: m_comp = new JComboBox(s);
101: }
102:
103: public java.awt.Component getGUI() {
104: return m_comp;
105: }
106:
107: public String findURL(String name) {
108: for (int i = 0; i < m_autourls.length / 2; i++) {
109: if (m_autourls[i * 2].equals(name))
110: return m_autourls[i * 2 + 1];
111: }
112: return name;
113: }
114:
115: public void valueChanged(String val) {
116: m_comp.setSelectedItem(findURL(val));
117: }
118:
119: public boolean labelAtLeft() {
120: return true;
121: }
122:
123: public void set(String o) {
124: m_comp.setSelectedItem(findURL(o.toString()));
125: }
126:
127: public String get() {
128: return m_autourls[m_comp.getSelectedIndex() * 2 + 1];
129: }
130:
131: }
|