# Removing Border from Processing Screen

**URL:** <https://discourse.processing.org/t/removing-border-from-processing-screen/23965>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [September 19, 2020, 4:15pm UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965 "2020-09-19T16:15:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![BuffaloFan32](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@BuffaloFan32](https://discourse.processing.org/u/BuffaloFan32)\
**Post date:** [September 19, 2020, 4:15pm UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965/1 "2020-09-19T16:15:31Z")

</div>

I wrote the script below that takes part of my computer screen and shows a smaller version of it in a tiny window in the corner. I found a helpful thread that helped me remove the toolbar from the top of the window but I can’t figure out how to remove the gray border from it. Bonus points if you can tell me if there is a way to put a red square around the area of the screen I am taking from.

```auto
import processing.video.*;
import processing.serial.*;
import java.awt.Rectangle;
import java.awt.Frame;
import processing.awt.PSurfaceAWT;
import processing.awt.PSurfaceAWT.SmoothCanvas;

// https://github.com/onformative/ScreenCapturer/issues/2
import java.awt.Robot;
import java.awt.Rectangle;
import java.awt.AWTException;

Robot robot;

int errorCount=0;
PImage img;
String[] strLines;

//void settings() {
// fullScreen();
//}

void setup() {
  
  strLines = loadStrings("C:/Users/Jesse's PC/Desktop/coordinate_writer/positions.txt");
  
  if (errorCount > 0) exit();
     
  //size(89, 78); // create the window
  surface.setSize(89,78);
  surface.setLocation(1775, 875);
 
  
  try {
    robot = new Robot();
  }
  catch (AWTException e) {
    println(e);
  }  
}

PSurface initSurface() {
  PSurface pSurface = super.initSurface();
  PSurfaceAWT awtSurface = (PSurfaceAWT) surface;
  SmoothCanvas smoothCanvas = (SmoothCanvas) awtSurface.getNative();
  Frame frame = smoothCanvas.getFrame();
  frame.setUndecorated(true);
  frame.setLayout(null);
  return pSurface;
}
 
 
// runs for each new frame of movie data
void movieEvent() {
  // read the movie's next frame
  img = new PImage(robot.createScreenCapture(new Rectangle(100, 200, 720, 640)));
}

// draw runs every time the screen is redrawn - show the movie...
void draw() {
  //background(100);
  movieEvent();
  loadPixels();
  for (int i = 1; i < (strLines.length); i++) {
    pixels[i] = img.pixels[int(strLines[i])];
  }
  updatePixels(); 
}

```

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [September 20, 2020, 10:33pm UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965/2 "2020-09-20T22:33:47Z")

</div>

Try this code:

```auto
import java.awt.*;
int center_x, center_y;

void setup() {
  fullScreen();
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  int screenHeight = screenSize.height;
  int screenWidth = screenSize.width;
  surface.setSize(600, 600);
  center_x = screenWidth/2-width/2;
  center_y = screenHeight/2-height/2;
  surface.setLocation(center_x, center_y);
  strokeWeight(10);
  stroke(255, 0, 0);
}

void draw() {
  rect(0, 0, width, height);
}

```

---

<div class="post-metadata">

**Author:** ![BuffaloFan32](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@BuffaloFan32](https://discourse.processing.org/u/BuffaloFan32)\
**Post date:** [September 21, 2020, 1:09am UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965/3 "2020-09-21T01:09:22Z")

</div>

Hi Noel, thanks for responding. That works but the border reappears when I shrink the size down to (89, 78). Any idea why that would be?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [September 21, 2020, 1:19am UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965/4 "2020-09-21T01:19:25Z")

</div>

> [@BuffaloFan32](#):
>
> Bonus points if you can tell me if there is a way to put a red square around the area of the screen

Didn’t receive yet. 😀

---

<div class="post-metadata">

**Author:** ![BuffaloFan32](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@BuffaloFan32](https://discourse.processing.org/u/BuffaloFan32)\
**Post date:** [September 21, 2020, 9:13pm UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965/5 "2020-09-21T21:13:22Z")

</div>

Hi noel, it didn’t work when I shrunk it down to 89x78.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [September 21, 2020, 9:29pm UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965/6 "2020-09-21T21:29:33Z")

</div>

A bit of research revealed the answer.

> <https://stackoverflow.com/questions/33849490/how-can-i-make-window-smaller-than-100-pixels>

`:)`

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [September 21, 2020, 9:36pm UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965/7 "2020-09-21T21:36:23Z")

</div>

This depends on the platform you use. I can’t change that. See [here](https://processing.github.io/processing-javadocs/core/processing/core/PSurface.html).

> ### Field Detail
> 
> static final int MIN\_WINDOW\_WIDTH
> 
> Minimum dimensions for the window holding an applet. This varies between platforms, Mac OS X 10.3 (confirmed with 10.7 and Java 6) can do any height but requires at least 128 pixels width. Windows XP has another set of limitations. And for all I know, Linux probably allows window sizes to be negative numbers.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [September 21, 2020, 9:42pm UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965/8 "2020-09-21T21:42:36Z")

</div>

> [@glv](#):
>
> revealed the answer

Did you succeed without any border?

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [September 22, 2020, 1:21am UTC](https://discourse.processing.org/t/removing-border-from-processing-screen/23965/9 "2020-09-22T01:21:20Z")

</div>

> [@noel](#):
>
> Did you succeed without any border?

I am not working on a size smaller than 128x128.  
Rebuilding the source is something to try for the adventurous.

```auto
void setup() 
  {
  fullScreen();
  surface.setSize(600, 600);
  surface.setLocation(500, 500);
  }

void draw() 
  {
  background(255, 255, 0);
  int xy = int(200+200*sin(frameCount*TAU/360)); //0 to 400
  println(xy);
  surface.setSize(xy, xy);
  }

```

`:)`
