Hello all
Having spent 3 weeks now learning Java I’m still very much a novice.
What i’m struggling to do at the moment is convert my application to an applet to run on a webpage. It’s a small game and Im extending canvas, this is causing me no end of grief as I don’t think I’m grasping the fundemental differences. Obvious canvas has to go as it relates to windows, but what can replace it in order for me to still be able to use and implement something like bufferstrategy? Argh, its frustrating. Can somebody help? I’ll paste exerpts of the code below. Thanks if you can!
[tr][td]
import stuff here
public class Game extends Canvas {
private BufferStrategy buffage;
private boolean/arraylists/ints initialised here
public Game() {
JFrame theFrame = new JFrame(“Name Goes Here”);
JPanel thePanel = (JPanel) theFrame.getContentPane();
thePanel.setPreferredSize(new Dimension(800,600));
thePanel.setLayout(null);
setBounds(0,0,800,600);
thePanel.add(this);
setIgnoreRepaint(true);
theFrame.pack();
theFrame.setResizable(false);
theFrame.setVisible(true);
theFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
addKeyListener(new KeyInputHandler());
requestFocus();
createBufferStrategy(2);
buffage = getBufferStrategy();
initWidgets();
}
private void startGame() {
[/td][/tr]