Note that there are some explanatory texts on larger screens.

plurals
  1. POMandelbrot set and Julia set
    primarykey
    data
    text
    <p>Sorry for the mess guys. Let me reparaphrase my problems. I am working on Mandelbrot and Julia set in Java. I had difficulties achieving "zoom in" and "zoom out" functions after the user drags to make a rectangle and then releases the mouse. Zoom in and Zoom out are options that can be selected from the menu bar.The code posted contains the function I add for zooming in(similar thing for zoom out,I deleted it for space), which does not work. The reason that I posted the entire code previously is for better letting you understand what these variables stand for since there are a bunch of variables so it's hard to figure it out if you just simply look at something like X,Y,A,B,etc. Also, I am a beginner so I am not able to simplify my code and make it work so far, sorry about that. Hope this would make sense.Thx.</p> <pre><code>// implement methods for menu bar items public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JMenuItem) { String s = e.getActionCommand(); } else if (s.equals("ZoomIn")) { // zoom in addMouseListener(new MouseAdapter() { public void MouseReleased(MouseEvent aa) { //double H = getHeight(); //double W = getWidth(); if (drag) { g.setPaintMode(); drag = false; if (mj) { a2 = a1 + mx2 * xyr; a1 = a1 + mx1 * xyr; b1 = b2 - my2 * xyr; b2 = b2 - my1 * xyr; dxal.setText("a:["+nf1.format(a1)+","+nf1.format(a2)+"]"); dybl.setText("b:["+nf1.format(b1)+","+nf1.format(b2)+"]"); if (a2 &gt; a1 &amp;&amp; b2 &gt; b1) { // H = H * 2; // W = W * 2; threadDraw(); } } else { x2 = x1 + mx2 * xyr; x1 = x1 + mx1 * xyr; y1 = y2 - my2 * xyr; y2 = y2 - my1 * xyr; dxal.setText("x:["+nf1.format(x1)+","+nf1.format(x2)+"]"); dybl.setText("y:["+nf1.format(y1)+","+nf1.format(y2)+"]"); if (x2 &gt; x1 &amp;&amp; y2 &gt; y1) { // H = H * 2; // W = W * 2; threadDraw(); } } } } } ); } </code></pre> <p>btw. I can send the entire code to anyone who might want to see to help better understand my problems. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload