Hey everyone,
I'll cut right to the case. I have a JPanel and i call setLayout(null) on it. Simply because I would like to position everything myself and haven't seen a handy manager yet. Now i need to add this panel to a JScrollPane and this is where all the trouble starts. The JScrollPane simply doesn't like the absence of a LayoutManager.
I have been trying to puzzle through this for hours now and could use some help. I have tried to write my own LayoutManager which only implements the preferredSize method completely from the LayoutManager interface, but couldn't find a way to make the JScrollPane notice the changes in size.
I'd like to see a solution without a LayoutManager because I am really not too fond of these things. However I don't think there is one. Also if I am missing out a LayoutManager that would be perfect to have everything floating around the way I want it, feel free to point me in that direction. If anyone could show me a working preferredSize method that would also be fine.
Thanks in advance,
BSCode266
I'll cut right to the case. I have a JPanel and i call setLayout(null) on it. Simply because I would like to position everything myself and haven't seen a handy manager yet. Now i need to add this panel to a JScrollPane and this is where all the trouble starts. The JScrollPane simply doesn't like the absence of a LayoutManager.
I have been trying to puzzle through this for hours now and could use some help. I have tried to write my own LayoutManager which only implements the preferredSize method completely from the LayoutManager interface, but couldn't find a way to make the JScrollPane notice the changes in size.
I'd like to see a solution without a LayoutManager because I am really not too fond of these things. However I don't think there is one. Also if I am missing out a LayoutManager that would be perfect to have everything floating around the way I want it, feel free to point me in that direction. If anyone could show me a working preferredSize method that would also be fine.
Thanks in advance,
BSCode266
Comment