Add Content inside JRibbonFrame - Insubstantial

1.1k Views Asked by At


I'm developing an application in Java.

The interface is based on insubstantial \ Flamingo.

I've added a flamingo menu as descrived in this tutorial This tutorial - so I've extended the JRibbonFrame class.

Now I should add a "Content Pane" - but I can't find the way...

From the following link you can see where I should add a "content pane": http://starkweb.it/contentPosition.png

A short example of code can be the following:

import java.awt.Dimension;
import java.awt.EventQueue;
import java.util.Arrays;
import javax.swing.JFrame;
import org.pushingpixels.flamingo.api.common.JCommandButton;
import org.pushingpixels.flamingo.api.ribbon.*;
import org.pushingpixels.flamingo.api.ribbon.resize.*;

public class MainFrame extends JRibbonFrame {

    public static void main(String args[]) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainFrame().setVisible(true);
            }
        });
    }

    public MainFrame() {
        JRibbonBand band1 = new JRibbonBand("Comands", null);
        JCommandButton button1 = new JCommandButton("Square", null);
        JCommandButton button2 = new JCommandButton("Circle", null);

        band1.addCommandButton(button1, RibbonElementPriority.TOP);
        band1.addCommandButton(button2, RibbonElementPriority.MEDIUM);
        band1.setResizePolicies(Arrays.<RibbonBandResizePolicy>asList(
            new CoreRibbonResizePolicies.None(band1.getControlPanel()), 
            new IconRibbonBandResizePolicy(band1.getControlPanel())));

        RibbonTask task1 = new RibbonTask("Tab 1", band1);

        getRibbon().addTask(task1);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setPreferredSize(new Dimension(800, 600));
        validate();
        pack();
    }
}

Thank you very much,
best regards,
-dAny-

1

There are 1 best solutions below

0
On

You need to use this > getContentPane().add();