用键盘(箭头,标签)导航JRibbon

时间:2014-10-20 14:44:13

标签: java radiance-flamingo

如何使用火烈鸟Jribbon组件中的箭头进行导航?早期版本的作者说他将修复此问题,但我不确定它是否仍然是固定的,因为我无法使用箭头在菜单周围进行导航。我正在使用flamingo 7.3版本。

感谢您的帮助

    import java.awt.Dimension;
    import java.util.Arrays;
    import java.util.List;

    import javax.swing.SwingUtilities;

    import org.pushingpixels.flamingo.api.common.JCommandButton;
    import org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon;
    import org.pushingpixels.flamingo.api.common.icon.ResizableIcon;
    import org.pushingpixels.flamingo.api.ribbon.JRibbonBand;
    import org.pushingpixels.flamingo.api.ribbon.JRibbonFrame;
    import org.pushingpixels.flamingo.api.ribbon.RibbonElementPriority;
    import org.pushingpixels.flamingo.api.ribbon.RibbonTask;
    import org.pushingpixels.flamingo.api.ribbon.resize.CoreRibbonResizePolicies;
    import org.pushingpixels.flamingo.api.ribbon.resize.IconRibbonBandResizePolicy;

/**
 * Main Frame to demonstrate ribbon use.
 * 
 * @author <a href="http://blog.frankel.ch/">Nicolas Frankel</a>
 * @date 26 juin 2010
 * @version 1.0
 * 
 */
public class MainFrame extends JRibbonFrame {

    /** Serial version unique id. */
    private static final long serialVersionUID = 1L;

    public static ResizableIcon getResizableIconFromResource(String resource) {

        return ImageWrapperResizableIcon.getIcon(MainFrame.class.getClassLoader().getResource(resource), new Dimension(
                48, 48));
    }

    /**
     * Entry point method.
     * 
     * @param args
     *            Application arguments
     */
    public static void main(String[] args) {

        SwingUtilities.invokeLater(new Runnable() {

            @SuppressWarnings({ "unchecked", "rawtypes" })
            @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);

                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, RibbonElementPriority.TOP);
                band1.addCommandButton(button2, RibbonElementPriority.MEDIUM);
                band1.addCommandButton(button3, RibbonElementPriority.MEDIUM);
                band1.addCommandButton(button4, RibbonElementPriority.MEDIUM);

                band1.setResizePolicies((List) Arrays.asList(new CoreRibbonResizePolicies.None(band1.getControlPanel())));
                band2.setResizePolicies((List) Arrays.asList(new IconRibbonBandResizePolicy(band2.getControlPanel())));

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

                frame.getRibbon().addTask(task1);
                frame.getRibbon().addTask(task2);

            }
        });
    }
}

0 个答案:

没有答案