Hi,
"Float" is a nested (or inner) class defined in Rectangle2D.
Nested classes should be supported from Jabaco 1.4.2 onwards.
Are you stil using the 1.4.0 version? Then an update should be your remedy.
But "Float" is invisible in the 1.4.2 project class reference tree. So, there might be some gap in Jabaco.
A workaround could be to invent your own sub-class of Rectangle2D:
I extracted this code from rt.jar using a java decompiler
Cheers!
A1880
"Float" is a nested (or inner) class defined in Rectangle2D.
Nested classes should be supported from Jabaco 1.4.2 onwards.
Are you stil using the 1.4.0 version? Then an update should be your remedy.
But "Float" is invisible in the 1.4.2 project class reference tree. So, there might be some gap in Jabaco.
A workaround could be to invent your own sub-class of Rectangle2D:
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
public static class Float extends Rectangle2D
implements Serializable
{
public float x;
public float y;
public float width;
public float height;
private static final long serialVersionUID = 3798716824173675777L;
public Float()
{
}
public Float(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4)
{
setRect(paramFloat1, paramFloat2, paramFloat3, paramFloat4);
}
public double getX()
{
return this.x;
}
public double getY()
{
return this.y;
}
public double getWidth()
{
return this.width;
}
public double getHeight()
{
return this.height;
}
public boolean isEmpty()
{
return ((this.width <= 0.0F) || (this.height <= 0.0F));
}
public void setRect(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4)
{
this.x = paramFloat1;
this.y = paramFloat2;
this.width = paramFloat3;
this.height = paramFloat4;
}
public void setRect(double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4)
{
this.x = (float)paramDouble1;
this.y = (float)paramDouble2;
this.width = (float)paramDouble3;
this.height = (float)paramDouble4;
}
public void setRect(Rectangle2D paramRectangle2D)
{
this.x = (float)paramRectangle2D.getX();
this.y = (float)paramRectangle2D.getY();
this.width = (float)paramRectangle2D.getWidth();
this.height = (float)paramRectangle2D.getHeight();
}
public int outcode(double paramDouble1, double paramDouble2)
{
int i = 0;
if (this.width <= 0.0F)
i |= 5;
else if (paramDouble1 < this.x)
i |= 1;
else if (paramDouble1 > this.x + this.width) {
i |= 4;
}
if (this.height <= 0.0F)
i |= 10;
else if (paramDouble2 < this.y)
i |= 2;
else if (paramDouble2 > this.y + this.height) {
i |= 8;
}
return i;
}
public Rectangle2D getBounds2D()
{
return new Float(this.x, this.y, this.width, this.height);
}
public Rectangle2D createIntersection(Rectangle2D paramRectangle2D)
{
Object localObject;
if (paramRectangle2D instanceof Float)
localObject = new Float();
else {
localObject = new Rectangle2D.Double();
}
Rectangle2D.intersect(this, paramRectangle2D, (Rectangle2D)localObject);
return ((Rectangle2D)localObject);
}
public Rectangle2D createUnion(Rectangle2D paramRectangle2D)
{
Object localObject;
if (paramRectangle2D instanceof Float)
localObject = new Float();
else {
localObject = new Rectangle2D.Double();
}
Rectangle2D.union(this, paramRectangle2D, (Rectangle2D)localObject);
return ((Rectangle2D)localObject);
}
public String toString()
{
return super.getClass().getName() + "[x=" + this.x + ",y=" + this.y + ",w=" + this.width + ",h=" + this.height + "]";
}
}
|
I extracted this code from rt.jar using a java decompiler
Cheers!
A1880
Hi A1880,
Thanks for your response.
Installed Jabaco is 1.4.2, but there is no float or double instance of any geometrics figure.
This will be useful for runtime resizing and manipulating graphics drawings.
Like:
dim rct as java#awt#geom#Rectangle2D#Float=new java#awt#geom#Rectangle2D#Float(10,10,30,30)
dim grx as java#awtGraphics2D=cast(Picture1.GetGraphics,java#awt#Graphics2D)
grx.fill(rct)...
and Picture1.MouseMove event...
if rct.contains(x,y) then move, resize, etc..
Thanks again,
Milan
Thanks for your response.
Installed Jabaco is 1.4.2, but there is no float or double instance of any geometrics figure.
This will be useful for runtime resizing and manipulating graphics drawings.
Like:
dim rct as java#awt#geom#Rectangle2D#Float=new java#awt#geom#Rectangle2D#Float(10,10,30,30)
dim grx as java#awtGraphics2D=cast(Picture1.GetGraphics,java#awt#Graphics2D)
grx.fill(rct)...
and Picture1.MouseMove event...
if rct.contains(x,y) then move, resize, etc..
Thanks again,
Milan
Hi,
there are several reasons for the "." as unified separator:
1.) I always seem to get it wrong selecting the proper separator.
Maybe I have not properly understood the underlying concepts (namespaces vs. classes)
2.) All other programing languages familiar to me are using "."
3.) "#" and "$" are typically used for other purposes:
- c/c++ uses "#" to indicate meta commands like #include and #define
- "$" is often used to indicate variables
- "$" relates to strings in VB6
4.) I can't see any advantage for the developer to have different separators.
If the difference actually would have a meaning, one could define a nested class and a method or member variable with the same name.
That would be quite confusing and error prone. I tried it in Java, and it seems to be allowed (see example below).
It might be easier to implement for Jabaco, but ...
Enough reasons?
Cheers
A1880
there are several reasons for the "." as unified separator:
1.) I always seem to get it wrong selecting the proper separator.
Maybe I have not properly understood the underlying concepts (namespaces vs. classes)
2.) All other programing languages familiar to me are using "."
3.) "#" and "$" are typically used for other purposes:
- c/c++ uses "#" to indicate meta commands like #include and #define
- "$" is often used to indicate variables
- "$" relates to strings in VB6
4.) I can't see any advantage for the developer to have different separators.
If the difference actually would have a meaning, one could define a nested class and a method or member variable with the same name.
That would be quite confusing and error prone. I tried it in Java, and it seems to be allowed (see example below).
It might be easier to implement for Jabaco, but ...
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
public class AClass {
AClass() {
B b = new B();
int i = B;
b = new AClass.B();
i = this.B;
}
public class B extends AClass {
}
public int B; // allowed name clash between variable B and nested class B
}
|
Enough reasons?
Cheers
A1880
Ok - matter of habit. It's faster for the compiler to use another char to separate the namespace and it's difficult to change - but I'll think about your request...
Quoted
1.) I always seem to get it wrong selecting the proper separator.
2.) All other programing languages familiar to me are using "."
3.) "#" and "$" are typically used for other purposes
4.) I can't see any advantage for the developer to have different separators.
Maybe some settings in Jabaco can help here and your choice which separator you like to use.Ok - matter of habit. It's faster for the compiler to use another char to separate the namespace and it's difficult to change - but I'll think about your request...
Quoted
1.) I always seem to get it wrong selecting the proper separator.
2.) All other programing languages familiar to me are using "."
3.) "#" and "$" are typically used for other purposes
4.) I can't see any advantage for the developer to have different separators.
Cheers
This post has been edited 1 times, last edit by "swissmade" (Aug 16th 2011, 8:14am)
Similar threads
-
Tips, Tricks, Samples & Tutorials »-
How to use pointer with Jabaco
(May 10th 2009, 3:37pm)
-
General topics, questions and discussions »-
Considering the move to Jabaco
(Jun 30th 2009, 8:36pm)
-
General topics, questions and discussions »-
Jabaco expressions and operators
(Jan 15th 2009, 8:49pm)
-
Allgemeine Themen, Fragen und Diskussionen »-
Format Funktionen
(Dec 12th 2008, 10:45pm)
