Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Hi, I have a JFrame with a JPanel. This JPanel contains a JSplitpane, wich has alwasy the size of the JPanel. I need to size the Splitpane to the size of the JFrame... how can i do this? The JSplitpane only "knows" the size of the JPanel, but not of the JFrame. Please help...I tried a lot, but found no solution. Thanks lot!
no, i want the jsplitpane to have the size of the frame. my problem is the splitpane is in a panel and this panel dont know the size of the frame where its added.
Which kind of LayoutManagers do you use? For example if your Frame (ContentPane) has BorderLayout and you add a JPanel to the Center, then it has the same size like your Frame. And if Your Panel has also BorderLayout and your JSplitPane is added to the center, then it will have also the same size like your Frame. But maybe you have some other components to show??? You shoud give us a bit code. This makes our thoughts a bit easier. Maybe not the whole application, only the skeleton (GUI).
ok, here is the gui in a simple way. i wrote it for you to understand and in addition to that i solved my problem :-) But i have another problem with "splitPane.setDividerLocation(0.5);", because there is no effect. the divider should be in the middle and i want to use percentage. Can you help, please? thanks!
Yes, you missed something. It is only possible to call setDividerLocation(0.5) when the JFrame is already opened. So you have to listen for this event. Here is a little example:
Hope this helps Rene [ June 26, 2002: Message edited by: Rene Liebmann ]
This is easy. Your SplitPane exists in your Class MainPanel. And you create your MainPanel instance in your Frame. So your MainPanel should implement the WindowListener interface. Then you add your instance of MainPanel as a WindowListener to your Frame. Or (a bit easier) you make it in a different way. You could add a method setParentFrame(JFrame frame) to your MainPanel class. This method could look like:
Do you understand the Idea? It doesn't matter where you catch the windowOpened Event. You can do it where ever you know your Frame. Bye Rene