Cepek.Bengals 64
2012-02-15 10:58:19 UTC
import java.awt.*;
import java.awt.font.*;
import java.util.Random;
import java.applet.*;
import java.text.*;
import javax.swing.*;
import java.awt.event.*;
import java.lang.Math;
import java.applet.Applet;
public class shooterMain extends Applet implements KeyListener
{double h = 0,w = 0;
public void test(final GetScreenSize width){
GetScreenSize.findWidth(w);
GetScreenSize.findHeight(h);}
public void stop()
{
}
public void init()
{
this.setSize(w,h);
Cursor CROSSHAIR_CURSOR = new Cursor(Cursor.CROSSHAIR_CURSOR);
setCursor(CROSSHAIR_CURSOR);
setFocusable(true);
addKeyListener(this);
setBackground(Color.black);
}
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
if(code == 87) {//W
}
if(code == 65) {//A
}
if(code == 83) {//S
}
if(code == 68) {//D
}
e.consume();
}
public void setCursor(Cursor CROSSHAIR_CURSOR) {
}
public void setSize(double w2, double h2)
{
w2=w;h2=h;
}
public void paint(Graphics g)
{
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
}
The screensize ( Working perfectly)
import java.awt.*;
public class GetScreenSize
{
public static void main(String args[])
{
}
public static double findWidth(double width)
{
double W=0;
// Get the default toolkit
Toolkit toolkit = Toolkit.getDefaultToolkit();
// Get the current screen size
Dimension dim = toolkit.getScreenSize();
W=dim.width;
width=W;
return width;
}
public static double findHeight(double height)
{
double H=0;
// Get the default toolkit
Toolkit toolkit = Toolkit.getDefaultToolkit();
// Get the current screen size
Dimension dim = toolkit.getScreenSize();
H=dim.height;
height=H;
return height;
}
}
I've run it in eclipse and textpad++ and i have no errors, but i am getting a 200x200 it seems applet window instead of my screen resolution.. (1280x800)