views:

79

answers:

1

You know in MS Word, you can write text and draw&put shapes anywhere you want.. in the text when you hit enter and get to a new line, the shapes below your cursor also moves down one line? I want to implement that property in Java on a pane, using components as the shapes and text. How can I provide absolute positioning for shapes but at the same time preserve the space between them? I'll appreciate any idea, cause I'm almost out of ideas.

A: 

Maybe you could use SpringLayout?

Spring layouts do their job by defining directional relationships, or constraints, between the edges of components. For example, you might define that the left edge of one component is a fixed distance (5 pixels, say) from the right edge of another component.

Fortega
Halo
The position will always be relative to some other component. But you can specify your components position to be relative to the upper left point of the panel it is in...
Fortega
come to think about it, at every update I clear all and redraw the whole thing anyway, maybe it can live with absolute layout
Halo
yes I advice SpringLayout.
erasmus