Skip to main content

As promised

6 replies [Last post]
pietblok
Offline
Joined: 2003-07-17
Points: 0

Hi Alex,

As promised here a link to my first "blog" http://www.pbjar.org/blogs/jxlayer/JXLayer_one.html Just wrote it in plain simple html what I am not very good at. To have the sample work via webstart I had to sign my jar but also your jar. So I took the liberty of signing it under my name. I hope you don't mind. As soon as you sign your jar yourself I will change the jnlp file and redirect it to another jnlp file for your jar.

This is the link:

If there is anything that you don't like, please let me know and I'll change it.

Thanks
Piet

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alexfromsun
Offline
Joined: 2005-09-05
Points: 0

Hello Piet

Your article is very nice and impressive demo !
I've signed my jars and committed them to the jxlayer.dev.java.net

Thanks
alexp

pietblok
Offline
Joined: 2003-07-17
Points: 0

Thank you Alex,

I found that the jxlayer.jar file that one can directly dowload from the project page is signed.

However, the jxlayer.jar inside the jxlayer-all.zip is NOT signed.

I tried to create a separate jnlp file for jxlayer (following the instructions in http://weblogs.java.net/blog/kirillcool/archive/2005/05/signing_jars_fo.... but requesting all permissions) and reference it from my main jnlp file. But it seems not to work. I get a security exception.

Strange, the user is not asked to trust the certificate on jxlayer.jar, only on my own certificate.

Now I wonder if the method described by Kirill, referencing other jars by separate jnlp files, works only if the other jars do not require permissions?

From my server log I can verify that the correct jars are loaded.

(I created a second webstart link on the blog)

I will ask further on the webstart forum.

One more question: I wrap three JXLayers into each other. the deepest one is the mouse drawing layer, the outer one is the magnifier glass. What I expected was that the magnifier glass would not only magnify the component wrapped inside the mouse drawing layer, but also the mouse drawing lines, because I guessed that those two are tightly coupled together in that one JXLayer component. But that is not the case. Can you explain why?

Here the paintLayer code on the magnifier ui.

[code]
protected void paintLayer(Graphics2D g2, JXLayer layer) {
super.paintLayer(g2, layer);
MyState state = (MyState) getStateObject(layer);
Point2D point = state.getPoint();
double scale = state.getMagnifyingFactor();
double baseRadius = state.getRadius();
double scaledRadius = (baseRadius / scale);
double strokeAdjust = 0.5;
double drawSize = 2 * (baseRadius + strokeAdjust);
double clipSize = 2 * scaledRadius;
Ellipse2D drawGlass = new Ellipse2D.Double(-strokeAdjust,
-strokeAdjust, drawSize, drawSize);
Ellipse2D clipGlass = new Ellipse2D.Double(0, 0, clipSize, clipSize);
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2.translate(point.getX() - baseRadius, point.getY() - baseRadius);
g2.draw(drawGlass);
g2.scale(scale, scale);
g2.clip(clipGlass);
g2.translate(scaledRadius - point.getX(), scaledRadius - point.getY());
layer.paint(g2);
}
[/code]

Thanks

Piet

alexfromsun
Offline
Joined: 2005-09-05
Points: 0

Hello Piet

What base class do you extend, is it AbstractLayerUI?

You seem to paint the layer twice:
one time is super.paintLayer(g2, layer); ant the other one is layer.paint(g2);
why is that?

Thanks
alexp

pietblok
Offline
Joined: 2003-07-17
Points: 0

Hi Alex,

The first time super.paintLayer(g2, layer); to paint the layer as is.

In between I draw the contour of the glass.

The second time layer.paint(g2); the graphics object is clipped, translated and scaled to only paint the contents for the magnifying glass.

And yes, AbstractLayerUI is extended via my own GeneralLayerUI (implements a StateObject (for future testing with shared LayerUIs) and facilitates some extra features for my own pleasure) All sources are available from the blog.

Thanks,

Piet

pietblok
Offline
Joined: 2003-07-17
Points: 0

Alex,

I found the problem about the drawing not being magnified also. It has to do with scaling and translating done in my mouse drawing ui (intended to be for future use). I thought that I disabled it entirely, but that was not the case. Instead of using [b]g2.transform(transform)[/b], I used [b]g2.setTransform(transform)[/b], so the transform set by the magnifier was lost. Now everything works as expected.

It also repairs a repainting issue that I found when I share my LayerUIs.

I will upload the repaired code as soon as possible to my blog.

Thanks

Piet

pietblok
Offline
Joined: 2003-07-17
Points: 0

Hi Alex,

Just FYI. I added some text to the blog about sharing LayerUIs (with a demo of course).

The same link: http://www.pbjar.org/blogs/jxlayer/JXLayer_one.html

Thanks

Piet