如何配置和安装flamingo java swing功能区按钮和菜单?

问题描述 投票:1回答:1

Problem:

我是Java swing flamingo框架的新手。首先,如何在netbean IDE中配置它,请一步一步指导我。

我在netbean项目中添加了flamingo 6.3.jar,但它不起作用或显示空表单。

Script:

package javaapplication18;

//import java.awt.List;
import java.util.Arrays;
import java.util.List;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import javax.swing.SwingUtilities;
import org.pushingpixels.flamingo.api.common.JCommandButton;
import org.pushingpixels.flamingo.api.ribbon.JRibbonBand;
import org.pushingpixels.flamingo.api.ribbon.JRibbonFrame;
import static org.pushingpixels.flamingo.api.ribbon.RibbonElementPriority.MEDIUM;
import static org.pushingpixels.flamingo.api.ribbon.RibbonElementPriority.TOP;
import org.pushingpixels.flamingo.api.ribbon.RibbonTask;
import org.pushingpixels.flamingo.api.ribbon.resize.IconRibbonBandResizePolicy;

/**
 *
 * @author lubiesol
 */
public class MainFrame extends JRibbonFrame {

    public static void main(String[] args) {

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                MainFrame frame = new MainFrame();
                frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
                frame.pack();
                frame.setVisible(true);

                JRibbonBand band1 = new JRibbonBand("Hello", null);
                JRibbonBand band2 = new JRibbonBand("world!", null);
                band1.setResizePolicies((List) Arrays.asList(new IconRibbonBandResizePolicy(band1.getControlPanel())));
                band2.setResizePolicies((List) Arrays.asList(new IconRibbonBandResizePolicy(band1.getControlPanel())));

                RibbonTask task1 = new RibbonTask("One", band1);
                RibbonTask task2 = new RibbonTask("Two", band2);

                JCommandButton button1 = new JCommandButton("Square", null);
                JCommandButton button2 = new JCommandButton("Circle", null);
                JCommandButton button3 = new JCommandButton("Triangle", null);
                JCommandButton button4 = new JCommandButton("Star", null);
                band1.addCommandButton(button1, TOP);
                band1.addCommandButton(button2, MEDIUM);
                band1.addCommandButton(button3, MEDIUM);
                band1.addCommandButton(button4, MEDIUM);
            }
        });
    }

    private void add(RibbonTask task1) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}
java swing swingx radiance-flamingo
1个回答
0
投票

弗拉明戈的作者在这里。您正在创建RibbonTask对象,但不将它们添加到JRibbonFrame的功能区。有关完整的Flamingo文档,请参阅here

© www.soinside.com 2019 - 2024. All rights reserved.