public Java2DWindow(Core core, int width, int height) { this.core = core; this._frame = new JFrame(); this._frame.setSize(width, height); this._frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this._rootcomp = new JComponent() { @Override protected void paintComponent(Graphics graphics) { Graphics2D gfx = (Graphics2D) graphics; _update(gfx, this); } }; this._frame.add(_rootcomp); MasterListener ml = new MasterListener(_rootcomp, this); _rootcomp.addMouseListener(ml); _rootcomp.addMouseMotionListener(ml); _rootcomp.addKeyListener(ml); }