We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am working on creating my own themes for my projects but am unable to change the shape of the window. I would like to be able able to use the code from the you tube video in my project.
if it can not be done using the java.awt.geom.Ellipse2D library can someone point me to another to try.
this is what i have tried
import java.awt.MouseInfo;
import processing.opengl.*;
import java.awt.geom.Ellipse2D;
void setup() {
size(400,400,OPENGL);
}
void draw() {
fill(80);
strokeWeight(4);
rect(0,0,width,height,12);
smooth();
}
int mX;
int mY;
void mousePressed(){
mX = mouseX;
mY = mouseY;
}
void mouseDragged(){
frame.setLocation(
MouseInfo.getPointerInfo().getLocation().x-mX,
MouseInfo.getPointerInfo().getLocation().y-mY);
}
public void init(){
frame.removeNotify();
frame.setUndecorated(true);
frame.addNotify();
super.init();
// this is the code that is supposed to change it shape
setLayout(null);
Shape= new Ellipse2D.Double(0,0,400,300);
setShape(sp);
}
Answers
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
Look carefully at the code in the tutorial: the class he's using extends JFrame so it can make use of all methods available to JFrame. No such luxury inside a PApplet, we must call the JFrame methods of our frame field (which is a JFrame). Apart from that you were on the right track, except of course that to set the shape, addNotify() can't have been called yet.
Thank you