/*******************************************************************************
* Copyright 2007 Neptuny s.r.l. - www.neptuny.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.neptuny.xgrapher.cli.launcher;
import javax.swing.JApplet;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import com.l2fprod.common.swing.plaf.LookAndFeelAddons;
import com.l2fprod.common.swing.plaf.windows.WindowsLookAndFeelAddons;
import com.neptuny.xgrapher.cli.XGrapherPanel;
import com.neptuny.xgrapher.cli.controller.Application;
/**
* Wraps the XGrapher UI so that it can be executed within an applet.
*
* @author Riccardo Govoni [riccardo.govoni@neptuny.it]
* @since Sep 25, 2007
*
*/
public class Applet extends JApplet {
private static final long serialVersionUID = 6056107557170434858L;
@Override
public void init() {
super.init();
try {
String osName = System.getProperty("os.name");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
UIManager.put("win.xpstyle.name", "luna");
LookAndFeelAddons.setAddon(WindowsLookAndFeelAddons.class);
} catch (Exception e) {
// FIXME: handle exception and notify user
}
final Application app = new Application(
getParameter("mapping"),
getParameter("loader"),
getParameter("renderer"));
SwingUtilities.invokeLater(new Runnable() {
public void run() {
getContentPane().add(new XGrapherPanel(app));
}
});
}
}