public ClientPanel(@Nullable Applet client) { setSize(Constants.GAME_FIXED_SIZE); setMinimumSize(Constants.GAME_FIXED_SIZE); setPreferredSize(Constants.GAME_FIXED_SIZE); setLayout(new BorderLayout()); setBackground(Color.black); if (client == null) { return; } client.setLayout(null); client.setSize(Constants.GAME_FIXED_SIZE); client.init(); client.start(); add(client, BorderLayout.CENTER); // This causes the whole game frame to be redrawn each frame instead // of only the viewport, so we can hook to MainBufferProvider#draw // and draw anywhere without it leaving artifacts if (client instanceof Client) { ((Client)client).setGameDrawingMode(2); } } }
@Override public void init() { if (wrappedApplet != null) { wrappedApplet.init(); } }
@Override public void init() { super.init(); }
@Override public void init() { if (minecraftApplet != null) { minecraftApplet.init(); } }
private void loadApplet() { applet.init(); applet.start(); loaded = true; }
Class applet2 = Class.forName("Applet2"); Applet appletToLoad = (Applet)applet2.newInstance(); appletToLoad.setStub(this); setLayout(new GridLayout(1,0)); add(appletToLoad); appletToLoad.init(); appletToLoad.start();
if (strp.matches(strp) && stru.matches(stru)) { Class applet2 = Class.forName("register"); // give complete name of register class including package name Applet appletToLoad = (Applet)applet2.newInstance(); appletToLoad.setStub(this); setLayout( new GridLayout(1,0)); add(appletToLoad); appletToLoad.init(); appletToLoad.start(); } else { JOptionPane.showMessageDialog(null,"User name or password are not correct."); return; }
Applet applet = new TheRealApplet(); applet.setStub(this); this.setLayout( new BorderLayout() ); add( applet, BorderLayout.CENTER ); applet.init(); applet.start();
Applet applet = new CounterThread(); applet.init(); applet.start();
public void init() { super.init(); System.err.println("init"); try { URL url = new URL("file:/Users/duns/svn/freehep/vectorgraphics/freehep-graphicsio-emf/TestOffset.emf"); EMFInputStream is = new EMFInputStream(url.openStream()); EMFRenderer renderer = new EMFRenderer(is); EMFPanel panel = new EMFPanel(); panel.setRenderer(renderer); add(panel); } catch (MalformedURLException mfue) { System.err.println("URL Malformed "+mfue); } catch (IOException ioe) { System.err.println("IO Exception "+ioe); } }
import java.awt.*; import java.applet.Applet; import java.awt.geom.Rectangle2D; import javax.swing.*; public class Shapes extends JApplet { public static void main(String[] args) { JApplet app = new Shapes(); JFrame f = new JFrame("Example"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); app.init(); app.start(); f.add("Center", app); f.pack(); f.setVisible(true); } Shapes() { } public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.drawLine(20, 20, 100, 100); } }
AppletStub stub = new AppletStub() { // lots of code including defining the parameter 'myParameter' }; Applet a = new Applet(); a.setStub(stub); a.init(); // ...
import javax.swing.JFrame; import javax.swing.JApplet; class TLAppletFrame { public static void main(String[] args) { JApplet applet = new TLApplet(); applet.init(); JFrame frame = new JFrame("Applet in Frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add( applet ); frame.pack(); frame.setLocationRelativeTo( null ); frame.setVisible( true ); applet.start(); } }
public void init(Runnable runnable) { // recreate lib in background setInstance(this); Game.setQuestapp(this); super.init(); setLayout(new BorderLayout()); setBackground(Color.black); setFont(mainfont); // Game.warn("Focus owned by: // "+KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()); // set game in action Game.setUserinterface(new Interface()); Game.thread = new Thread(runnable); Game.thread.start(); }
public void replace(Applet applet) { this.wrappedApplet = applet; applet.setStub(this); applet.setSize(getWidth(), getHeight()); this.setLayout(new BorderLayout()); this.add(applet, "Center"); applet.init(); active = true; applet.start(); validate(); }
public void replace(Applet applet) { this.applet = applet; applet.setStub(this); applet.setSize(getWidth(), getHeight()); setLayout(new BorderLayout()); add(applet, "Center"); applet.init(); active = true; applet.start(); validate(); }
@Override public void run() { showStatus( name + " initializing..." ); applet.init(); validate(); showStatus( name + " starting..." ); applet.start(); validate(); showStatus( name + " running..." ); }
public void replace(Applet applet) { this.minecraft = applet; applet.setStub(this); applet.setSize(getWidth(), getHeight()); setLayout(new BorderLayout()); add(applet, "Center"); applet.init(); this.active = true; applet.start(); validate(); }
@Override public void run() { showStatus( name + " initializing..." ); applet.init(); validate(); showStatus( name + " starting..." ); applet.start(); validate(); showStatus( name + " running..." ); }
AppletFrame(String title, Applet applet, int width, int height) { super(title); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); applet.init(); applet.setSize(width, height); applet.start(); this.add(applet); this.pack(); this.setVisible(true); } }