|
@ -26,6 +26,7 @@ import javax.swing.JPanel; |
|
|
import javax.swing.JSlider; |
|
|
import javax.swing.JSlider; |
|
|
import javax.swing.JTextField; |
|
|
import javax.swing.JTextField; |
|
|
import javax.swing.border.BevelBorder; |
|
|
import javax.swing.border.BevelBorder; |
|
|
|
|
|
import javax.swing.border.EmptyBorder; |
|
|
import javax.swing.event.ChangeEvent; |
|
|
import javax.swing.event.ChangeEvent; |
|
|
import javax.swing.event.ChangeListener; |
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
|
|
|
@ -92,12 +93,20 @@ class RMIMandelbrotCalculationThread extends Thread { |
|
|
|
|
|
|
|
|
public void run() { |
|
|
public void run() { |
|
|
try { |
|
|
try { |
|
|
|
|
|
this.view.setIcon(new ImageIcon()); |
|
|
long timestampStart = System.currentTimeMillis(); |
|
|
long timestampStart = System.currentTimeMillis(); |
|
|
|
|
|
|
|
|
double ULx = this.remoteCalcObj.getULx(); |
|
|
|
|
|
double ULy = this.remoteCalcObj.getULy(); |
|
|
|
|
|
double LRx = this.remoteCalcObj.getLRx(); |
|
|
|
|
|
double LRy = this.remoteCalcObj.getLRy(); |
|
|
|
|
|
|
|
|
//double ULx = -0.16099999999999995, ULy = -0.9365333333333333, LRx = -0.03533333333333327, LRy = -0.8108666666666666; |
|
|
|
|
|
|
|
|
|
|
|
double ULx = -2; |
|
|
|
|
|
double ULy = 2; |
|
|
|
|
|
double LRx = 2; |
|
|
|
|
|
double LRy = -2; |
|
|
|
|
|
|
|
|
|
|
|
//double ULx = this.remoteCalcObj.getULx(); |
|
|
|
|
|
//double ULy = this.remoteCalcObj.getULy(); |
|
|
|
|
|
//double LRx = this.remoteCalcObj.getLRx(); |
|
|
|
|
|
//double LRy = this.remoteCalcObj.getLRy(); |
|
|
System.out.println("actual="+ULx + "/" + ULy + "/" + LRx + "/" + LRy); |
|
|
System.out.println("actual="+ULx + "/" + ULy + "/" + LRx + "/" + LRy); |
|
|
double w = LRx - ULx; |
|
|
double w = LRx - ULx; |
|
|
double h = LRy - ULy; |
|
|
double h = LRy - ULy; |
|
@ -124,12 +133,12 @@ class RMIMandelbrotCalculationThread extends Thread { |
|
|
this.boxULy = 0; |
|
|
this.boxULy = 0; |
|
|
this.boxW = MGuiRMI.RESX; |
|
|
this.boxW = MGuiRMI.RESX; |
|
|
this.boxH = MGuiRMI.RESY; |
|
|
this.boxH = MGuiRMI.RESY; |
|
|
this.remoteCalcObj.setView(ULx, ULy, LRx, LRy); |
|
|
|
|
|
|
|
|
//this.remoteCalcObj.setView(ULx, ULy, LRx, LRy); |
|
|
// end alex |
|
|
// end alex |
|
|
int[] colors = null; |
|
|
int[] colors = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.remoteCalcObj.iterateAllPoints(this.maxIterations * 1000, MGuiRMI.RESX, MGuiRMI.RESY/2); |
|
|
|
|
|
|
|
|
this.remoteCalcObj.iterateAllPoints(this.maxIterations * 1000, MGuiRMI.RESX, MGuiRMI.RESY/2, ULx, ULy, LRx, LRy); |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
int[] lookupTable = generateLookupTable(this.maxIterations.getValue() * 1000); |
|
|
int[] lookupTable = generateLookupTable(this.maxIterations.getValue() * 1000); |
|
@ -179,7 +188,8 @@ public class MGuiRMI implements ActionListener, ChangeListener, MouseListener, M |
|
|
JButton endButton; |
|
|
JButton endButton; |
|
|
JButton backButton; |
|
|
JButton backButton; |
|
|
JButton calcButton; |
|
|
JButton calcButton; |
|
|
JTextField hostTextField; |
|
|
|
|
|
|
|
|
JTextField host1TextField; |
|
|
|
|
|
JTextField host2TextField; |
|
|
JSlider maxIterations; |
|
|
JSlider maxIterations; |
|
|
MyJLabel viewUpper; |
|
|
MyJLabel viewUpper; |
|
|
MyJLabel viewLower; |
|
|
MyJLabel viewLower; |
|
@ -203,21 +213,25 @@ public class MGuiRMI implements ActionListener, ChangeListener, MouseListener, M |
|
|
// set up GUI |
|
|
// set up GUI |
|
|
this.frame = new JFrame("Mandelbrotmenge"); |
|
|
this.frame = new JFrame("Mandelbrotmenge"); |
|
|
this.panel = new JPanel(); |
|
|
this.panel = new JPanel(); |
|
|
|
|
|
this.panel.setBorder(new EmptyBorder(0,0,0,0)); |
|
|
this.endButton = new JButton("Ende"); |
|
|
this.endButton = new JButton("Ende"); |
|
|
this.panel.add(this.endButton); |
|
|
this.panel.add(this.endButton); |
|
|
this.backButton = new JButton("Zurück"); |
|
|
this.backButton = new JButton("Zurück"); |
|
|
this.panel.add(this.backButton); |
|
|
this.panel.add(this.backButton); |
|
|
this.calcButton = new JButton("Rechnen"); |
|
|
this.calcButton = new JButton("Rechnen"); |
|
|
this.hostTextField = new JTextField(20); |
|
|
|
|
|
this.hostTextField.setText("localhost"); |
|
|
|
|
|
|
|
|
this.host1TextField = new JTextField(10); |
|
|
|
|
|
this.host1TextField.setText("localhost"); |
|
|
|
|
|
this.host2TextField = new JTextField(10); |
|
|
|
|
|
this.host2TextField.setText("localhost"); |
|
|
this.panel.add(this.calcButton); |
|
|
this.panel.add(this.calcButton); |
|
|
this.panel.add(this.hostTextField); |
|
|
|
|
|
|
|
|
this.panel.add(this.host1TextField); |
|
|
|
|
|
this.panel.add(this.host2TextField); |
|
|
this.frame.add(this.panel); |
|
|
this.frame.add(this.panel); |
|
|
this.frame.setSize(700, 720); |
|
|
this.frame.setSize(700, 720); |
|
|
this.frame.setVisible(true); |
|
|
this.frame.setVisible(true); |
|
|
this.viewUpper = new MyJLabel(); |
|
|
this.viewUpper = new MyJLabel(); |
|
|
this.viewLower = new MyJLabel(); |
|
|
this.viewLower = new MyJLabel(); |
|
|
this.maxIterations = new JSlider(0, 50, 30); |
|
|
|
|
|
|
|
|
this.maxIterations = new JSlider(0, 100, 30); |
|
|
this.panel.add(this.maxIterations); |
|
|
this.panel.add(this.maxIterations); |
|
|
this.panel.add(this.viewUpper); |
|
|
this.panel.add(this.viewUpper); |
|
|
this.panel.add(this.viewLower); |
|
|
this.panel.add(this.viewLower); |
|
@ -267,11 +281,6 @@ public class MGuiRMI implements ActionListener, ChangeListener, MouseListener, M |
|
|
if (ae.getSource() == this.backButton) { |
|
|
if (ae.getSource() == this.backButton) { |
|
|
System.out.println("Zurueck"); |
|
|
System.out.println("Zurueck"); |
|
|
// Zoom und Ausschnitt zurücksetzen |
|
|
// Zoom und Ausschnitt zurücksetzen |
|
|
|
|
|
|
|
|
double ULx = -2; |
|
|
|
|
|
double ULy = 2; |
|
|
|
|
|
double LRx = 2; |
|
|
|
|
|
double LRy = -2; |
|
|
|
|
|
this.boxULx = 0; |
|
|
this.boxULx = 0; |
|
|
this.boxULy = 0; |
|
|
this.boxULy = 0; |
|
|
this.boxW = MGuiRMI.RESX; |
|
|
this.boxW = MGuiRMI.RESX; |
|
@ -288,12 +297,14 @@ public class MGuiRMI implements ActionListener, ChangeListener, MouseListener, M |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
/* |
|
|
try { |
|
|
try { |
|
|
this.remoteCalcObj.setView(ULx, ULy, LRx, LRy); |
|
|
this.remoteCalcObj.setView(ULx, ULy, LRx, LRy); |
|
|
} catch (RemoteException e) { |
|
|
} catch (RemoteException e) { |
|
|
// TODO Auto-generated catch block |
|
|
// TODO Auto-generated catch block |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
} |
|
|
} |
|
|
|
|
|
*/ |
|
|
this.message.setText("Ausschnitt zurückgesetzt"); |
|
|
this.message.setText("Ausschnitt zurückgesetzt"); |
|
|
} |
|
|
} |
|
|
if (this.remoteCalcObj2 == null) |
|
|
if (this.remoteCalcObj2 == null) |
|
@ -304,23 +315,31 @@ public class MGuiRMI implements ActionListener, ChangeListener, MouseListener, M |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
/* |
|
|
try { |
|
|
try { |
|
|
this.remoteCalcObj2.setView(ULx, ULy, LRx, LRy); |
|
|
this.remoteCalcObj2.setView(ULx, ULy, LRx, LRy); |
|
|
} catch (RemoteException e) { |
|
|
} catch (RemoteException e) { |
|
|
// TODO Auto-generated catch block |
|
|
// TODO Auto-generated catch block |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
} |
|
|
} |
|
|
|
|
|
*/ |
|
|
this.message.setText("Ausschnitt zurückgesetzt"); |
|
|
this.message.setText("Ausschnitt zurückgesetzt"); |
|
|
} |
|
|
} |
|
|
} else |
|
|
} else |
|
|
|
|
|
|
|
|
if (ae.getSource() == this.calcButton) { |
|
|
if (ae.getSource() == this.calcButton) { |
|
|
String hostname = this.hostTextField.getText(); |
|
|
|
|
|
System.out.println("Verbinde mit RMI Registry auf Host: " + hostname); |
|
|
|
|
|
|
|
|
String hostname1 = this.host1TextField.getText(); |
|
|
|
|
|
String hostname2 = this.host2TextField.getText(); |
|
|
|
|
|
System.out.println("Verbinde mit RMI Registry auf Host: " + hostname1); |
|
|
try { |
|
|
try { |
|
|
Registry registry = LocateRegistry.getRegistry(hostname); |
|
|
|
|
|
|
|
|
//double ULx = -0.16099999999999995, ULy = -0.9365333333333333, LRx = -0.03533333333333327, LRy = -0.8108666666666666; |
|
|
|
|
|
//double ULx = -2, ULy = 2, LRx = 2, LRy = -2; |
|
|
|
|
|
Registry registry = LocateRegistry.getRegistry(hostname1); |
|
|
this.remoteCalcObj = (RMIMandelbrotCalculationsInterface) registry.lookup("RMIMandelbrotCalculationsInterface"); |
|
|
this.remoteCalcObj = (RMIMandelbrotCalculationsInterface) registry.lookup("RMIMandelbrotCalculationsInterface"); |
|
|
this.remoteCalcObj2 = (RMIMandelbrotCalculationsInterface) registry.lookup("RMIMandelbrotCalculationsInterface2"); |
|
|
|
|
|
|
|
|
//this.remoteCalcObj.setView(ULx, ULy, LRx, LRy); |
|
|
|
|
|
Registry registry2 = LocateRegistry.getRegistry(hostname2); |
|
|
|
|
|
this.remoteCalcObj2 = (RMIMandelbrotCalculationsInterface) registry2.lookup("RMIMandelbrotCalculationsInterface"); |
|
|
|
|
|
//this.remoteCalcObj2.setView(ULx, ULy, LRx, LRy); |
|
|
/** CODE SEBASTIAN |
|
|
/** CODE SEBASTIAN |
|
|
|
|
|
|
|
|
System.out.println("Rechnen"); |
|
|
System.out.println("Rechnen"); |
|
@ -360,6 +379,7 @@ public class MGuiRMI implements ActionListener, ChangeListener, MouseListener, M |
|
|
end */ |
|
|
end */ |
|
|
/* Code Alex */ |
|
|
/* Code Alex */ |
|
|
System.out.println("Rechnen"); |
|
|
System.out.println("Rechnen"); |
|
|
|
|
|
this.message.setText("Rechnen"); |
|
|
|
|
|
|
|
|
RMIMandelbrotCalculationThread rmimct = new RMIMandelbrotCalculationThread(true, this.viewUpper, this.remoteCalcObj, maxIterations.getValue()); |
|
|
RMIMandelbrotCalculationThread rmimct = new RMIMandelbrotCalculationThread(true, this.viewUpper, this.remoteCalcObj, maxIterations.getValue()); |
|
|
new Thread(rmimct).start(); |
|
|
new Thread(rmimct).start(); |
|
@ -374,7 +394,7 @@ public class MGuiRMI implements ActionListener, ChangeListener, MouseListener, M |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Zoom not wirking for lower... |
|
|
|
|
|
|
|
|
// Zoom not working for lower... |
|
|
|
|
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
public void mousePressed(MouseEvent e) { |
|
|
this.boxULx = e.getX(); |
|
|
this.boxULx = e.getX(); |
|
|