Floating boxes applet with drag events need click event

I Have an applet cobbled from the net & modified. Is works but needs one major event added. It draws "Graphics.drawline" boxes with a text "String" inside each box ( the text string represents an URL location). These "boxes" are objects which are "draggable to other locations on canvas & therefore can be independently positioned by user. Each box redraws itself periodically to a slightly different screen location & becomes stationary after a 5 or 6 seconds. The point is, all of this "drag & mobility" behavior must remain intact & is not part of the "problem task".
Task: Need to have an "event" behavior added in one of two ways ( or a 3rd way if there is another ) whichever is quickest/ easiest. "Clickable mouse events" must be added to each box. ( boxes are built in a loop so adding to one will add to other locations & create as many "buttons" as there are boxes) . At each box's location, clicking one box should be an event which fires & clicking a different box should be a separate event which fires. Separate , so that URL location can be "hotlinked" to each box. That URL is currently displayed in the boxes (visible when running applet).
1st possible solution: Exchange these "boxes" which appear on canvas into clickable event "Graph panel.buttons" ( for example or some other clickable object) which maintains existing "drag" behavior of boxes. These buttons must each have "clickability" with mouse events to enable placing "getAppletContext. showDocument()" code with these events ( e.g., "hotlinked" to http locations).
or
2nd possible solution:. The drawstring boxes are currently dead string text with no event model other than the "drag" feature associated with each box. Must add an additional mouse event behavior to existing boxes so they are "clickable" ( or text inside is clickable) and can then execute "showDocument()" URL when clicked independently.
Maybe there is a #3. I don't know what that would be. Open to try anything without losing the drag & placement mobility of existing boxes.
These "boxes" could be images, or event buttons - doesnt matter.
Not sure if #2 is possible & have not been able to accomplish #1. Must stay within existing AWT framework so IE browsers can run it natively ( which of course IE cannot run Swing graphics unless a Sun plugin loaded ).
Applet is a single file ( creating 4 classes).
html file (which invokes it) passes a string param which is broken into above noted URL strings in each box.
Running this applet, you see a "button" event ( at base of canvas labeled "NewUrl" ) which pops up an url location when clicked ( using "showdocument"). This button is not attached to locations or text of each box object ( which is the "task" to accomplish) . The button does represent the kind of event behavior which each "box" should have when task is achieved. So the box can be exchanged with buttons or the boxes can be imbued with events to hyperlink like a button.
In spirit of solution #1, here is the bonehead attempt I tried which did not work: copied entire "if" block of logic from the button event (sited in preceding paragraph) into region of code which builds boxes ( "for" loop of "drawstring" method).
"g.drawString(doit, x - (w-10)/2, (y - (h-4)/2) + fm.getAscent());"
I copied all the "if" block of logic for button creation into the area immediately after the above line ( for loop which builds the boxes). Hoping that I could create buttons with events, along with all the boxes (which are getting created using "drawstring" above in a "for" loop). These "buttons" must also have positioning info of each box to appear in different locations on the canvas. Positioning data is not in that "if" block of code but it would have been a start to get the multiple buttons created ( even if all drawn in one spot). The "if" code block I've provieded for an example begins with the line:
" if ("NewUrl".equals(arg)) { "
and ends with with lines:
" return true; "
" } " //< -- end of above if block
This full "if" block can be seen in the listing below:
This "if" block creates the "NewUrl" button. Of course, I got a bunch of errors when I tried to copy this block to the above location:
variable: "arg" "not found in class GraphPanel".
methods: "getcodebase, showstatus, getappletcontext()"
"not found in class GraphPanel".
----------- The applet code in total follows next
Here are both the java & htm complete source.
import java.net.MalformedURLException;
import java.net.URL;
import java.net.*;
import java.util.*;
import java.awt.*;
import java.applet.Applet;
import java.applet.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.*;
class Node {
double x;
double y;
double dx;
double dy;
boolean fixed;
String lbl;
class Edge {
int from;
int to;
double len;
} // eEdgeCla
class GraphPanel extends Panel implements Runnable {
Box box;
int nnodes;
Node nodes[] = new Node[100];
int nedges;
Edge edges[] = new Edge[200];
Thread relaxer;
boolean showit;
boolean random;
GraphPanel(Box box) {
this.box = box;
} //ebox
int findNode(String lbl) {
for (int i = 0 ; i < nnodes ; i++) {
if (nodes.lbl.equals(lbl)) {
return i;
return addNode(lbl);
int addNode(String lbl) {
Node n = new Node();
n.x = 10 + 380*Math.random();
n.y = 10 + 380*Math.random();
n.lbl = lbl;
nodes[nnodes] = n;
return nnodes++;
void addEdge(String from, String to, int len) {
Edge e = new Edge();
e.from = findNode(from);
e.to = findNode(to);
e.len = len;
edges[nedges++] = e;
public void run() {
int i3=0;
while (true) {
relax();
if (random && (Math.random() < 0.03)) {
Node n = nodes[(int) (1 * nnodes) ]; // no
if (!n.fixed) {
n.x += (100*0.02) - 50;
n.y += (100*0.02) - 50; //
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
break;
i3++;
} //ew
} // epublrun()
synchronized void relax() {
for (int i = 0 ; i < nedges ; i++) {
Edge e = edges;
double vx = nodes[e.to].x - nodes[e.from].x;
double vy = nodes[e.to].y - nodes[e.from].y;
double len = Math.sqrt(vx * vx + vy * vy);
double f = (edges.len - len) / (len * 3) ;
double dx = f * vx;
double dy = f * vy;
nodes[e.to].dx += dx;
nodes[e.to].dy += dy;
nodes[e.from].dx += -dx;
nodes[e.from].dy += -dy;
} //efo
for (int i = 0 ; i < nnodes ; i++) {
Node n1 = nodes;
double dx = 0;
double dy = 0;
for (int j = 0 ; j < nnodes ; j++) {
if (i == j) {
continue;
Node n2 = nodes[j];
double vx = n1.x - n2.x;
double vy = n1.y - n2.y;
double len = vx * vx + vy * vy;
if (len == 0) {
dx += 0.02;
dy += 0.02;
} else if (len < 100*100) {
dx += vx / len;
dy += vy / len;
} //ef3a
double dlen = dx * dx + dy * dy;
if (dlen > 0) {
dlen = Math.sqrt(dlen) / 2;
n1.dx += dx / dlen;
n1.dy += dy / dlen;
} //ef3
Dimension d = size();
// f4
for (int i = 0 ; i < nnodes ; i++) {
Node n = nodes;
if (!n.fixed) {
n.x += Math.max(-5, Math.min(5, n.dx));
n.y += Math.max(-5, Math.min(5, n.dy));
if (n.x < 0) {
n.x = 0;
} else if (n.x > d.width) {
n.x = d.width;
if (n.y < 0) {
n.y = 0;
} else if (n.y > d.height) {
n.y = d.height;
n.dx /= 2;
n.dy /= 2;
repaint();
Node pick;
boolean pickfixed;
Image offscreen;
Dimension offscreensize;
Graphics offgraphics;
final Color fixedColor = Color.green;
final Color selectColor = Color.gray;
final Color edgeColor = Color.black;
final Color nodeColor = new Color(200, 90, 50);
final Color showitColor = Color.gray;
final Color arcColor1 = Color.black;
final Color arcColor2 = Color.orange;
final Color arcColor3 = Color.blue;
public void paintNode( Graphics g, Node n, FontMetrics fm) {
int x = (int)n.x;
int y = (int)n.y;
g.setColor((n == pick) ? selectColor : (n.fixed ? fixedColor : nodeColor));
int w = fm.stringWidth(n.lbl) + 10;
int h = fm.getHeight() + 4;
g.fillRect(x - w/2, y - h / 2, w, h);
g.setColor(Color.black);
g.drawRect(x - w/2, y - h / 2, w-1, h-1);
String doit = n.lbl.replace('x','/');
g.drawString(doit, x - (w-10)/2, (y - (h-4)/2) + fm.getAscent());
} // epa
public synchronized void update(Graphics g) {
Dimension d = size();
if ((offscreen == null) || (d.width != offscreensize.width) || (d.height != offscreensize.height)) {
offscreen = createImage(d.width, d.height);
offscreensize = d;
offgraphics = offscreen.getGraphics();
offgraphics.setFont(getFont());
offgraphics.setColor(getBackground());
offgraphics.fillRect(0, 0, d.width, d.height);
for (int i = 0 ; i < nedges ; i++) {
Edge e = edges;
int x1 = (int)nodes[e.from].x;
int y1 = (int)nodes[e.from].y;
int x2 = (int)nodes[e.to].x;
int y2 = (int)nodes[e.to].y;
int len = (int)Math.abs(Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) - e.len);
offgraphics.setColor((len < 10) ? arcColor1 : (len < 20 ? arcColor2 : arcColor3)) ;
offgraphics.drawLine(x1, y1, x2, y2);
if (showit) {
String lbl = String.valueOf(len);
offgraphics.setColor(showitColor);
offgraphics.drawString("href= http://localhost:"+lbl, x1 + (x2-x1)/2, y1 + (y2-y1)/2);
offgraphics.setColor(edgeColor);
} //ef5
FontMetrics fm = offgraphics.getFontMetrics();
for (int i = 0 ; i < nnodes ; i++) {
paintNode( offgraphics, nodes, fm); //or
g.drawImage(offscreen, 0, 0, null);
public synchronized boolean mouseDown(Event evt, int x, int y) {
double bestdist = Double.MAX_VALUE;
for (int i = 0 ; i < nnodes ; i++) {
Node n = nodes;
double dist = (n.x - x) * (n.x - x) + (n.y - y) * (n.y - y);
if (dist < bestdist) {
pick = n;
bestdist = dist;
pickfixed = pick.fixed;
pick.fixed = true;
pick.x = x;
pick.y = y;
repaint();
return true;
public synchronized boolean mouseDrag(Event evt, int x, int y) {
pick.x = x;
pick.y = y;
repaint();
return true;
} //e-pubsyncmousedrag
public synchronized boolean mouseUp(Event evt, int x, int y) {
pick.x = x;
pick.y = y;
pick.fixed = pickfixed;
pick = null;
repaint();
return true;
public void start() {
relaxer = new Thread(this);
relaxer.start();
public void stop() {
relaxer.stop();
public class Box extends Applet {
GraphPanel panel;
public void init() {
setLayout(new BorderLayout());
panel = new GraphPanel(this);
add("Center", panel);
Panel p = new Panel();
add("South", p);
p.add(new Button("Reposition"));
p.add(new Button("NewUrl"));
p.add(new Checkbox("Showit"));
String edges = getParameter("edges"); // putinli
for (StringTokenizer t = new StringTokenizer(edges, ",") ; t.hasMoreTokens() ; ) {
String str = t.nextToken();
int i = str.indexOf('-');
if (i > 0) { int len = 50;
int j = str.indexOf('/');
if (j > 0) {
len = Integer.valueOf(str.substring(j+1)).intValue();
str = str.substring(0, j);
panel.addEdge(str.substring(0,i), str.substring(i+1), len);
} //ef8
Dimension d = size();
String center = getParameter("center");
if (center != null){
Node n = panel.nodes[panel.findNode(center)];
n.x = d.width / 2;
n.y = d.height / 2;
n.fixed = true;
} // eif
} // ep
public void start() {
panel.start();
public void stop() {
panel.stop();
public boolean action(Event evt, Object arg) {
if (arg instanceof Boolean) {
if (((Checkbox)evt.target).getLabel().equals("Showit")) {
panel.showit = ((Boolean)arg).booleanValue();
}// e-
else {
panel.random = ((Boolean)arg).booleanValue();
return true;
} // e-if instof bool
if ("Reposition".equals(arg)) {
Dimension d = size();
for (int i = 0 ; i < panel.nnodes ; i++) {
Node n = panel.nodes;
if (!n.fixed) {
n.x = 10 + (d.width-20)*Math.random();
n.y = 10 + (d.height-20)*Math.random();
} //ei
} //ef9
return true;
} //eif scram
if ("NewUrl".equals(arg)) {
Dimension d = size();
URL url = getCodeBase();
try {
getAppletContext().showDocument( new URL(url+"main.htm"), "_blank" );
try {
Thread.sleep(1000);
} catch (InterruptedException e) { }
} catch(MalformedURLException e) {
showStatus("814 URL not found");
for (int i = 0 ; i < panel.nnodes ; i++) {
Node n = panel.nodes;
if (!n.fixed) {
n.x += (80*0.02) - 40;
n.y += (80*0.02) - 40;
return true;
} //ei
return false;
-----------------------htm file to launch------------------------------
<html>
<head>
<title>R
</title>
</head>
<body>
<h3>
<center>
R
</center>
</h3>
I
<b>
</b>
<table border = 1>
<td>De<td>Test List<tr>
<td>N <td><tr>
<td>N <td><tr>
</table>
<b>view </b>
<applet code="Box.class" CODEBASE=. width=1000 height=600
ALT="Test ">
<param name=edges value="http:xxabc.htm-http:xxnet.htm,http:xxthis.htm-http:xx.comet.htm,http:xxnewsighting.htm-http:xxstar.htm,http:xxmoon.htm-http:xxNeptune.htm">
<hr>
</applet>
</b>
<p>
<table border = 1>
<tr>
<tr>
</table>
</html>
</body>
instructions to compile :
0 : The discussion becomes easy to follow after 1st compiling
& viewing the applet.
1. : cut out applet code.
2. : the post somehow deleted all references to "" <--- HERE
see, the data has been deleted again as I preview this post.
( that "" should contain an "i" array increment argument:
"open square bracket" "i" "close square bracket" ) array
so "javac Box.java" will get 10 errors. These "[" "i" "]"
array args must be replaced to compile the code.
3. : All array variables inside the 10 "for" loops ( the bare words
"edges" and "nodes" ) without array increment "i" should
read "edges" "[" "i" "]" & "nodes" "[" "i" "]".
The 10 location lines are approx:
line #65, #129, #136, #149, #195, #283, #311, #331, #477, #522
4. : These 10 edits reqresent a missing "i" to all 10 for loop arrays.
for eddges & nodes. fix this & javac Box.java" will get
4 class files.
5. : cut "Box.htm" from post & do "appletviewer Box.htm"
or put in an apache "htdoc" or tomcat "servlet" http delivered
directory & call "http://localhost/Box.htm.
6. : of course, selecting the event button "NewUrl" will not
work in appletviewer but will work in an http web location.
7. : post your questions to problem or fixes to problem as I'm
monitoring closely. TIA.

Thanks for code post tip to fix array deletion problem.
Here is code reposted using delimiters with will
compile straight out of cut/paste.import java.net.MalformedURLException;
import java.net.URL;
import java.net.*;
import java.util.*;
import java.awt.*;
import java.applet.Applet;
import java.applet.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.*;
class Node {
double x;
double y;
double dx;
double dy;
boolean fixed;
String lbl;
class Edge {
int from;
int to;
double len;
} // eEdgeCla
class GraphPanel extends Panel implements Runnable {
Box box;
int nnodes;
Node nodes[] = new Node[100];
int nedges;
Edge edges[] = new Edge[200];
Thread relaxer;
boolean showit;
boolean random;
GraphPanel(Box box) {
this.box = box;
} //ebox
int findNode(String lbl) {
for (int i = 0 ; i < nnodes ; i++) {
//if (nodes.lbl.equals(lbl)) {
if (nodes.lbl.equals(lbl)) {
return i;
return addNode(lbl);
int addNode(String lbl) {
Node n = new Node();
n.x = 10 + 380*Math.random();
n.y = 10 + 380*Math.random();
n.lbl = lbl;
nodes[nnodes] = n;
return nnodes++;
void addEdge(String from, String to, int len) {
Edge e = new Edge();
e.from = findNode(from);
e.to = findNode(to);
e.len = len;
edges[nedges++] = e;
public void run() {
int i3=0;
while (true) {
relax();
if (random && (Math.random() < 0.03)) {
Node n = nodes[(int) (1 * nnodes) ]; // no
if (!n.fixed) {
n.x += (100*0.02) - 50;
n.y += (100*0.02) - 50; //
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
break;
i3++;
} //ew
} // epublrun()
synchronized void relax() {
for (int i = 0 ; i < nedges ; i++) {
//Edge e = edges;
Edge e = edges[i];
double vx = nodes[e.to].x - nodes[e.from].x;
double vy = nodes[e.to].y - nodes[e.from].y;
double len = Math.sqrt(vx * vx + vy * vy);
//double f = (edges.len - len) / (len * 3) ;
double f = (edges[i].len - len) / (len * 3) ;
double dx = f * vx;
double dy = f * vy;
nodes[e.to].dx += dx;
nodes[e.to].dy += dy;
nodes[e.from].dx += -dx;
nodes[e.from].dy += -dy;
} //efo
for (int i = 0 ; i < nnodes ; i++) {
//Node n1 = nodes[i];
Node n1 = nodes[i];
double dx = 0;
double dy = 0;
for (int j = 0 ; j < nnodes ; j++) {
if (i == j) {
continue;
Node n2 = nodes[j];
double vx = n1.x - n2.x;
double vy = n1.y - n2.y;
double len = vx * vx + vy * vy;
if (len == 0) {
dx += 0.02;
dy += 0.02;
} else if (len < 100*100) {
dx += vx / len;
dy += vy / len;
} //ef3a
double dlen = dx * dx + dy * dy;
if (dlen > 0) {
dlen = Math.sqrt(dlen) / 2;
n1.dx += dx / dlen;
n1.dy += dy / dlen;
} //ef3
Dimension d = size();
// f4
for (int i = 0 ; i < nnodes ; i++) {
//Node n = nodes;
Node n = nodes[i];
if (!n.fixed) {
n.x += Math.max(-5, Math.min(5, n.dx));
n.y += Math.max(-5, Math.min(5, n.dy));
if (n.x < 0) {
n.x = 0;
} else if (n.x > d.width) {
n.x = d.width;
if (n.y < 0) {
n.y = 0;
} else if (n.y > d.height) {
n.y = d.height;
n.dx /= 2;
n.dy /= 2;
repaint();
Node pick;
boolean pickfixed;
Image offscreen;
Dimension offscreensize;
Graphics offgraphics;
final Color fixedColor = Color.green;
final Color selectColor = Color.gray;
final Color edgeColor = Color.black;
final Color nodeColor = new Color(200, 90, 50);
final Color showitColor = Color.gray;
final Color arcColor1 = Color.black;
final Color arcColor2 = Color.orange;
final Color arcColor3 = Color.blue;
public void paintNode( Graphics g, Node n, FontMetrics fm) {
int x = (int)n.x;
int y = (int)n.y;
g.setColor((n == pick) ? selectColor : (n.fixed ? fixedColor : nodeColor));
int w = fm.stringWidth(n.lbl) + 10;
int h = fm.getHeight() + 4;
g.fillRect(x - w/2, y - h / 2, w, h);
g.setColor(Color.black);
g.drawRect(x - w/2, y - h / 2, w-1, h-1);
String doit = n.lbl.replace('x','/');
g.drawString(doit, x - (w-10)/2, (y - (h-4)/2) + fm.getAscent());
} // epa
public synchronized void update(Graphics g) {
Dimension d = size();
if ((offscreen == null) || (d.width != offscreensize.width) || (d.height != offscreensize.height)) {
offscreen = createImage(d.width, d.height);
offscreensize = d;
offgraphics = offscreen.getGraphics();
offgraphics.setFont(getFont());
offgraphics.setColor(getBackground());
offgraphics.fillRect(0, 0, d.width, d.height);
for (int i = 0 ; i < nedges ; i++) {
//Edge e = edges;
Edge e = edges[i];
int x1 = (int)nodes[e.from].x;
int y1 = (int)nodes[e.from].y;
int x2 = (int)nodes[e.to].x;
int y2 = (int)nodes[e.to].y;
int len = (int)Math.abs(Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) - e.len);
offgraphics.setColor((len < 10) ? arcColor1 : (len < 20 ? arcColor2 : arcColor3)) ;
offgraphics.drawLine(x1, y1, x2, y2);
if (showit) {
String lbl = String.valueOf(len);
offgraphics.setColor(showitColor);
offgraphics.drawString("href= http://localhost:"+lbl, x1 + (x2-x1)/2, y1 + (y2-y1)/2);
offgraphics.setColor(edgeColor);
} //ef5
FontMetrics fm = offgraphics.getFontMetrics();
for (int i = 0 ; i < nnodes ; i++) {
//paintNode( offgraphics, nodes, fm); //or
paintNode( offgraphics, nodes[i], fm); //or
g.drawImage(offscreen, 0, 0, null);
public synchronized boolean mouseDown(Event evt, int x, int y) {
double bestdist = Double.MAX_VALUE;
for (int i = 0 ; i < nnodes ; i++) {
//Node n = nodes;
Node n = nodes[i];
double dist = (n.x - x) * (n.x - x) + (n.y - y) * (n.y - y);
if (dist < bestdist) {
pick = n;
bestdist = dist;
pickfixed = pick.fixed;
pick.fixed = true;
pick.x = x;
pick.y = y;
repaint();
return true;
public synchronized boolean mouseDrag(Event evt, int x, int y) {
pick.x = x;
pick.y = y;
repaint();
return true;
} //e-pubsyncmousedrag
public synchronized boolean mouseUp(Event evt, int x, int y) {
pick.x = x;
pick.y = y;
pick.fixed = pickfixed;
pick = null;
repaint();
return true;
public void start() {
relaxer = new Thread(this);
relaxer.start();
public void stop() {
relaxer.stop();
public class Box extends Applet {
GraphPanel panel;
public void init() {
setLayout(new BorderLayout());
panel = new GraphPanel(this);
add("Center", panel);
Panel p = new Panel();
add("South", p);
p.add(new Button("Reposition"));
p.add(new Button("NewUrl"));
p.add(new Checkbox("Showit"));
String edges = getParameter("edges"); // putinli
for (StringTokenizer t = new StringTokenizer(edges, ",") ; t.hasMoreTokens() ; ) {
String str = t.nextToken();
int i = str.indexOf('-');
if (i > 0) { int len = 50;
int j = str.indexOf('/');
if (j > 0) {
len = Integer.valueOf(str.substring(j+1)).intValue();
str = str.substring(0, j);
panel.addEdge(str.substring(0,i), str.substring(i+1), len);
} //ef8
Dimension d = size();
String center = getParameter("center");
if (center != null){
Node n = panel.nodes[panel.findNode(center)];
n.x = d.width / 2;
n.y = d.height / 2;
n.fixed = true;
} // eif
} // ep
public void start() {
panel.start();
public void stop() {
panel.stop();
public boolean action(Event evt, Object arg) {
if (arg instanceof Boolean) {
if (((Checkbox)evt.target).getLabel().equals("Showit")) {
panel.showit = ((Boolean)arg).booleanValue();
}// e-
else {
panel.random = ((Boolean)arg).booleanValue();
return true;
} // e-if instof bool
if ("Reposition".equals(arg)) {
Dimension d = size();
for (int i = 0 ; i < panel.nnodes ; i++) {
//Node n = panel.nodes;
Node n = panel.nodes[i];
if (!n.fixed) {
n.x = 10 + (d.width-20)*Math.random();
n.y = 10 + (d.height-20)*Math.random();
} //ei
} //ef9
return true;
} //eif scram
if ("NewUrl".equals(arg)) {
Dimension d = size();
URL url = getCodeBase();
try {
getAppletContext().showDocument( new URL(url+"main.htm"), "_blank" );
try {
Thread.sleep(1000);
} catch (InterruptedException e) { }
} catch(MalformedURLException e) {
showStatus("814 URL not found");
for (int i = 0 ; i < panel.nnodes ; i++) {
//Node n = panel.nodes;
Node n = panel.nodes[i];
if (!n.fixed) {
n.x += (80*0.02) - 40;
n.y += (80*0.02) - 40;
return true;
} //ei
return false;

Similar Messages

  • Floating "boxes" applet with drag events need ckick events

    I Have an applet cobbled from the net & modified. Is works but needs one major event added. It draws "Graphics.drawline" boxes with a text "String" inside each box ( the text string represents an URL location). These "boxes" are objects which are "draggable to other locations on canvas & therefore can be independently positioned by user. Each box redraws itself periodically to a slightly different screen location & becomes stationary after a 5 or 6 seconds. The point is, all of this "drag & mobility" behavior must remain intact & is not part of the "problem task".
    Task: Need to have an "event" behavior added in one of two ways ( or a 3rd way if there is another ) whichever is quickest/ easiest. "Clickable mouse events" must be added to each box. ( boxes are built in a loop so adding to one will add to other locations & create as many "buttons" as there are boxes) . At each box's location, clicking one box should be an event which fires & clicking a different box should be a separate event which fires. Separate , so that URL location can be "hotlinked" to each box. That URL is currently displayed in the boxes (visible when running applet).
    1st possible solution: Exchange these "boxes" which appear on canvas into clickable event "Graph panel.buttons" ( for example or some other clickable object) which maintains existing "drag" behavior of boxes. These buttons must each have "clickability" with mouse events to enable placing "getAppletContext. showDocument()" code with these events ( e.g., "hotlinked" to http locations).
    or
    2nd possible solution:. The drawstring boxes are currently dead string text with no event model other than the "drag" feature associated with each box. Must add an additional mouse event behavior to existing boxes so they are "clickable" ( or text inside is clickable) and can then execute "showDocument()" URL when clicked independently.
    Maybe there is a #3. I don't know what that would be. Open to try anything without losing the drag & placement mobility of existing boxes.
    These "boxes" could be images, or event buttons - doesnt matter.
    Not sure if #2 is possible & have not been able to accomplish #1. Must stay within existing AWT framework so IE browsers can run it natively ( which of course IE cannot run Swing graphics unless a Sun plugin loaded ).
    Applet is a single file ( creating 4 classes).
    html file (which invokes it) passes a string param which is broken into above noted URL strings in each box.
    Running this applet, you see a "button" event ( at base of canvas labeled "NewUrl" ) which pops up an url location when clicked ( using "showdocument"). This button is not attached to locations or text of each box object ( which is the "task" to accomplish) . The button does represent the kind of event behavior which each "box" should have when task is achieved. So the box can be exchanged with buttons or the boxes can be imbued with events to hyperlink like a button.
    In spirit of solution #1, here is the bonehead attempt I tried which did not work: copied entire "if" block of logic from the button event (sited in preceding paragraph) into region of code which builds boxes ( "for" loop of "drawstring" method).
    "g.drawString(doit, x - (w-10)/2, (y - (h-4)/2) + fm.getAscent());"
    I copied all the "if" block of logic for button creation into the area immediately after the above line ( for loop which builds the boxes). Hoping that I could create buttons with events, along with all the boxes (which are getting created using "drawstring" above in a "for" loop). These "buttons" must also have positioning info of each box to appear in different locations on the canvas. Positioning data is not in that "if" block of code but it would have been a start to get the multiple buttons created ( even if all drawn in one spot). The "if" code block I've provieded for an example begins with the line:
    " if ("NewUrl".equals(arg)) { "
    and ends with with lines:
    " return true; "
    " } " //< -- end of above if block
    This full "if" block can be seen in the listing below:
    This "if" block creates the "NewUrl" button. Of course, I got a bunch of errors when I tried to copy this block to the above location:
    variable: "arg" "not found in class GraphPanel".
    methods: "getcodebase, showstatus, getappletcontext()"
    "not found in class GraphPanel".
    ----------- The applet code in total follows next
    Here are both the java & htm complete source.
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.*;
    import java.util.*;
    import java.awt.*;
    import java.applet.Applet;
    import java.applet.*;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.event.*;
    class Node {
    double x;
    double y;
    double dx;
    double dy;
    boolean fixed;
    String lbl;
    class Edge {
    int from;
    int to;
    double len;
    } // eEdgeCla
    class GraphPanel extends Panel implements Runnable {
    Box box;
    int nnodes;
    Node nodes[] = new Node[100];
    int nedges;
    Edge edges[] = new Edge[200];
    Thread relaxer;
    boolean showit;
    boolean random;
    GraphPanel(Box box) {
    this.box = box;
    } //ebox
    int findNode(String lbl) {
    for (int i = 0 ; i < nnodes ; i++) {
    if (nodes.lbl.equals(lbl)) {
    return i;
    return addNode(lbl);
    int addNode(String lbl) {
    Node n = new Node();
    n.x = 10 + 380*Math.random();
    n.y = 10 + 380*Math.random();
    n.lbl = lbl;
    nodes[nnodes] = n;
    return nnodes++;
    void addEdge(String from, String to, int len) {
    Edge e = new Edge();
    e.from = findNode(from);
    e.to = findNode(to);
    e.len = len;
    edges[nedges++] = e;
    public void run() {
    int i3=0;
    while (true) {
    relax();
    if (random && (Math.random() < 0.03)) {
    Node n = nodes[(int) (1 * nnodes) ]; // no
    if (!n.fixed) {
    n.x += (100*0.02) - 50;
    n.y += (100*0.02) - 50; //
    try {
    Thread.sleep(4000);
    } catch (InterruptedException e) {
    break;
    i3++;
    } //ew
    } // epublrun()
    synchronized void relax() {
    for (int i = 0 ; i < nedges ; i++) {
    Edge e = edges;
    double vx = nodes[e.to].x - nodes[e.from].x;
    double vy = nodes[e.to].y - nodes[e.from].y;
    double len = Math.sqrt(vx * vx + vy * vy);
    double f = (edges.len - len) / (len * 3) ;
    double dx = f * vx;
    double dy = f * vy;
    nodes[e.to].dx += dx;
    nodes[e.to].dy += dy;
    nodes[e.from].dx += -dx;
    nodes[e.from].dy += -dy;
    } //efo
    for (int i = 0 ; i < nnodes ; i++) {
    Node n1 = nodes;
    double dx = 0;
    double dy = 0;
    for (int j = 0 ; j < nnodes ; j++) {
    if (i == j) {
    continue;
    Node n2 = nodes[j];
    double vx = n1.x - n2.x;
    double vy = n1.y - n2.y;
    double len = vx * vx + vy * vy;
    if (len == 0) {
    dx += 0.02;
    dy += 0.02;
    } else if (len < 100*100) {
    dx += vx / len;
    dy += vy / len;
    } //ef3a
    double dlen = dx * dx + dy * dy;
    if (dlen > 0) {
    dlen = Math.sqrt(dlen) / 2;
    n1.dx += dx / dlen;
    n1.dy += dy / dlen;
    } //ef3
    Dimension d = size();
    // f4
    for (int i = 0 ; i < nnodes ; i++) {
    Node n = nodes;
    if (!n.fixed) {
    n.x += Math.max(-5, Math.min(5, n.dx));
    n.y += Math.max(-5, Math.min(5, n.dy));
    if (n.x < 0) {
    n.x = 0;
    } else if (n.x > d.width) {
    n.x = d.width;
    if (n.y < 0) {
    n.y = 0;
    } else if (n.y > d.height) {
    n.y = d.height;
    n.dx /= 2;
    n.dy /= 2;
    repaint();
    Node pick;
    boolean pickfixed;
    Image offscreen;
    Dimension offscreensize;
    Graphics offgraphics;
    final Color fixedColor = Color.green;
    final Color selectColor = Color.gray;
    final Color edgeColor = Color.black;
    final Color nodeColor = new Color(200, 90, 50);
    final Color showitColor = Color.gray;
    final Color arcColor1 = Color.black;
    final Color arcColor2 = Color.orange;
    final Color arcColor3 = Color.blue;
    public void paintNode( Graphics g, Node n, FontMetrics fm) {
    int x = (int)n.x;
    int y = (int)n.y;
    g.setColor((n == pick) ? selectColor : (n.fixed ? fixedColor : nodeColor));
    int w = fm.stringWidth(n.lbl) + 10;
    int h = fm.getHeight() + 4;
    g.fillRect(x - w/2, y - h / 2, w, h);
    g.setColor(Color.black);
    g.drawRect(x - w/2, y - h / 2, w-1, h-1);
    String doit = n.lbl.replace('x','/');
    g.drawString(doit, x - (w-10)/2, (y - (h-4)/2) + fm.getAscent());
    } // epa
    public synchronized void update(Graphics g) {
    Dimension d = size();
    if ((offscreen == null) || (d.width != offscreensize.width) || (d.height != offscreensize.height)) {
    offscreen = createImage(d.width, d.height);
    offscreensize = d;
    offgraphics = offscreen.getGraphics();
    offgraphics.setFont(getFont());
    offgraphics.setColor(getBackground());
    offgraphics.fillRect(0, 0, d.width, d.height);
    for (int i = 0 ; i < nedges ; i++) {
    Edge e = edges;
    int x1 = (int)nodes[e.from].x;
    int y1 = (int)nodes[e.from].y;
    int x2 = (int)nodes[e.to].x;
    int y2 = (int)nodes[e.to].y;
    int len = (int)Math.abs(Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) - e.len);
    offgraphics.setColor((len < 10) ? arcColor1 : (len < 20 ? arcColor2 : arcColor3)) ;
    offgraphics.drawLine(x1, y1, x2, y2);
    if (showit) {
    String lbl = String.valueOf(len);
    offgraphics.setColor(showitColor);
    offgraphics.drawString("href= http://localhost:"+lbl, x1 + (x2-x1)/2, y1 + (y2-y1)/2);
    offgraphics.setColor(edgeColor);
    } //ef5
    FontMetrics fm = offgraphics.getFontMetrics();
    for (int i = 0 ; i < nnodes ; i++) {
    paintNode( offgraphics, nodes, fm); //or
    g.drawImage(offscreen, 0, 0, null);
    public synchronized boolean mouseDown(Event evt, int x, int y) {
    double bestdist = Double.MAX_VALUE;
    for (int i = 0 ; i < nnodes ; i++) {
    Node n = nodes;
    double dist = (n.x - x) * (n.x - x) + (n.y - y) * (n.y - y);
    if (dist < bestdist) {
    pick = n;
    bestdist = dist;
    pickfixed = pick.fixed;
    pick.fixed = true;
    pick.x = x;
    pick.y = y;
    repaint();
    return true;
    public synchronized boolean mouseDrag(Event evt, int x, int y) {
    pick.x = x;
    pick.y = y;
    repaint();
    return true;
    } //e-pubsyncmousedrag
    public synchronized boolean mouseUp(Event evt, int x, int y) {
    pick.x = x;
    pick.y = y;
    pick.fixed = pickfixed;
    pick = null;
    repaint();
    return true;
    public void start() {
    relaxer = new Thread(this);
    relaxer.start();
    public void stop() {
    relaxer.stop();
    public class Box extends Applet {
    GraphPanel panel;
    public void init() {
    setLayout(new BorderLayout());
    panel = new GraphPanel(this);
    add("Center", panel);
    Panel p = new Panel();
    add("South", p);
    p.add(new Button("Reposition"));
    p.add(new Button("NewUrl"));
    p.add(new Checkbox("Showit"));
    String edges = getParameter("edges"); // putinli
    for (StringTokenizer t = new StringTokenizer(edges, ",") ; t.hasMoreTokens() ; ) {
    String str = t.nextToken();
    int i = str.indexOf('-');
    if (i > 0) { int len = 50;
    int j = str.indexOf('/');
    if (j > 0) {
    len = Integer.valueOf(str.substring(j+1)).intValue();
    str = str.substring(0, j);
    panel.addEdge(str.substring(0,i), str.substring(i+1), len);
    } //ef8
    Dimension d = size();
    String center = getParameter("center");
    if (center != null){
    Node n = panel.nodes[panel.findNode(center)];
    n.x = d.width / 2;
    n.y = d.height / 2;
    n.fixed = true;
    } // eif
    } // ep
    public void start() {
    panel.start();
    public void stop() {
    panel.stop();
    public boolean action(Event evt, Object arg) {
    if (arg instanceof Boolean) {
    if (((Checkbox)evt.target).getLabel().equals("Showit")) {
    panel.showit = ((Boolean)arg).booleanValue();
    }// e-
    else {
    panel.random = ((Boolean)arg).booleanValue();
    return true;
    } // e-if instof bool
    if ("Reposition".equals(arg)) {
    Dimension d = size();
    for (int i = 0 ; i < panel.nnodes ; i++) {
    Node n = panel.nodes;
    if (!n.fixed) {
    n.x = 10 + (d.width-20)*Math.random();
    n.y = 10 + (d.height-20)*Math.random();
    } //ei
    } //ef9
    return true;
    } //eif scram
    if ("NewUrl".equals(arg)) {
    Dimension d = size();
    URL url = getCodeBase();
    try {
    getAppletContext().showDocument( new URL(url+"main.htm"), "_blank" );
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e) { }
    } catch(MalformedURLException e) {
    showStatus("814 URL not found");
    for (int i = 0 ; i < panel.nnodes ; i++) {
    Node n = panel.nodes;
    if (!n.fixed) {
    n.x += (80*0.02) - 40;
    n.y += (80*0.02) - 40;
    return true;
    } //ei
    return false;
    -----------------------htm file to launch------------------------------
    <html>
    <head>
    <title>R
    </title>
    </head>
    <body>
    <h3>
    <center>
    R
    </center>
    </h3>
    I
    <b>
    </b>
    <table border = 1>
    <td>De<td>Test List<tr>
    <td>N <td><tr>
    <td>N <td><tr>
    </table>
    <b>view </b>
    <applet code="Box.class" CODEBASE=. width=1000 height=600
    ALT="Test ">
    <param name=edges value="http:xxabc.htm-http:xxnet.htm,http:xxthis.htm-http:xx.comet.htm,http:xxnewsighting.htm-http:xxstar.htm,http:xxmoon.htm-http:xxNeptune.htm">
    <hr>
    </applet>
    </b>
    <p>
    <table border = 1>
    <tr>
    <tr>
    </table>
    </html>
    </body>
    instructions to compile :
    0 : The discussion becomes easy to follow after 1st compiling
    & viewing the applet.
    1. : cut out applet code.
    2. : the post somehow deleted all references to "" <--- HERE
    see, the data has been deleted again as I preview this post.
    ( that "" should contain an "i" array increment argument:
    "open square bracket" "i" "close square bracket" ) array
    so "javac Box.java" will get 10 errors. These "[" "i" "]"
    array args must be replaced to compile the code.
    3. : All array variables inside the 10 "for" loops ( the bare words
    "edges" and "nodes" ) without array increment "i" should
    read "edges" "[" "i" "]" & "nodes" "[" "i" "]".
    The 10 location lines are approx:
    line #65, #129, #136, #149, #195, #283, #311, #331, #477, #522
    4. : These 10 edits reqresent a missing "i" to all 10 for loop arrays.
    for eddges & nodes. fix this & javac Box.java" will get
    4 class files.
    5. : cut "Box.htm" from post & do "appletviewer Box.htm"
    or put in an apache "htdoc" or tomcat "servlet" http delivered
    directory & call "http://localhost/Box.htm.
    6. : of course, selecting the event button "NewUrl" will not
    work in appletviewer but will work in an http web location.
    7. : post your questions to problem or fixes to problem as I'm
    monitoring closely. TIA.

    Thanks for code post tip to fix array index deletion problem.
    Here is code reposted using "code" delimiters which will
    compile straight out of cut/paste.
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.*;
    import java.util.*;
    import java.awt.*;
    import java.applet.Applet;
    import java.applet.*;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.event.*;
    class Node {
    double x;
    double y;
    double dx;
    double dy;
    boolean fixed;
    String lbl;
    class Edge {
    int from;
    int to;
    double len;
    } // eEdgeCla
    class GraphPanel extends Panel implements Runnable {
    Box box;
    int nnodes;
    Node nodes[] = new Node[100];
    int nedges;
    Edge edges[] = new Edge[200];
    Thread relaxer;
    boolean showit;
    boolean random;
    GraphPanel(Box box) {
    this.box = box;
    } //ebox
    int findNode(String lbl) {
    for (int i = 0 ; i < nnodes ; i++) {
    //if (nodes.lbl.equals(lbl)) {
      if (nodes.lbl.equals(lbl)) {
    return i;
    return addNode(lbl);
    int addNode(String lbl) {
    Node n = new Node();
    n.x = 10 + 380*Math.random();
    n.y = 10 + 380*Math.random();
    n.lbl = lbl;
    nodes[nnodes] = n;
    return nnodes++;
    void addEdge(String from, String to, int len) {
    Edge e = new Edge();
    e.from = findNode(from);
    e.to = findNode(to);
    e.len = len;
    edges[nedges++] = e;
    public void run() {
    int i3=0;
    while (true) {
    relax();
    if (random && (Math.random() < 0.03)) {
    Node n = nodes[(int) (1 * nnodes) ]; // no
    if (!n.fixed) {
    n.x += (100*0.02) - 50;
    n.y += (100*0.02) - 50; //
    try {
    Thread.sleep(4000);
    } catch (InterruptedException e) {
    break;
    i3++;
    } //ew
    } // epublrun()
    synchronized void relax() {
    for (int i = 0 ; i < nedges ; i++) {
    //Edge e = edges;
    Edge e = edges[i];
    double vx = nodes[e.to].x - nodes[e.from].x;
    double vy = nodes[e.to].y - nodes[e.from].y;
    double len = Math.sqrt(vx * vx + vy * vy);
    //double f = (edges.len - len) / (len * 3) ;
    double f = (edges[i].len - len) / (len * 3) ;
    double dx = f * vx;
    double dy = f * vy;
    nodes[e.to].dx += dx;
    nodes[e.to].dy += dy;
    nodes[e.from].dx += -dx;
    nodes[e.from].dy += -dy;
    } //efo
    for (int i = 0 ; i < nnodes ; i++) {
    //Node n1 = nodes[i];
    Node n1 = nodes[i];
    double dx = 0;
    double dy = 0;
    for (int j = 0 ; j < nnodes ; j++) {
    if (i == j) {
    continue;
    Node n2 = nodes[j];
    double vx = n1.x - n2.x;
    double vy = n1.y - n2.y;
    double len = vx * vx + vy * vy;
    if (len == 0) {
    dx += 0.02;
    dy += 0.02;
    } else if (len < 100*100) {
    dx += vx / len;
    dy += vy / len;
    } //ef3a
    double dlen = dx * dx + dy * dy;
    if (dlen > 0) {
    dlen = Math.sqrt(dlen) / 2;
    n1.dx += dx / dlen;
    n1.dy += dy / dlen;
    } //ef3
    Dimension d = size();
    // f4
    for (int i = 0 ; i < nnodes ; i++) {
    //Node n = nodes;
    Node n = nodes[i];
    if (!n.fixed) {
    n.x += Math.max(-5, Math.min(5, n.dx));
    n.y += Math.max(-5, Math.min(5, n.dy));
    if (n.x < 0) {
    n.x = 0;
    } else if (n.x > d.width) {
    n.x = d.width;
    if (n.y < 0) {
    n.y = 0;
    } else if (n.y > d.height) {
    n.y = d.height;
    n.dx /= 2;
    n.dy /= 2;
    repaint();
    Node pick;
    boolean pickfixed;
    Image offscreen;
    Dimension offscreensize;
    Graphics offgraphics;
    final Color fixedColor = Color.green;
    final Color selectColor = Color.gray;
    final Color edgeColor = Color.black;
    final Color nodeColor = new Color(200, 90, 50);
    final Color showitColor = Color.gray;
    final Color arcColor1 = Color.black;
    final Color arcColor2 = Color.orange;
    final Color arcColor3 = Color.blue;
    public void paintNode( Graphics g, Node n, FontMetrics fm) {
    int x = (int)n.x;
    int y = (int)n.y;
    g.setColor((n == pick) ? selectColor : (n.fixed ? fixedColor : nodeColor));
    int w = fm.stringWidth(n.lbl) + 10;
    int h = fm.getHeight() + 4;
    g.fillRect(x - w/2, y - h / 2, w, h);
    g.setColor(Color.black);
    g.drawRect(x - w/2, y - h / 2, w-1, h-1);
    String doit = n.lbl.replace('x','/');
    g.drawString(doit, x - (w-10)/2, (y - (h-4)/2) + fm.getAscent());
    } // epa
    public synchronized void update(Graphics g) {
    Dimension d = size();
    if ((offscreen == null) || (d.width != offscreensize.width) || (d.height != offscreensize.height)) {
    offscreen = createImage(d.width, d.height);
    offscreensize = d;
    offgraphics = offscreen.getGraphics();
    offgraphics.setFont(getFont());
    offgraphics.setColor(getBackground());
    offgraphics.fillRect(0, 0, d.width, d.height);
    for (int i = 0 ; i < nedges ; i++) {
    //Edge e = edges;
    Edge e = edges[i];
    int x1 = (int)nodes[e.from].x;
    int y1 = (int)nodes[e.from].y;
    int x2 = (int)nodes[e.to].x;
    int y2 = (int)nodes[e.to].y;
    int len = (int)Math.abs(Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) - e.len);
    offgraphics.setColor((len < 10) ? arcColor1 : (len < 20 ? arcColor2 : arcColor3)) ;
    offgraphics.drawLine(x1, y1, x2, y2);
    if (showit) {
    String lbl = String.valueOf(len);
    offgraphics.setColor(showitColor);
    offgraphics.drawString("href= http://localhost:"+lbl, x1 + (x2-x1)/2, y1 + (y2-y1)/2);
    offgraphics.setColor(edgeColor);
    } //ef5
    FontMetrics fm = offgraphics.getFontMetrics();
    for (int i = 0 ; i < nnodes ; i++) {
    //paintNode( offgraphics, nodes, fm); //or
    paintNode( offgraphics, nodes[i], fm); //or
    g.drawImage(offscreen, 0, 0, null);
    public synchronized boolean mouseDown(Event evt, int x, int y) {
    double bestdist = Double.MAX_VALUE;
    for (int i = 0 ; i < nnodes ; i++) {
    //Node n = nodes;
    Node n = nodes[i];
    double dist = (n.x - x) * (n.x - x) + (n.y - y) * (n.y - y);
    if (dist < bestdist) {
    pick = n;
    bestdist = dist;
    pickfixed = pick.fixed;
    pick.fixed = true;
    pick.x = x;
    pick.y = y;
    repaint();
    return true;
    public synchronized boolean mouseDrag(Event evt, int x, int y) {
    pick.x = x;
    pick.y = y;
    repaint();
    return true;
    } //e-pubsyncmousedrag
    public synchronized boolean mouseUp(Event evt, int x, int y) {
    pick.x = x;
    pick.y = y;
    pick.fixed = pickfixed;
    pick = null;
    repaint();
    return true;
    public void start() {
    relaxer = new Thread(this);
    relaxer.start();
    public void stop() {
    relaxer.stop();
    public class Box extends Applet {
    GraphPanel panel;
    public void init() {
    setLayout(new BorderLayout());
    panel = new GraphPanel(this);
    add("Center", panel);
    Panel p = new Panel();
    add("South", p);
    p.add(new Button("Reposition"));
    p.add(new Button("NewUrl"));
    p.add(new Checkbox("Showit"));
    String edges = getParameter("edges"); // putinli
    for (StringTokenizer t = new StringTokenizer(edges, ",") ; t.hasMoreTokens() ; ) {
    String str = t.nextToken();
    int i = str.indexOf('-');
    if (i > 0) { int len = 50;
    int j = str.indexOf('/');
    if (j > 0) {
    len = Integer.valueOf(str.substring(j+1)).intValue();
    str = str.substring(0, j);
    panel.addEdge(str.substring(0,i), str.substring(i+1), len);
    } //ef8
    Dimension d = size();
    String center = getParameter("center");
    if (center != null){
    Node n = panel.nodes[panel.findNode(center)];
    n.x = d.width / 2;
    n.y = d.height / 2;
    n.fixed = true;
    } // eif
    } // ep
    public void start() {
    panel.start();
    public void stop() {
    panel.stop();
    public boolean action(Event evt, Object arg) {
    if (arg instanceof Boolean) {
    if (((Checkbox)evt.target).getLabel().equals("Showit")) {
    panel.showit = ((Boolean)arg).booleanValue();
    }// e-
    else {
    panel.random = ((Boolean)arg).booleanValue();
    return true;
    } // e-if instof bool
    if ("Reposition".equals(arg)) {
    Dimension d = size();
    for (int i = 0 ; i < panel.nnodes ; i++) {
    //Node n = panel.nodes;
    Node n = panel.nodes[i];
    if (!n.fixed) {
    n.x = 10 + (d.width-20)*Math.random();
    n.y = 10 + (d.height-20)*Math.random();
    } //ei
    } //ef9
    return true;
    } //eif scram
    if ("NewUrl".equals(arg)) {
    Dimension d = size();
    URL url = getCodeBase();
    try {
    getAppletContext().showDocument( new URL(url+"main.htm"), "_blank" );
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e) { }
    } catch(MalformedURLException e) {
    showStatus("814 URL not found");
    for (int i = 0 ; i < panel.nnodes ; i++) {
    //Node n = panel.nodes;
    Node n = panel.nodes[i];
    if (!n.fixed) {
    n.x += (80*0.02) - 40;
    n.y += (80*0.02) - 40;
    return true;
    } //ei
    return false;

  • TS4040 I assumed this would help my problem with not being able to open apps like Preview or TextEdit since I installed Mountain Lion. Instead, first I'm prompted to enter a password, then once I do that, I get an error box telling me the Library needs re

    I assumed this would help my problem with not being able to open apps like Preview or TextEdit since I installed Mountain Lion. Instead, first I'm prompted to enter a password, then once I do that, I get an error box telling me the Library needs repairing. So I click on Repair, and once again I'm prompted for a password, which I enter, then the same error box opens, and so it goes. Can anyone help me with this problem? I'd greatly appreciate it.
    Thor

    Back up all data. Don't continue unless you're sure you can restore from a backup, even if you're unable to log in.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -Rh $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    Step 1 should give you usable permissions in your home folder. This step will restore special attributes set by OS X on some user folders to protect them from unintended deletion or renaming. You can skip this step if you don't consider that protection to be necessary, and if everything is working as expected after step 1.
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not  going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • GL floating boxes with rollovers

    I'm working on a project that is similar to a target--bullseye in center with rings around it. I have created the text/phrases that go in each ring in Illustrator and put the whole thing together in a layered PS file. No problems yet, but when I separate all of the text/phrase into images with 2 states for the rollover and put them into GL floating boxes, the boxes overlap in some area so the mouseover rollover doesn't always work. For example, mouseover one text image and another one will show the color change rollover because the mouse is really over an area of the image that is transparent. Is the only way around this to re-arrange the box z-index to try to avoid the overlap or is there some way that I am missing? Frustrating!

    Like I said, you can use the Set Image URL action for the rollover. You can set multiple actions to change more than 1 pic on mouse enter if you need to. You won't need any more layers than you currently have, and only the area where you place the image map will be active (rollover won't trigger in transparent areas).
    As for overlib, (I'm not familiar with that) if it's a javascript that's added to your links/rollovers, you can move it to the image maps in the source, it should work fine.

  • Mouse dragged event with unexpected coordinates

    I am dragging the mouse on a half circle from the middle left to the top middle. This results in mouse events with the coordinates form (10,90) ->(100,10)
    Letting the mouse go and then dragging it further to the left, the coordinates in the of the event are similar than the starting point of the first mouse drag event.
    Can anyone shed some light on this peculiar behavior?

    First of, I have to apologize for the example not being as minimalistic as it might be, but on the plus side, I know now why this happens, I just don't know how to work around it.
    * To change this license header, choose License Headers in Project Properties.
    * To change this template file, choose Tools | Templates
    * and open the template in the editor.
    package javafxtest;
    import java.util.ArrayList;
    import javafx.application.Application;
    import javafx.beans.property.DoubleProperty;
    import javafx.beans.property.SimpleDoubleProperty;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Dimension2D;
    import javafx.geometry.Point2D;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.StackPane;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Circle;
    import javafx.scene.shape.Polygon;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.shape.Shape;
    import javafx.scene.transform.Rotate;
    import javafx.stage.Stage;
    * @author andi
    public class HandleRotation extends Application {
        private DoubleProperty currentRotation;
        private ArrayList<Double> angles;
        @Override
        public void start(Stage primaryStage) {
            currentRotation = new SimpleDoubleProperty(this, "currentRotation", 10);
            SteeringWheelGroup background = new SteeringWheelGroup(200);
            background.setManaged(false);
            Group g = new Group(background);
            final Point2D centerPoint = new Point2D(100, 100);
            angles = new ArrayList<>(3);
            angles.add(190.0);
            angles.add(270.0);
            angles.add(350.0);
            double step = (180.0 - 2 * currentRotation.doubleValue()) / (angles.size() - 1);
            int radius = 100;
            final int yTranslation = 15; // might be due to the labels
            Polygon handle = createHandle(centerPoint, radius, yTranslation);
            g.getChildren().add(handle);
            StackPane root = new StackPane();
            Scene scene = new Scene(g, 300, 250);
            primaryStage.setTitle("Handle Rotation!");
            primaryStage.setScene(scene);
            primaryStage.show();
         * Calculate the base point for the label. This is the point on the arc, matching the angle.
         * @param center point of the circle
         * @param radius radius of the circle
         * @param angle in degree in [0,180]
         * @return Point on the circle
        Point2D calculateBasePoint(Point2D center, double radius,
                double angle) {
            float newX = (float) (center.getX() + radius * Math.cos(Math.toRadians(angle)));
            float newY = (float) (center.getY() + radius * Math.sin(Math.toRadians(angle)));
            return new Point2D(newX, newY);
         * Create the polygon that represents the handle
         * @param centerPoint
         * @param radius
         * @return
        private Polygon createHandle(final Point2D centerPoint, int radius, final int yTranslation) {
            double baseAngle = 180;
            Point2D p1 = calculateBasePoint(centerPoint, radius, baseAngle - 5);
            Point2D p2 = calculateBasePoint(centerPoint, radius, baseAngle + 2);
            Point2D p3 = calculateBasePoint(centerPoint, radius*0.65, baseAngle + 2);
            Point2D p4 = calculateBasePoint(centerPoint, radius*0.65, baseAngle - 7);
            double[] points = {p1.getX(), p1.getY(), p2.getX(), p2.getY(), p3.getX(), p3.getY(), p4.getX(), p4.getY()};
                      Polygon polygon = new Polygon(points);
    //        polygon.setOpacity(0);
            polygon.setTranslateY(-yTranslation);
            final Rotate rotationTransform = new Rotate(currentRotation.doubleValue(), centerPoint.getX(), centerPoint.getY());
            polygon.getTransforms().add(rotationTransform);
            polygon.setOnMouseDragged(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent event) {
                    if (event.getY() < centerPoint.getY()) {
    System.out.println("Event: "+event);                   
                                                       Point2D point = new Point2D((float)event.getX(), (float)event.getY());
                        double newAngle = angleBetween2Lines(centerPoint, point);
                        if (newAngle < 0) {
                            newAngle = (90 + newAngle)+ 90;
    System.out.println("Set angle on mouse drag: "+newAngle);
                        if (newAngle < 10) {
                            newAngle = 10;
                        if (newAngle > 170) {
                            newAngle = 170;
                        currentRotation.set(newAngle);
            polygon.setOnMouseReleased(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent event) {
                    snapToNearestAngle();
                    rotationTransform.setAngle(currentRotation.doubleValue());
            return polygon;
         * Snap to the correct angle. Correct angle is angle belonging to the nearest label.
        void snapToNearestAngle() {
            double currentAngle = currentRotation.doubleValue() + 180;
            double currentMin = 360;
            int minIndex = 0;
    System.out.println("Current rotation is "+currentAngle);
            for (int i = 0; i < angles.size(); i++) {
                double angle = angles.get(i);
                double diff = Math.abs(angle - currentAngle);
                if (diff < currentMin) {
                    currentMin = diff;
                    minIndex = i;
    System.out.println("new minDifference at "+i+": "+diff);
            Double destinationAngle = angles.get(minIndex);
    System.out.println("DestinationAngle is "+currentAngle+" -> "+(destinationAngle - 180));
            if (destinationAngle < 180 + 10 || destinationAngle > 360 - 10) {
                throw new IllegalStateException("Angle is out of range: "+currentRotation.doubleValue()+" -> "+destinationAngle);
            currentRotation.set(destinationAngle - 180);
         * Calculate the angle between the vector horizontally to the left from the center
         * and the current point.
         * @param center point
         * @param point current point
         * @return angle in degree
        double angleBetween2Lines(Point2D center, Point2D point) {
            double slope2 = calculateSlope(center, point);
            double angle = Math.atan(slope2);
            if (point.getX() > center.getX()) {
                angle += Math.PI/2;
    System.out.println("Slope: "+slope2+" angle "+Math.toDegrees(angle));
            return Math.abs(Math.toDegrees(angle));
         * Caluculate the slope of the line defined by two points.
         * The first point is the center of a circle and the second
         * point roughly lies on the circle.
         * @param center point
         * @param point on the circle
         * @return slope of the connecting line.
        double calculateSlope(Point2D center, Point2D point) {
    System.out.println("center="+center+",point="+point);       
            double absSlope = Math.abs((point.getY() - center.getY()) / (point.getX() - center.getX()));
            if (point.getY() > center.getY()) {
                if (point.getX() > center.getX()) {
                    // bottom right
                    return -absSlope;
                } else {
                    // bottom left
                    return absSlope;
            } else {
                if (point.getX() > center.getX()) {
                    // top right
                    return absSlope;
                } else {
                    // top left
                    return -absSlope;
         * The main() method is ignored in correctly deployed JavaFX application.
         * main() serves only as fallback in case the application can not be
         * launched through deployment artifacts, e.g., in IDEs with limited FX
         * support. NetBeans ignores main().
         * @param args the command line arguments
        public static void main(String[] args) {
            launch(args);
       private class SteeringWheelGroup extends Group {
            public SteeringWheelGroup(int destinationWidth) {
                int topPadding = 0;
                Rectangle rect = new Rectangle(getImageWidth(), getImageWidth(), Color.RED);
                double scale = destinationWidth / rect.getWidth();
                rect.setScaleX(scale);
                rect.setScaleY(scale);
                Circle circle = new Circle(getImageWidth()/2, getImageWidth()/2, getImageWidth()/2, Color.BLUE);
                circle.setScaleX(scale);
                circle.setScaleY(scale);
                Group rotationGroup = new Group(/*rect,*/ circle);
                rotationGroup.setManaged(false);
                int width = getImageWidth();
                Rectangle clipRectangle = new Rectangle(0, 0, width, width / 2);
                Circle clipCircle = new Circle(width / 2, width / 2, width / 2);
                Shape clip = Shape.intersect(clipRectangle, clipCircle);
                rotationGroup.setClip(clip);
                this.getChildren().add(rotationGroup);
                //double h = calculateHeigthOverHorizon(angle, destinationWidth/2);
                //setTranslateY(-h+topPadding);
            public final int getImageWidth() {
                return 479;
    Here is how you can reproduce my effect:
    Grab the black handle
    Drag the mouse top and right until you approach the angle -90 (have an eye out on the console log)
    Let the mouse go: the handle will snap to 90 degree
    Grab the handle a second time and move further right
    You will see that the angle printed out do not match what you expect.
    Let the mouse go, the Handle snaps back to it's original position
    As the rotation does not happen around the polygon's center, I have to use a Rotaion effect, which is applied. While I can drag the shape from the rotated location the dragging is always measured from its base position.
    So what can I do to work around this?
    final Rotate rotationTransform = new Rotate(currentRotation.doubleValue(), centerPoint.getX(), centerPoint.getY());
    polygon.getTransforms().add(rotationTransform);
    If worse comes to worst, I can use a circular handle covering everything, then I can rotate around its center, but I would like to avoid this.

  • I have version 3.6.16 and when I login to my hotmail account, and type the first letter of the email address, a drop down box appears with my hotmail address and I can choose it from that box with a click. How do I get version 4 to do this? Thanks.

    I have version 3.6.16 and when I login to my hotmail account, and type the first letter of the email address, a drop down box appears with my hotmail address and I can choose it from that box with a click.
    How do I get version 4 to do this?
    Thanks.

    The new but not-ready-for-prime-time autocomplete method searches for matches that contain the entered text, not just ones that begin with the string. Your options are:
    1) type in longer strings that narrow the search
    2) use an add-on to search just the beginnings:
    https://support.mozilla.org/en-US/questions/1037469
    3) install an older version of TB:
    http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/

  • Since downloading Firefox 4, I am having problems archiving gmail conversations from my inbox view. Also, when I go to enter a new event in google calendar, I now have to click the cursor in the box to type the event (it used to let me just start typing).

    Since downloading Firefox 4, I am having problems archiving gmail conversations from my inbox view (either one or several conversations) as it says "No Conversations Selected" when I have selected one or several. Also, when I go to enter a new event in google calendar, I have to click the cursor in the box to type the event (it used to let me just start typing) or else it flips out and starts jumping to day view or another month. Does anyone know how to fix either of these?

    I have had this problem; but while trying to fix another problem, I reset my preferences for Firefox and it fixed this problem as well. To reset preferences, follow this link: http://support.mozilla.com/en-US/kb/Resetting%20preferences

  • Itunes app no longer showing genres or the top charts/genius bar in the top bar ... it only displays a faint music in the centre with just the search box..why? i need them back:-(

    itunes app no longer showing genres or the top charts/genius bar in the top bar ... it only displays a faint music in the centre with just the search box..why? i need them back:-(

    The iTunes Store listing of your podcast is simply reflecting the contents of your podcast feed. Make sure all of the content you want displayed in the iTunes Store is still contained within your feed.
    Are you able to supply your feed for reference?

  • Drag event handling in JFXPanel has performance implications with expensive event handlers

    We have a drag event handler that is a little expensive, takes something like 20ms. The respective code must be run in a synchronous manner however.
    That is no problem in a pure JavaFX environment, as less drag events are created when CPU load is high.
    However, when embedded into Swing using JFXPanel this adaptation doesn't kick in, lots of drag events are created and the application becomes sluggish.
    Is there a way to mimic what JavaFX does in the JFXPanel scenario?
    The code below is a self-contained example that demonstrates what I'm describing.
    Some results I had:
    -eventHandlerSleep=5 -noswing --> 128 drag events
    -eventHandlerSleep=30 -noswing --> 46 drag events
    -eventHandlerSleep=5  --> 136 drag events
    -eventHandlerSleep=30  --> 135 drag events
    {code}import java.util.Arrays;
    import javax.swing.*;
    import com.sun.glass.ui.Robot;
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.embed.swing.JFXPanel;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    public class DragHandlingTester {
        private static long EVENT_HANDLER_SLEEP = 30;
        public static void main(String[] args) {
            for (String arg : args) {
                if (arg.startsWith("-eventHandlerSleep=")) {
                    EVENT_HANDLER_SLEEP = Long.parseLong(arg.split("=")[1]);
            if (Arrays.asList(args).contains("-noswing")) {
                Application.launch(JavaFXDragHandlingTestApp.class, args);
            } else {
                new SwingDragHandlingTestApp();
        static class SwingDragHandlingTestApp {
            SwingDragHandlingTestApp() {
                JFrame frame = new JFrame();
                final JFXPanel fxMainPanel = new JFXPanel();
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        DragTestScene dragTestScene = new DragTestScene();
                        fxMainPanel.setScene(dragTestScene.createScene());
                frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                frame.getContentPane().add(fxMainPanel);
                frame.setSize(800, 600);
                frame.setVisible(true);
        public static class JavaFXDragHandlingTestApp extends Application {
            @Override
            public void start(Stage primaryStage) {
                primaryStage.setWidth(800);
                primaryStage.setHeight(600);
                primaryStage.setX(0.0);
                primaryStage.setY(0.0);
                DragTestScene dragTestScene = new DragTestScene();
                primaryStage.setScene(dragTestScene.createScene());
                primaryStage.show();
        static class DragTestScene {
            private int drags = 0;
            public Scene createScene() {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            // after 1 second drag mouse across window
                            Thread.sleep(1000);
                            Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot();
                            robot.mouseMove(50, 50);
                            robot.mousePress(1);
                            for (int i = 20; i &lt; 700; i = i + 5) {
                                robot.mouseMove(i, 50);
                                Thread.sleep(10);
                            robot.mouseRelease(1);
                        } catch (Exception e) {
                            e.printStackTrace();
                }).start();
                BorderPane borderPane = new BorderPane();
                borderPane.setOnMouseDragged(new EventHandler() {
                    @Override
                    public void handle(MouseEvent mouseEvent) {
                        drags++;
                        try {
                            Thread.sleep(EVENT_HANDLER_SLEEP);
                        } catch (InterruptedException ignored) {
                        System.out.println("Number of drag events: " + drags);
                return new Scene(borderPane);
    {code}

    Ok, I expected something like this to be the reason. We'll probably have to live with it.
    My workaround right now is to use background tasks with an executor that has a single element queue handling the events in order, but rejecting any additional events as long as there is a queued event.
    Still not the same performance as in JavaFX, but at least it's usable now.

  • What's with this weird floating box on my screen spelling out everything I'm doing? How can I make it go away?

    A floating box has suddenly appeared on the lower left of my screen with white text on a black background telling me about whatever my cursor is hovering over at any given moment.  It's driving me nuts.  I'm sure it must be part of Help or Info, and it probably just takes a simple keystroke to get rid of it, but I can't seem to find that blasted keystroke!!  Please help.  [OS X 10.8.4; Mac Pro]

    welcome

  • I'm running OS 10.4 and purchased Mac Box Set with Snow Leopard.  When I run the Snow Leo install it errors saying I need OS 10.5 to run the install.  How do I get around this?  I've read that it's possible to go direcectly from 10.4 to 10.6.

    I'm running OS 10.4 and purchased Mac Box Set with Snow Leopard.  When I run the Snow Leo install it errors saying I need OS 10.5 to run the install.  How do I get around this?  I've read that it's possible to go direcectly from 10.4 to 10.6.

    To buy a hard drive try Newegg.com http://www.newegg.com/Store/SubCategory.aspx?SubCategory=380&name=Laptop-Hard-Dr ives or OWC http://eshop.macsales.com/shop/hard-drives/2.5-Notebook/
    Here's a cheap SATA external hard drive case on eBay http://cgi.ebay.com/USB-2-5-SATA-HDD-HARD-DRIVE-EXTERNAL-ENCLOSURE-CASE-BOX-/120 636286623?pt=PCC_Drives_Storage_Internal&hash=item1c167ba69f
    Here's instructions on replacing the hard drive http://creativemac.digitalmedianet.com/articles/viewarticle.jsp?id=45088

  • I'm trying to replace a missing font and apparently it's a graphic.  It's not letting me replace with another font and click change.  I can't export until it's fixed and I need to fix / bypass as soon as possible.

    I'm trying to replace a missing font and apparently it's a graphic.  It's not letting me replace with another font and click change.  I can't export until it's fixed and I need to fix / bypass as soon as possible.

    Go find the graphic in question, and open it in its native program. The problem will have to be fixed there.

  • I was in a chat box with skype and I clicked on the link to copy the text but it came back with "can't copy becuse not permitted in your browser"

    I was in a chat box with SKYPE and I clicked on the link to copy the text but it came back with "can't copy because not permitted in your browser"
    I can highlight copy and paste from other web screens with no problem.
    The chat window however doesn't give access to the lines that have scrolled past the window so highlighting the text won't work. Other chat windows grab the entire text when the user clicks on the copy link or icon.
    I just installed firefox and haven't tried other chat windows to see if the problem could be repeated.

    Use the keyboard if the buttons on the web page aren't working.
    * Copy: Ctrl+C or Ctrl+Insert
    * Paste: Ctrl+V or Shift+Insert
    * Cut: Ctrl+X or Shift+Delete
    *http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard

  • An icon has appeared on my desktop called colour sync utility.  I clicked on it, and it came up with information about needing to repair something which I tried to do but it didnt work. What is this and shouldI be worried ?

    An icon has appeared on my desktop called colour sync utility.  I clicked on it, and it came up with information about needing to repair something which I tried to do but it didnt work. What is this and shouldI be worried ?

    The Color Sync Utility is part of OSX and usually resides in the Application/Utilities folder.
    Don't know how it appeared on your desktop.
    But it is no malware, spyware or the like but as said part of OSX.
    http://docs.info.apple.com/article.html?path=Mac/10.6/en/8476.html
    Stefan

  • I am having same problem with apple tv need 4.4 version and can not find solution this a brand new product out of box yesterday why would it not already have updated version. I am getting frustrated that I can not get this mirroring icon to work. I

    I am having same problem with apple tv need 4.4 version and can not find solution this a brand new product out of box yesterday why would it not already have updated version. I am getting frustrated that I can not get this mirroring icon to work. I have tried all suggestions in this thread and nothing works. I also hooked up to laptop through iTunes with micro USB nothing!!!

    The new appletv software came out 2 or 3 days ago, how would Apple get it on the device in the box in a store?
    Why don't ou update the appletv software?

Maybe you are looking for

  • DVI/HDMI Switch

    Hi this is a loosely related question when it comes to the Apple TV but I wasn't sure where else to ask. Let me describe my set-up: 1 x iMac 24" 1 x Apple TV 1 x Television with DVI port Currently the Apple TV is connected to my TV with an HDMI->DVI

  • Slideshow creation

    Hi, I'm trying to create a slideshow that will play on a DVD player. I do not have easy access to a DVD Burner so hopefully I will be able to burn the final product to a CD and then play it. The slideshow will, hopefully, contain pictures w/ the Ken

  • Edge Animate 2014.1 won't open project because of js error

    After upgrading to the latest version yesterday, one of my projects won't open in 2014.1 because of a js error ("Loading Failed, please check your page for JavaScript errors"). I redownloaded the previous version and can confirm it works in 2014. Pri

  • Oracle OLEDB Installation thru Installshield

    I need to call Oracle OLEDB Provider "setup.exe" once I complete installing our product (using Installshield). I tried all different ways to do this and I have absolutely no luck. 1. I tried calling LaunchaAppAndWait(SRCDIR^"disk1\\install\\win32\\se

  • Can't get After Effects CC to startup

    After a fresh install of AE CC, I get the following error: After Effects warning: Could not rename the file '/Users/cstrimbu/Library/Preferences/Adobe/After Effects/12.2/Workspaces.537.1407352435556001.xml' to 'Workspaces.xml'. The next dialog box sa