Julian, it turns out you can have a tab pane without any tabs, you just
can't add() anything to it. With that in mind, the following trivial
hack puts a Box around any JPanel, which looks just like a real Box in
OS X. (I'd be keen to see how it renders on Windows.) Note that you can
not, however, nest these fakey boxes to get that nice increasing
darkness to their backgrounds seen when nesting real NSBoxes.
/**
* BoxPanel simulates the popular box-style container widget in OS X.
*
* This trivial code is public domain.
*
* @author Nicholas R. Rinard
* @version 1.0
*/
public class BoxPanel extends JPanel {
private final JTabbedPane underlayPanel = new JTabbedPane();
private final JPanel overlayPanel;
private final OverlayLayout layout;
/**
* This method prepares the parameter for overlay over a box-border
panel
* by making it transparent and padding its borders.
*/
public BoxPanel( JPanel contents ) {
contents.setOpaque( false );
contents.setBorder( BorderFactory.createEmptyBorder(
25,15,15,15 ) );
this.overlayPanel = contents;
this.layout = new OverlayLayout( this );
this.setLayout( this.layout );
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden