I’m trying to add something like a date watermark to a diagram. Is there a way to do this?
Sure, just create a JGoText object with the characteristics that you want.
Then add it to your JGoView by calling JGoView.addObjectAtTail.
Don’t add it to your JGoDocument or to one of the document JGoLayers.
Note that this JGoText object could just as well be an arbitrarily complicated JGoArea with all kinds of stuff in it.
Objects added to the view will be scrolled and zoomed just like regular document objects. If you don’t want that, create the watermark object as a JComponent and add it to your dialog/window outside of JGo, superimposed with your JGoView.
When I saved the diagram it displays the date watermark at the top left corner. But when i open the same diagram it shows it and the middle it. Is there a way to always show it and the top left corner?
How are you opening the diagram? I assume you are creating a new JGoView object, so you would need to add the watermark to the new JGoView yourself. When you add the watermark to the JGoView, the x,y position of the watermark is specified in view coordinates which may be translated and scaled from that of the document becuase of scrolling and zooming. However, if you set the watermark position to something like (10, 10), it should always be in the upper left corner, although you may have to scroll to the upper left to see it.