import java.awt.Component;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
public class AppletViewer
{
public static void main(String[] args)
{
JFrame frame=new JFrame();
frame.setSize(new Dimension(240,320));
try
{
Class class_ = Class.forName(args[0]);
Component component = (Component) class_.newInstance();
frame.getContentPane().add(component);
}
catch (Exception e)
{
frame.getContentPane().add(new JLabel("Zima, nie ma szukanej klasy :-("));
}
frame.show();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}
|