I am trying to make a GUI using Java graphics, but for some reason it won't work. Here is the code:
public class ScreenCap extends Canvas {
/**
* @param args the command line arguments
*/
@SuppressWarnings("ResultOfObjectAllocationIgnored")
public static void main(String[] args) {
new ScreenCap();
}
public ScreenCap() {
Window window = new Window(this);
window.setVisible(true);
this.addMouseListener(new MouseHandler());
drawComponents();
}
private void drawComponents() {
System.out.println("in draw");
createBufferStrategy(3);
BufferStrategy bs = getBufferStrategy();
Graphics g = bs.getDrawGraphics();
g.setColor(Colors.BG);
g.fillRect(0, 0, getWidth(), getHeight());
}
}