java - GUI building trouble -
i have gui setup looks this:

it displays document , enables user edit adding/removing jtextareas , text in them.
i have problem when trying open document. document made of layers of jpanels on top of each other. there never more 6 layers of jpanels @ single point in gui.
since don't know height of jtextarea be, have make relative parent (in other words, not specify it).
because layout manager (miglayout) doesn't know exact size of component (it's relative parent), first asks parent parent's size. size again unknown , parent's parent asked , on (until level 1 or 2 jpanel). in end has ask lot of components size (a method checkparent(container) within miglayout called on 100 000 times example above).
what need set height of jtextarea (or jpanel resides in) when document being opened, layout manager doesn't have ask jtextareas parent, causing recursive hell.
after document opened have reset height default (so height adjusts when text added/removed).
i have absolutley no idea how this, or if way go, i'm sure thing described above problem.
several notes:
- this not
miglayoutbug, have been forums(link below) - check out (the last post)
- i can't put
jscrollpanejtextareatask isn't hold information, display how room takes - i can heights of
jtextareaswhen saving document, having them @ disposal when opening again
edit: document referenced in question not "the document" thingy used in jtextareas , similar, "a document" in custom class in program (which didn't mention because irrelevant, unless it's understood "the document").
because document models hierarchical structure, need tree. because interface requires both control , view each node, need table. outline, seen here, might suitable choice. documenttreemodel hold reference document's root element, example's filetreemodel holds reference root file. rowmodel include jlabel, jcheckbox , jtextarea.
Comments
Post a Comment