diff options
author | Jiří Bubník <bubnik@datalite.cz> | 2014-05-23 15:07:39 +0200 |
---|---|---|
committer | Jiří Bubník <bubnik@datalite.cz> | 2014-05-23 15:07:39 +0200 |
commit | 417e8b94226e7ad8ee3c5ca05c437ffc9433a507 (patch) | |
tree | 79c8eab45cda571948fe229604beb238610c31dd /installer/src | |
parent | f489c524bf1184f011473e3693d4d300369c6f20 (diff) | |
download | dcevm-417e8b94226e7ad8ee3c5ca05c437ffc9433a507.tar.gz dcevm-417e8b94226e7ad8ee3c5ca05c437ffc9433a507.zip |
#22 - Installer now support both - replace current JVM or install as altjvm into dcevm directory.
Diffstat (limited to 'installer/src')
7 files changed, 211 insertions, 71 deletions
diff --git a/installer/src/main/java/com/github/dcevm/installer/ConfigurationInfo.java b/installer/src/main/java/com/github/dcevm/installer/ConfigurationInfo.java index cb28045f..fd5b2c47 100644 --- a/installer/src/main/java/com/github/dcevm/installer/ConfigurationInfo.java +++ b/installer/src/main/java/com/github/dcevm/installer/ConfigurationInfo.java @@ -36,15 +36,16 @@ import java.util.regex.Pattern; * @author Kerstin Breiteneder * @author Christoph Wimberger * @author Ivan Dubrov + * @author Jiri Bubnik */ public enum ConfigurationInfo { // Note: 32-bit is not supported on Mac OS X MAC_OS(null, "bsd_amd64_compiler2", - "lib/client", "lib/server", "lib/server", + "lib/client", "lib/server", "lib/dcevm", "lib/server", "lib/dcevm", "bin/java", "libjvm.dylib"), LINUX("linux_i486_compiler2", "linux_amd64_compiler2", - "lib/i386/client", "lib/i386/server", "lib/amd64/server", + "lib/i386/client", "lib/i386/server", "lib/i386/dcevm", "lib/amd64/server", "lib/amd64/dcevm", "bin/java", "libjvm.so") { @Override public String[] paths() { @@ -52,7 +53,7 @@ public enum ConfigurationInfo { } }, WINDOWS("windows_i486_compiler2", "windows_amd64_compiler2", - "bin/client", "bin/server", "bin/server", + "bin/client", "bin/server", "bin/dcevm", "bin/server", "bin/dcevm", "bin/java.exe", "jvm.dll") { @Override public String[] paths() { @@ -60,6 +61,7 @@ public enum ConfigurationInfo { System.getenv("JAVA_HOME") + "/..", System.getenv("PROGRAMW6432") + "/JAVA", System.getenv("PROGRAMFILES") + "/JAVA", + System.getenv("PROGRAMFILES(X86)") + "/JAVA", System.getenv("SYSTEMDRIVE") + "/JAVA"}; } }; @@ -69,19 +71,25 @@ public enum ConfigurationInfo { private final String clientPath; private final String server32Path; + private final String dcevm32Path; private final String server64Path; + private final String dcevm64Path; private final String javaExecutable; private final String libraryName; private ConfigurationInfo(String resourcePath32, String resourcePath64, - String clientPath, String server32Path, String server64Path, + String clientPath, + String server32Path, String dcevm32Path, + String server64Path, String dcevm64Path, String javaExecutable, String libraryName) { this.resourcePath32 = resourcePath32; this.resourcePath64 = resourcePath64; this.clientPath = clientPath; this.server32Path = server32Path; + this.dcevm32Path = dcevm32Path; this.server64Path = server64Path; + this.dcevm64Path = dcevm64Path; this.javaExecutable = javaExecutable; this.libraryName = libraryName; } @@ -114,6 +122,14 @@ public enum ConfigurationInfo { return server64Path; } + public String getDcevm32Path() { + return dcevm32Path; + } + + public String getDcevm64Path() { + return dcevm64Path; + } + public String getJavaExecutable() { return javaExecutable; } @@ -195,54 +211,70 @@ public enum ConfigurationInfo { return result.toString(); } - public boolean isDCEInstalled(Path dir) throws IOException { + public boolean isDCEInstalled(Path dir, boolean altjvm) throws IOException { Path jreDir; if (isJDK(dir)) { jreDir = dir.resolve("jre"); } else { jreDir = dir; } - Path clientPath = jreDir.resolve(getClientPath()); - Path clientBackup = clientPath.resolve(getBackupLibraryName()); - Path serverPath = jreDir.resolve(getServer32Path()); - if (!Files.exists(serverPath)) { - serverPath = jreDir.resolve(getServer64Path()); - } - Path serverBackup = serverPath.resolve(getBackupLibraryName()); + if (altjvm) { + Path altvm32Path = jreDir.resolve(getDcevm32Path()); + Path altvm64Path = jreDir.resolve(getDcevm64Path()); + + return Files.exists(altvm32Path) || Files.exists(altvm64Path); + } else { + Path clientPath = jreDir.resolve(getClientPath()); + Path clientBackup = clientPath.resolve(getBackupLibraryName()); + + Path serverPath = jreDir.resolve(getServer32Path()); + if (!Files.exists(serverPath)) { + serverPath = jreDir.resolve(getServer64Path()); + } + Path serverBackup = serverPath.resolve(getBackupLibraryName()); - if (Files.exists(clientPath) && Files.exists(serverPath)) { - if (Files.exists(clientBackup) != Files.exists(serverBackup)) { - throw new IllegalStateException(jreDir.toAbsolutePath() + " has invalid state."); + if (Files.exists(clientPath) && Files.exists(serverPath)) { + if (Files.exists(clientBackup) != Files.exists(serverBackup)) { + throw new IllegalStateException(jreDir.toAbsolutePath() + " has invalid state."); + } } + return Files.exists(clientBackup) || Files.exists(serverBackup); } - return Files.exists(clientBackup) || Files.exists(serverBackup); } - public String getVersionString(Path jreDir) throws IOException { - return executeJava(jreDir, "-version"); + public String getVersionString(Path jreDir, boolean altjvm) throws IOException { + try { + if (altjvm) { + return executeJava(jreDir, "-XXaltjvm=dcevm", "-version"); + } else { + return executeJava(jreDir, "-version"); + } + } catch (Throwable e) { + return e.getMessage(); + } } public boolean is64Bit(Path jreDir) throws IOException { - return getVersionString(jreDir).contains("64-Bit"); + return getVersionString(jreDir, false).contains("64-Bit"); } public String getJavaVersion(Path jreDir) throws IOException { - return getVersionHelper(jreDir, ".*java version.*\"(.*)\".*", true); + return getVersionHelper(jreDir, ".*java version.*\"(.*)\".*", true, false); } - final public String getDCEVersion(Path jreDir) throws IOException { - return getVersionHelper(jreDir, ".*Dynamic Code Evolution.*build ([^,]+),.*", false); + final public String getDCEVersion(Path jreDir, boolean altjvm) throws IOException { + return getVersionHelper(jreDir, ".*Dynamic Code Evolution.*build ([^,]+),.*", false, altjvm); } - private String getVersionHelper(Path jreDir, String regex, boolean javaVersion) throws IOException { - String version = getVersionString(jreDir); + private String getVersionHelper(Path jreDir, String regex, boolean javaVersion, boolean altjvm) throws IOException { + String version = getVersionString(jreDir, altjvm); version = version.replaceAll("\n", ""); Matcher matcher = Pattern.compile(regex).matcher(version); if (!matcher.matches()) { - throw new IllegalArgumentException("Could not get " + (javaVersion ? "java" : "dce") + - "version of " + jreDir.toAbsolutePath() + "."); + return "Could not get " + (javaVersion ? "java" : "dce") + + "version of " + jreDir.toAbsolutePath() + "."; } version = matcher.replaceFirst("$1"); diff --git a/installer/src/main/java/com/github/dcevm/installer/InstallUninstallAction.java b/installer/src/main/java/com/github/dcevm/installer/InstallUninstallAction.java index 78cb8698..4e2d78de 100644 --- a/installer/src/main/java/com/github/dcevm/installer/InstallUninstallAction.java +++ b/installer/src/main/java/com/github/dcevm/installer/InstallUninstallAction.java @@ -35,16 +35,36 @@ import java.util.Observer; * @author Kerstin Breiteneder * @author Christoph Wimberger * @author Ivan Dubrov + * @author Jiri Bubnik */ class InstallUninstallAction extends AbstractAction implements ListSelectionListener, Observer { + /** + * Buttons to add/remove DCEVM. + */ + public static enum Type { + UNINSTALL("Uninstall"), + INSTALL("Replace by DCEVM"), + INSTALL_ALTJVM("Install DCEVM as altjvm"); + + String label; + + Type(String label) { + this.label = label; + } + + public String getLabel() { + return label; + } + } + private final JTable table; - private final boolean install; + private final Type type; private Installation installation; - public InstallUninstallAction(boolean install, JTable t) { - super(install ? "Install" : "Uninstall"); - this.install = install; + public InstallUninstallAction(Type type, JTable t) { + super(type.getLabel()); + this.type = type; setEnabled(false); table = t; t.getSelectionModel().addListSelectionListener(this); @@ -62,8 +82,11 @@ class InstallUninstallAction extends AbstractAction implements ListSelectionList public void actionPerformed(ActionEvent e) { try { - if (install) { - getSelectedInstallation().installDCE(); + if (type.equals(Type.INSTALL)) { + getSelectedInstallation().installDCE(false); + } + else if (type.equals(Type.INSTALL_ALTJVM)) { + getSelectedInstallation().installDCE(true); } else { getSelectedInstallation().uninstallDCE(); } @@ -89,10 +112,12 @@ class InstallUninstallAction extends AbstractAction implements ListSelectionList } private void update() { - if (install) { + if (type.equals(Type.INSTALL)) { setEnabled(installation != null && !installation.isDCEInstalled()); + } else if (type.equals(Type.INSTALL_ALTJVM)) { + setEnabled(installation != null && !installation.isDCEInstalledAltjvm()); } else { - setEnabled(installation != null && installation.isDCEInstalled()); + setEnabled(installation != null && (installation.isDCEInstalled() || installation.isDCEInstalledAltjvm())); } } diff --git a/installer/src/main/java/com/github/dcevm/installer/Installation.java b/installer/src/main/java/com/github/dcevm/installer/Installation.java index 133e5a1c..3e07d7aa 100644 --- a/installer/src/main/java/com/github/dcevm/installer/Installation.java +++ b/installer/src/main/java/com/github/dcevm/installer/Installation.java @@ -31,6 +31,7 @@ import java.util.Observable; * @author Kerstin Breiteneder * @author Christoph Wimberger * @author Ivan Dubrov + * @author Jiri Bubnik */ public class Installation extends Observable { @@ -38,9 +39,20 @@ public class Installation extends Observable { private final ConfigurationInfo config; private final boolean isJDK; + + // DCEVM is installed over default JVM (either server or client) private boolean installed; + + // DCEVM is installed as an alternative DCEVM (in separate dcevm directory) + private boolean installedAltjvm; + + // version of Java private String version; - private String dceVersion; + // version of DCEVM in main location (client/server) + private String versionDcevm; + // version of DCEVM in alternative location (dcevm altjvm) + private String versionDcevmAltjvm; + private boolean is64Bit; public Installation(ConfigurationInfo config, Path path) throws IOException { @@ -50,6 +62,7 @@ public class Installation extends Observable { } catch (IOException ex) { throw new IllegalArgumentException(path.toAbsolutePath() + " is no JRE or JDK-directory."); } + isJDK = config.isJDK(file); if (!isJDK && !config.isJRE(file)) { throw new IllegalArgumentException(path.toAbsolutePath() + " is no JRE or JDK-directory."); @@ -60,10 +73,12 @@ public class Installation extends Observable { } final public void update() throws IOException { - installed = config.isDCEInstalled(file); - if (installed) { - dceVersion = config.getDCEVersion(file); - } + installed = config.isDCEInstalled(file, false); + versionDcevm = installed ? config.getDCEVersion(file, false) : ""; + + installedAltjvm = config.isDCEInstalled(file, true); + versionDcevmAltjvm = installedAltjvm ? config.getDCEVersion(file, true) : ""; + is64Bit = config.is64Bit(file); } @@ -75,8 +90,12 @@ public class Installation extends Observable { return version; } - public String getDCEVersion() { - return dceVersion; + public String getVersionDcevm() { + return versionDcevm; + } + + public String getVersionDcevmAltjvm() { + return versionDcevmAltjvm; } public boolean isJDK() { @@ -87,9 +106,8 @@ public class Installation extends Observable { return is64Bit; } - public void installDCE() throws IOException { - new Installer(config).install(file, is64Bit); - installed = true; + public void installDCE(boolean altjvm) throws IOException { + new Installer(config).install(file, is64Bit, altjvm); update(); setChanged(); notifyObservers(); @@ -98,6 +116,7 @@ public class Installation extends Observable { public void uninstallDCE() throws IOException { new Installer(config).uninstall(file, is64Bit); installed = false; + installedAltjvm = false; update(); setChanged(); notifyObservers(); @@ -107,6 +126,10 @@ public class Installation extends Observable { return installed; } + public boolean isDCEInstalledAltjvm() { + return installedAltjvm; + } + @Override public boolean equals(Object obj) { if (obj == null) { diff --git a/installer/src/main/java/com/github/dcevm/installer/InstallationTableCellRenderer.java b/installer/src/main/java/com/github/dcevm/installer/InstallationTableCellRenderer.java index c15fe688..76dadd83 100644 --- a/installer/src/main/java/com/github/dcevm/installer/InstallationTableCellRenderer.java +++ b/installer/src/main/java/com/github/dcevm/installer/InstallationTableCellRenderer.java @@ -57,7 +57,14 @@ class InstallationTableCellRenderer extends DefaultTableCellRenderer { break; case 3: if (inst.isDCEInstalled()) { - l.setText("Yes (" + inst.getDCEVersion() + ")"); + l.setText("Yes (" + inst.getVersionDcevm() + ")"); + } else { + l.setText("No"); + } + break; + case 4: + if (inst.isDCEInstalledAltjvm()) { + l.setText("Yes (" + inst.getVersionDcevmAltjvm() + ")"); } else { l.setText("No"); } diff --git a/installer/src/main/java/com/github/dcevm/installer/InstallationsTableModel.java b/installer/src/main/java/com/github/dcevm/installer/InstallationsTableModel.java index c5014627..215bc4be 100644 --- a/installer/src/main/java/com/github/dcevm/installer/InstallationsTableModel.java +++ b/installer/src/main/java/com/github/dcevm/installer/InstallationsTableModel.java @@ -46,7 +46,7 @@ class InstallationsTableModel extends AbstractTableModel implements Observer { } public int getColumnCount() { - return 4; + return 5; } public Object getValueAt(int rowIndex, int columnIndex) { diff --git a/installer/src/main/java/com/github/dcevm/installer/Installer.java b/installer/src/main/java/com/github/dcevm/installer/Installer.java index 93399365..fb5a40a3 100644 --- a/installer/src/main/java/com/github/dcevm/installer/Installer.java +++ b/installer/src/main/java/com/github/dcevm/installer/Installer.java @@ -33,6 +33,7 @@ import java.util.List; * @author Kerstin Breiteneder * @author Christoph Wimberger * @author Ivan Dubrov + * @author Jiri Bubnik */ public class Installer { @@ -42,22 +43,33 @@ public class Installer { this.config = config; } - public void install(Path dir, boolean bit64) throws IOException { + public void install(Path dir, boolean bit64, boolean altjvm) throws IOException { if (config.isJDK(dir)) { dir = dir.resolve(config.getJREDirectory()); } - Path serverPath = dir.resolve(config.getServerPath(bit64)); - if (Files.exists(serverPath)) { - installClientServer(serverPath, bit64); - } + if (!altjvm) { + Path serverPath = dir.resolve(config.getServerPath(bit64)); + if (Files.exists(serverPath)) { + installClientServer(serverPath, bit64); + } - Path clientPath = dir.resolve(config.getClientPath()); - if (Files.exists(clientPath) && !bit64) { - installClientServer(clientPath, false); + Path clientPath = dir.resolve(config.getClientPath()); + if (Files.exists(clientPath) && !bit64) { + installClientServer(clientPath, false); + } + } else { + Path altjvmPath = dir.resolve(bit64 ? config.getDcevm64Path() : config.getDcevm32Path()); + if (!Files.exists(altjvmPath)) { + Files.createDirectory(altjvmPath); + } + installClientServer(altjvmPath, bit64); } } + /** + * Try to uninstall DCEVM from all locations (skip if not exists). + */ public void uninstall(Path dir, boolean bit64) throws IOException { if (config.isJDK(dir)) { dir = dir.resolve(config.getJREDirectory()); @@ -72,6 +84,21 @@ public class Installer { if (Files.exists(clientPath) && !bit64) { uninstallClientServer(clientPath); } + + Path dcevm32Path = dir.resolve(config.getDcevm32Path()); + if (Files.exists(dcevm32Path)) { + Files.deleteIfExists(dcevm32Path.resolve(config.getLibraryName())); + Files.deleteIfExists(dcevm32Path.resolve(config.getBackupLibraryName())); + Files.delete(dcevm32Path); + } + + Path dcevm64Path = dir.resolve(config.getDcevm64Path()); + if (Files.exists(dcevm64Path)) { + Files.deleteIfExists(dcevm64Path.resolve(config.getLibraryName())); + Files.deleteIfExists(dcevm64Path.resolve(config.getBackupLibraryName())); + Files.delete(dcevm64Path); + } + } public List<Installation> listInstallations() { @@ -88,14 +115,25 @@ public class Installer { Path library = path.resolve(config.getLibraryName()); Path backup = path.resolve(config.getBackupLibraryName()); + // backup any existing library (assume original JVM file) + if (Files.exists(library)) { + Files.move(library, backup); + } - Files.move(library, backup); try { + // install actual DCEVM file try (InputStream in = getClass().getClassLoader().getResourceAsStream(resource)) { + if (in == null) { + throw new IOException("DCEVM not available for java at '" + path + "'. Missing resource " + resource); + } + Files.copy(in, library); } - } catch (IOException e) { - Files.move(backup, library, StandardCopyOption.REPLACE_EXISTING); + } catch (NullPointerException | IOException e) { + // try to restore original file + if (Files.exists(backup)) { + Files.move(backup, library, StandardCopyOption.REPLACE_EXISTING); + } throw e; } } @@ -104,8 +142,10 @@ public class Installer { Path library = path.resolve(config.getLibraryName()); Path backup = path.resolve(config.getBackupLibraryName()); - Files.delete(library); - Files.move(backup, library); // FIXME: if fails, JRE is inconsistent! + if (Files.exists(backup)) { + Files.delete(library); + Files.move(backup, library); + } } private List<Installation> scanPaths(String... dirPaths) { @@ -117,6 +157,7 @@ public class Installer { scanDirectory(stream, installations); } catch (Exception ex) { // Ignore, try different directory + ex.printStackTrace(); } } } @@ -125,14 +166,18 @@ public class Installer { private void scanDirectory(DirectoryStream<Path> stream, List<Installation> installations) { for (Path path : stream) { - try { - Installation inst = new Installation(config, path); - if (!installations.contains(inst)) { - installations.add(inst); + if (Files.isDirectory(path) && (config.isJDK(path) || config.isJRE(path))) { + try { + Installation inst = new Installation(config, path); + if (!installations.contains(inst)) { + installations.add(inst); + } + } catch (Exception ex) { + // FIXME: just ignore the installation for now.. + ex.printStackTrace(); } - } catch (Exception e) { - // FIXME: just ignore the installation for now.. } } } + } diff --git a/installer/src/main/java/com/github/dcevm/installer/MainWindow.java b/installer/src/main/java/com/github/dcevm/installer/MainWindow.java index d253b44d..f01eb446 100644 --- a/installer/src/main/java/com/github/dcevm/installer/MainWindow.java +++ b/installer/src/main/java/com/github/dcevm/installer/MainWindow.java @@ -99,7 +99,9 @@ public class MainWindow extends JFrame { license.setEditable(false); license.setFont(license.getFont().deriveFont(11.0f)); StringBuilder licenseText = new StringBuilder(); - licenseText.append("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation.\n\nThis code 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 version 2 for more details (a copy is included in the LICENSE file that accompanied this code).\n\nYou should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA."); + licenseText.append("Enhance current Java (JRE/JDK) installations with DCEVM (http://github.com/dcevm/dcevm)."); + licenseText.append("\n\nYou can either replace current Java VM or install DCEVM as alternative JVM (run with -XXaltjvm=dcevm command-line option)."); + licenseText.append("\n\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation.\n\nThis code 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 version 2 for more details (a copy is included in the LICENSE file that accompanied this code).\n\nYou should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA."); licenseText.append("\n\n\nASM LICENSE TEXT:\nCopyright (c) 2000-2005 INRIA, France Telecom\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."); license.setText(licenseText.toString()); JScrollPane licenses = new JScrollPane(license, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); @@ -117,7 +119,7 @@ public class MainWindow extends JFrame { JLabel l = new JLabel("Please choose installation directory:"); l.setVerticalAlignment(JLabel.NORTH); l.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); - p.add(l, BorderLayout.WEST); + p.add(l, BorderLayout.NORTH); table = new JTable(installations); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); @@ -126,10 +128,15 @@ public class MainWindow extends JFrame { table.getColumnModel().getColumn(0).setHeaderValue("Directory"); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setHeaderValue("Java Version"); + table.getColumnModel().getColumn(3).setPreferredWidth(100); table.getColumnModel().getColumn(2).setHeaderValue("Type"); - table.getColumnModel().getColumn(3).setHeaderValue("DCE"); + table.getColumnModel().getColumn(3).setPreferredWidth(100); + table.getColumnModel().getColumn(3).setHeaderValue("Replaced by DCEVM?"); + table.getColumnModel().getColumn(3).setPreferredWidth(200); + table.getColumnModel().getColumn(4).setHeaderValue("Installed altjvm?"); + table.getColumnModel().getColumn(4).setPreferredWidth(200); JScrollPane lists = new JScrollPane(table); - lists.setPreferredSize(new Dimension(200, 200)); + lists.setPreferredSize(new Dimension(900, 200)); p.add(lists, BorderLayout.CENTER); return p; @@ -142,8 +149,9 @@ public class MainWindow extends JFrame { JPanel right = new JPanel(new FlowLayout()); //right.add(new JButton(new TestAction(table, installer))); - right.add(new JButton(new InstallUninstallAction(false, table))); - right.add(new JButton(new InstallUninstallAction(true, table))); + right.add(new JButton(new InstallUninstallAction(InstallUninstallAction.Type.UNINSTALL, table))); + right.add(new JButton(new InstallUninstallAction(InstallUninstallAction.Type.INSTALL, table))); + right.add(new JButton(new InstallUninstallAction(InstallUninstallAction.Type.INSTALL_ALTJVM, table))); JPanel bottom = new JPanel(new BorderLayout()); bottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |