I have a java application constituted of a set of classes. One of the
classes extends "Observable". I am including the class below -- it is
very short. Will somebody please help me use it in GWT? Or help me
find something equivalent. I am very very new to GWT. Thanks,
Everyone.
/**********************SOURCE CODE
BELOW***********************************/
import java.awt.*;
import java.util.*;
public class ContactPoint extends Observable
{
private Coordinates _coord;
private Dimensions _dim;
public ContactPoint()
{
_coord = new Coordinates(0, 0);
_dim = new Dimensions(5, 5);
}
public ContactPoint(Coordinates coord)
{
_coord = new Coordinates(coord);
_dim = new Dimensions(5, 5);
}
public ContactPoint(Coordinates coord, Dimensions dim)
{
_coord = new Coordinates(coord);
_dim = new Dimensions(dim);
}
public Coordinates getCoordinates()
{
return new Coordinates(_coord);
}
public void setCoordinates(Coordinates coord)
{
_coord = new Coordinates(coord);
setChanged();
}
public void setCoordinates(Coordinates coord, Dimensions dim)
{
_coord = new Coordinates(coord);
_dim = new Dimensions(dim);
setChanged();
}
public Dimensions getDimensions()
{
return new Dimensions(_dim);
}
public void setDimensions(Dimensions dim)
{
_dim = new Dimensions(dim);
setChanged();
}
public void paint(Graphics g)
{
g.fillRect(_coord.x - _dim.w / 2,
_coord.y - _dim.h / 2,
_dim.w - 1,
_dim.h - 1);
}
public boolean isAt(Coordinates coord)
{
if ((coord.x >= _coord.x - _dim.w / 2) &&
(coord.x <= _coord.x + (_dim.w - 1) / 2) &&
(coord.y >= _coord.y - _dim.h / 2) &&
(coord.y <= _coord.y + (_dim.h - 1) / 2))
{
return true;
}
return false;
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---