popup window with mouseclick
in
Programming Questions
•
4 months ago
Hello,
I need some urgent help with my program.
I got it working so far, but have a lot of trouble with a second window.
I want a second window with some content to pop up when I press the right mouse key within the boundaries of some content of the original window.
After seeing the new stuff, the window should be closeable..
I already had a look on the forum, but nothing I could find really worked.
Here is a code with just the Problem (I left the workig stuff out). Mainly something I found on the forum, but wasn't able to change it to what I want...
- PFrame f;
- secondApplet s;
- int x;
- int y;
- int l;
- int h;
- void setup() {
- size(320, 240);
- x=10;
- y=10;
- l=10;
- h=10;
- PFrame f = new PFrame();
- }
- void draw() {
- background(255,0,0);
- fill(255);
- rect(x,y,l,h);
- s.background(0, 0, 255);
- s.fill(100);
- s.rect(10,20,10,10);
- s.redraw();
- }
- public class PFrame extends Frame {
- public PFrame() {
- setBounds(100,100,400,300);
- s = new secondApplet();
- add(s);
- s.init();
- show();
- }
- }
- public class secondApplet extends PApplet {
- public void setup() {
- size(400, 300);
- noLoop();
- }
- public void draw() {
- }
- }
- //void mouseClick() {
- // if(mouseButton == LEFT){
- // for (int a=0; a<1; a++){
- // if((mouseX >=x) && (mouseX <= x + l))
- // if((mouseY <=y) && (mouseY >= y - h))
- // PFrame f = new PFrame();
- // s.background(0, 0, 255);
- // s.fill(100);
- // s.rect(10,20,10,10);
- // s.redraw();
- // }
- // }
- //}
1