Using JCanvas with Swing

hello,
I was thinking about making something similar to this:


JMenu
JList

is it possible?
I know about the issues about mixing lightweight and heavyheight components, but that can be solved if I set the JMenu and JList components to heavyheight right?

How do I add the the JCanvas? Add it to a JPanel, and then add the JPanel to the main JFrame?

any help is apreciated, thx.

Edit: The ansii pic is messed up, but it´s a menu in the top, then a list if the left and the canvas.

Maybe what you’re looking for is a JSplitPane.

thx, but how about the part of adding the GLCanvas to the frame?

just add it like you would add any other component. Odd behaviors happens when you overlap light & heavyweight compenents, since it not the case here, you won’t have problems. For mor infos about mixing light- & heavyweight components, look here.

[quote]thx, but how about the part of adding the GLCanvas to the frame?
[/quote]
It would be something like this:

// Create a JList (at left)
// Create a GLCanvas (at right)

JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                           list, glCanvas);

// Create a JFrame

// This line adds the splitpane to the JFrame
jFrame.getContentPane().add(splitPane);

// Finally, this line shows the frame
jFrame.setVisible(true);

got it, thx a lot