# The package “processing.core.PSurfaceAWT” does not exist

**URL:** https://discourse.processing.org/t/the-package-processing-core-psurfaceawt-does-not-exist/44844
**Category:** Beginners
**Created:** [July 27, 2024, 6:43am UTC](https://discourse.processing.org/t/the-package-processing-core-psurfaceawt-does-not-exist/44844 "2024-07-27T06:43:32Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)
#### Post date: [July 27, 2024, 10:00am UTC](https://discourse.processing.org/t/the-package-processing-core-psurfaceawt-does-not-exist/44844/11 "2024-07-27T10:00:20Z")

</div>

Hi @winterchan,

here’s something to tinker with. hope that helps …

Cheers  
— mnse

```auto
import processing.awt.*;
import javax.swing.*;
import java.awt.*;
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsDevice;

GraphicsDevice device;
JFrame frame;
Dimension prevDimension;
Rectangle bounds;
int mode = 0;

void setup() {
	size(500,500);
  frame=(JFrame) ((PSurfaceAWT.SmoothCanvas)getSurface().getNative()).getFrame();
  prevDimension = ((PSurfaceAWT.SmoothCanvas)getSurface().getNative()).getPreferredSize();
  bounds = frame.getBounds();
  GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  device = ge.getDefaultScreenDevice();  
}

void keyReleased() {
  if (key == ' ') { // press space
    switch(++mode % 2) {
      case 0:
        frame.setVisible(false);
        frame.dispose();
        frame.setUndecorated(false);
        frame.setBounds(bounds);
        surface.setSize((int)prevDimension.getWidth(),(int)prevDimension.getHeight());          
        device.setFullScreenWindow(null);
        frame.setVisible(true);
        break;
      case 1:
        frame.setVisible(false);
        frame.dispose();
        frame.setUndecorated(true);
        surface.setSize(displayWidth,displayHeight);
        device.setFullScreenWindow(frame);
        frame.setVisible(true);
        break;
    }  
    ((PSurfaceAWT.SmoothCanvas)getSurface().getNative()).requestFocus();
  }
}

void draw() {
  background(0);
  fill(255,0,255);
  noStroke();
  ellipse(width/2,height/2,height/2,height/2);
}

```

---

_[View the full topic](https://discourse.processing.org/t/the-package-processing-core-psurfaceawt-does-not-exist/44844)._
