public HistoryBand() { super(Lang.getMsg("gui.history"), ImageLoader.getResizableIcon("reload")); final JCommandButton undo = new JCommandButton(Lang.getMsg("gui.history.undo"), ImageLoader.getResizableIcon("undo")); final JCommandButton redo = new JCommandButton(Lang.getMsg("gui.history.redo"), ImageLoader.getResizableIcon("redo")); final ActionListener undoListener = new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { EventBus.publish(new HistoryEvent(true)); } }; final ActionListener redoListener = new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { EventBus.publish(new HistoryEvent(false)); } }; undo.addActionListener(undoListener); redo.addActionListener(redoListener); addCommandButton(undo, RibbonElementPriority.MEDIUM); addCommandButton(redo, RibbonElementPriority.MEDIUM); final List<RibbonBandResizePolicy> policies = new ArrayList<>(); policies.add(new CoreRibbonResizePolicies.Mirror(getControlPanel())); policies.add(new CoreRibbonResizePolicies.Mid2Low(getControlPanel())); setResizePolicies(policies); }
public static boolean hasPopupAction(AbstractCommandButton commandButton) { if (commandButton instanceof JCommandButton) { JCommandButton jcb = (JCommandButton) commandButton; return jcb.getCommandButtonKind().hasPopup(); } return false; }
private static JRibbonBand getSampleRibbonBand(ActionListener expandActionListener) { JRibbonBand clipboardBand = new JRibbonBand("Clipboard", new edit_paste(), expandActionListener); JCommandButton mainButton = new JCommandButton("Paste", new edit_paste()); mainButton.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION); clipboardBand.addCommandButton(mainButton, RibbonElementPriority.TOP); JCommandButton cutButton = new JCommandButton("Cut", new edit_cut()); cutButton.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION); clipboardBand.addCommandButton(cutButton, RibbonElementPriority.MEDIUM); JCommandButton copyButton = new JCommandButton("Copy", new edit_copy()); copyButton.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_POPUP); clipboardBand.addCommandButton(copyButton, RibbonElementPriority.MEDIUM); JCommandButton formatButton = new JCommandButton("Format", new edit_paste()); formatButton.setCommandButtonKind(JCommandButton.CommandButtonKind.POPUP_ONLY); clipboardBand.addCommandButton(formatButton, RibbonElementPriority.MEDIUM); List<RibbonBandResizePolicy> resizePolicies = new ArrayList<RibbonBandResizePolicy>(); resizePolicies.add(new CoreRibbonResizePolicies.Mirror(clipboardBand.getControlPanel())); resizePolicies.add(new CoreRibbonResizePolicies.Mid2Low(clipboardBand.getControlPanel())); resizePolicies.add(new IconRibbonBandResizePolicy(clipboardBand.getControlPanel())); clipboardBand.setResizePolicies(resizePolicies); return clipboardBand; }
/** Returns a popup action icon for the specific command button. */ public static ResizableIcon getCommandButtonPopupActionIcon(JCommandButton commandButton) { JCommandButton.CommandButtonPopupOrientationKind popupOrientationKind = ((JCommandButton) commandButton).getPopupOrientationKind(); switch (popupOrientationKind) { case DOWNWARD: return new ArrowResizableIcon.CommandButtonPopupIcon(9, SwingConstants.SOUTH); case SIDEWARD: return new ArrowResizableIcon.CommandButtonPopupIcon( 9, commandButton.getComponentOrientation().isLeftToRight() ? SwingConstants.EAST : SwingConstants.WEST); } return null; }
/** Creates a new UI delegate for ribbon button. */ public SubstanceCommandButtonUI(JCommandButton button) { super(); this.backgroundDelegate = new ButtonBackgroundDelegate(); this.overallRolloverModel = new DefaultButtonModel(); this.overallRolloverModel.setArmed(false); this.overallRolloverModel.setSelected(false); this.overallRolloverModel.setPressed(false); this.overallRolloverModel.setRollover(false); this.overallRolloverModel.setEnabled(button.isEnabled()); this.overallStateTransitionTracker = new StateTransitionTracker(button, this.overallRolloverModel); this.substanceVisualStateTracker = new CommandButtonVisualStateTracker(); }
/* * (non-Javadoc) * * @see * org.jvnet.flamingo.common.ui.BasicCommandButtonUI#paintButtonIcon(java * .awt.Graphics, java.awt.Rectangle) */ @Override protected void paintButtonIcon(Graphics g, Rectangle iconRect) { JCommandButton jcb = (JCommandButton) this.commandButton; Icon regular = jcb.getIcon(); if (toUseDisabledIcon() && (jcb.getDisabledIcon() != null) && ((regular != null) && !regular.getClass().isAnnotationPresent(TransitionAware.class))) regular = jcb.getDisabledIcon(); if ((iconRect == null) || (regular == null) || (iconRect.width == 0) || (iconRect.height == 0)) { return; } boolean useThemed = SubstanceCoreUtilities.useThemedDefaultIcon(this.commandButton); if (regular != null) { Graphics2D g2d = (Graphics2D) g.create(); GhostPaintingUtils.paintGhostIcon(g2d, jcb, regular, iconRect); g2d.setComposite(LafWidgetUtilities.getAlphaComposite(jcb, g)); if (!useThemed) { regular.paintIcon(jcb, g2d, iconRect.x, iconRect.y); } else { StateTransitionTracker tracker = this.substanceVisualStateTracker.getActionStateTransitionTracker(); ButtonModel model = commandButton.getActionModel(); if (jcb.getCommandButtonKind() == CommandButtonKind.POPUP_ONLY) { tracker = this.substanceVisualStateTracker.getPopupStateTransitionTracker(); model = jcb.getPopupModel(); } CommandButtonBackgroundDelegate.paintThemedCommandButtonIcon( g2d, iconRect, jcb, regular, model, tracker); } g2d.dispose(); } }
/** * The constructor for this clipboard band that prepares the buttons and all settings needed for * the proper display. */ @SuppressWarnings("nls") public ClipboardBand() { super(Lang.getMsg(ClipboardBand.class, "title"), null); final JCommandButton pasteButton = new JCommandButton( Lang.getMsg(getClass(), "pasteButton"), Utils.getResizableIconFromResource("editpaste.png")); final JCommandButton copyButton = new JCommandButton( Lang.getMsg(getClass(), "copyButton"), Utils.getResizableIconFromResource("editcopy.png")); final JCommandButton cutButton = new JCommandButton( Lang.getMsg(getClass(), "cutButton"), Utils.getResizableIconFromResource("editcut.png")); pasteButton.setActionRichTooltip( new RichTooltip( Lang.getMsg(getClass(), "pasteButtonTooltipTitle"), Lang.getMsg(getClass(), "pasteButtonTooltip"))); copyButton.setActionRichTooltip( new RichTooltip( Lang.getMsg(getClass(), "copyButtonTooltipTitle"), Lang.getMsg(getClass(), "copyButtonTooltip"))); cutButton.setActionRichTooltip( new RichTooltip( Lang.getMsg(getClass(), "cutButtonTooltipTitle"), Lang.getMsg(getClass(), "cutButtonTooltip"))); pasteButton.getActionModel().setActionCommand("paste"); copyButton.getActionModel().setActionCommand("copy"); cutButton.getActionModel().setActionCommand("cut"); pasteButton.addActionListener(new EventBusAction()); copyButton.addActionListener(new EventBusAction()); cutButton.addActionListener(new EventBusAction()); addCommandButton(pasteButton, RibbonElementPriority.TOP); addCommandButton(copyButton, RibbonElementPriority.MEDIUM); addCommandButton(cutButton, RibbonElementPriority.MEDIUM); final List<RibbonBandResizePolicy> policies = new ArrayList<>(); policies.add(new CoreRibbonResizePolicies.Mirror(getControlPanel())); policies.add(new CoreRibbonResizePolicies.Mid2Low(getControlPanel())); setResizePolicies(policies); }
public TestCommandButtonSizes() { super("Command button sizes"); FormLayout fl = new FormLayout( "right:pref, 2dlu, center:pref, 2dlu, left:pref, 4dlu, right:pref, 2dlu, center:pref, 2dlu, left:pref"); DefaultFormBuilder builder = new DefaultFormBuilder(fl); builder.setDefaultDialogBorder(); ResizableIcon svgIcon = new font_x_generic(); svgIcon.setDimension(new Dimension(16, 16)); // Core Swing button with an icon and text builder.append("core"); JButton buttonCore1 = new JButton("s", svgIcon); JLabel sizeCore1 = new JLabel(); wireLabelToComponent(buttonCore1, sizeCore1); builder.append(buttonCore1, sizeCore1); // Flamingo MEDIUM action command button with an icon and text builder.append("command medium action"); JCommandButton commandButton1 = new JCommandButton("c", svgIcon); commandButton1.setDisplayState(CommandButtonDisplayState.MEDIUM); commandButton1.setFlat(false); JLabel sizeCommand1 = new JLabel(); wireLabelToComponent(commandButton1, sizeCommand1); builder.append(commandButton1, sizeCommand1); // Flamingo MEDIUM split command button with an icon and text builder.append("command medium split"); JCommandButton commandButton2 = new JCommandButton("c", svgIcon); commandButton2.setDisplayState(CommandButtonDisplayState.MEDIUM); commandButton2.setFlat(false); commandButton2.setCommandButtonKind(CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION); JLabel sizeCommand2 = new JLabel(); wireLabelToComponent(commandButton2, sizeCommand2); builder.append(commandButton2, sizeCommand2); // Flamingo MEDIUM command toggle button with an icon and text builder.append("command toggle medium"); JCommandToggleButton commandToggleButton1 = new JCommandToggleButton("ct", svgIcon); commandToggleButton1.setDisplayState(CommandButtonDisplayState.MEDIUM); commandToggleButton1.setFlat(false); JLabel sizeCommandToggle1 = new JLabel(); wireLabelToComponent(commandToggleButton1, sizeCommandToggle1); builder.append(commandToggleButton1, sizeCommandToggle1); // Core Swing button with an icon builder.append("core"); JButton buttonCore2 = new JButton(svgIcon); JLabel sizeCore2 = new JLabel(); wireLabelToComponent(buttonCore2, sizeCore2); builder.append(buttonCore2, sizeCore2); // Flamingo MEDIUM command toggle button with an icon builder.append("command toggle medium"); JCommandToggleButton commandToggleButton2 = new JCommandToggleButton(svgIcon); commandToggleButton2.setDisplayState(CommandButtonDisplayState.MEDIUM); commandToggleButton2.setFlat(false); JLabel sizeCommandToggle2 = new JLabel(); wireLabelToComponent(commandToggleButton2, sizeCommandToggle2); builder.append(commandToggleButton2, sizeCommandToggle2); // Flamingo MEDIUM action command button with an icon builder.append("command medium action"); JCommandButton commandButton3 = new JCommandButton(svgIcon); commandButton3.setDisplayState(CommandButtonDisplayState.MEDIUM); commandButton3.setFlat(false); JLabel sizeCommand3 = new JLabel(); wireLabelToComponent(commandButton3, sizeCommand3); builder.append(commandButton3, sizeCommand3); // Flamingo SMALL action command button with an icon and text builder.append("command small action"); JCommandButton commandButton4 = new JCommandButton("c", svgIcon); commandButton4.setDisplayState(CommandButtonDisplayState.SMALL); commandButton4.setFlat(false); JLabel sizeCommand4 = new JLabel(); wireLabelToComponent(commandButton4, sizeCommand4); builder.append(commandButton4, sizeCommand4); // Flamingo SMALL action command button with an icon and text builder.append("command small action, gap scale 0.5"); JCommandButton commandButton5 = new JCommandButton("c", svgIcon); commandButton5.setDisplayState(CommandButtonDisplayState.SMALL); commandButton5.setGapScaleFactor(0.5); commandButton5.setFlat(false); JLabel sizeCommand5 = new JLabel(); wireLabelToComponent(commandButton5, sizeCommand5); builder.append(commandButton5, sizeCommand5); this.add(builder.getPanel(), BorderLayout.CENTER); this.setSize(600, 300); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
@Override protected void installComponents() { super.installComponents(); this.mainPanel = createMainPanel(); this.panelLevel1 = new JPanel(); this.panelLevel1.setLayout( new LayoutManager() { @Override public void addLayoutComponent(String name, Component comp) {} @Override public void removeLayoutComponent(Component comp) {} @Override public Dimension preferredLayoutSize(Container parent) { int height = 0; int width = 0; for (int i = 0; i < parent.getComponentCount(); i++) { Dimension pref = parent.getComponent(i).getPreferredSize(); height += pref.height; width = Math.max(width, pref.width); } Insets ins = parent.getInsets(); return new Dimension(width + ins.left + ins.right, height + ins.top + ins.bottom); } @Override public Dimension minimumLayoutSize(Container parent) { return preferredLayoutSize(parent); } @Override public void layoutContainer(Container parent) { Insets ins = parent.getInsets(); int topY = ins.top; for (int i = 0; i < parent.getComponentCount(); i++) { Component comp = parent.getComponent(i); Dimension pref = comp.getPreferredSize(); comp.setBounds(ins.left, topY, parent.getWidth() - ins.left - ins.right, pref.height); topY += pref.height; } } }); final RibbonApplicationMenu ribbonAppMenu = this.applicationMenuPopupPanel.getRibbonAppMenu(); if (ribbonAppMenu != null) { List<List<RibbonApplicationMenuEntryPrimary>> primaryEntries = ribbonAppMenu.getPrimaryEntries(); int primaryGroupCount = primaryEntries.size(); for (int i = 0; i < primaryGroupCount; i++) { for (final RibbonApplicationMenuEntryPrimary menuEntry : primaryEntries.get(i)) { final JCommandMenuButton commandButton = new JCommandMenuButton(menuEntry.getText(), menuEntry.getIcon()); commandButton.setCommandButtonKind(menuEntry.getEntryKind()); commandButton.addActionListener(menuEntry.getMainActionListener()); commandButton.setActionKeyTip(menuEntry.getActionKeyTip()); commandButton.setPopupKeyTip(menuEntry.getPopupKeyTip()); if (menuEntry.getDisabledIcon() != null) { commandButton.setDisabledIcon(menuEntry.getDisabledIcon()); } if (menuEntry.getSecondaryGroupCount() == 0) { // if there are no secondary menu items, register the // application rollover callback to populate the // second level panel commandButton.addRolloverActionListener( new RolloverActionListener() { @Override public void actionPerformed(ActionEvent e) { // System.out.println("Rollover action"); PrimaryRolloverCallback callback = menuEntry.getRolloverCallback(); if (callback != null) { callback.menuEntryActivated(panelLevel2); } else { // default callback? PrimaryRolloverCallback defaultCallback = ribbonAppMenu.getDefaultCallback(); if (defaultCallback != null) { defaultCallback.menuEntryActivated(panelLevel2); } else { panelLevel2.removeAll(); panelLevel2.revalidate(); panelLevel2.repaint(); } } panelLevel2.applyComponentOrientation( applicationMenuPopupPanel.getComponentOrientation()); } }); } else { // register a core callback to populate the second level // panel with secondary menu items final PrimaryRolloverCallback coreCallback = new PrimaryRolloverCallback() { @Override public void menuEntryActivated(JPanel targetPanel) { targetPanel.removeAll(); targetPanel.setLayout(new BorderLayout()); JRibbonApplicationMenuPopupPanelSecondary secondary = new JRibbonApplicationMenuPopupPanelSecondary(menuEntry) { @Override public void removeNotify() { super.removeNotify(); commandButton.getPopupModel().setPopupShowing(false); } }; secondary.applyComponentOrientation( applicationMenuPopupPanel.getComponentOrientation()); targetPanel.add(secondary, BorderLayout.CENTER); } }; commandButton.addRolloverActionListener( new RolloverActionListener() { @Override public void actionPerformed(ActionEvent e) { coreCallback.menuEntryActivated(panelLevel2); // emulate showing the popup so the // button remains "selected" commandButton.getPopupModel().setPopupShowing(true); } }); } commandButton.setDisplayState(MENU_TILE_LEVEL_1); commandButton.setHorizontalAlignment(SwingUtilities.LEADING); commandButton.setPopupOrientationKind(CommandButtonPopupOrientationKind.SIDEWARD); commandButton.setEnabled(menuEntry.isEnabled()); this.panelLevel1.add(commandButton); } if (i < (primaryGroupCount - 1)) { this.panelLevel1.add(new JPopupMenu.Separator()); } } } mainPanel.add(this.panelLevel1, BorderLayout.LINE_START); this.panelLevel2 = new JPanel(); this.panelLevel2.setBorder( new Border() { @Override public Insets getBorderInsets(Component c) { boolean ltr = c.getComponentOrientation().isLeftToRight(); return new Insets(0, ltr ? 1 : 0, 0, ltr ? 0 : 1); } @Override public boolean isBorderOpaque() { return true; } @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { g.setColor(FlamingoUtilities.getColor(Color.gray, "Label.disabledForeground")); boolean ltr = c.getComponentOrientation().isLeftToRight(); int xToPaint = ltr ? x : x + width - 1; g.drawLine(xToPaint, y, xToPaint, y + height); } }); this.panelLevel2.setPreferredSize( new Dimension( 30 * FlamingoUtilities.getFont( this.panelLevel1, "Ribbon.font", "Button.font", "Panel.font") .getSize() - 30, 10)); mainPanel.add(this.panelLevel2, BorderLayout.CENTER); if (ribbonAppMenu != null) { if (ribbonAppMenu.getDefaultCallback() != null) { ribbonAppMenu.getDefaultCallback().menuEntryActivated(this.panelLevel2); } } this.applicationMenuPopupPanel.add(mainPanel, BorderLayout.CENTER); this.footerPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING)) { @Override protected void paintComponent(Graphics g) { FlamingoUtilities.renderSurface( g, footerPanel, new Rectangle(0, 0, footerPanel.getWidth(), footerPanel.getHeight()), false, false, false); } }; if (ribbonAppMenu != null) { for (RibbonApplicationMenuEntryFooter footerEntry : ribbonAppMenu.getFooterEntries()) { JCommandButton commandFooterButton = new JCommandButton(footerEntry.getText(), footerEntry.getIcon()); if (footerEntry.getDisabledIcon() != null) { commandFooterButton.setDisabledIcon(footerEntry.getDisabledIcon()); } commandFooterButton.setCommandButtonKind(CommandButtonKind.ACTION_ONLY); commandFooterButton.addActionListener(footerEntry.getMainActionListener()); commandFooterButton.setDisplayState(CommandButtonDisplayState.MEDIUM); commandFooterButton.setFlat(false); commandFooterButton.setEnabled(footerEntry.isEnabled()); this.footerPanel.add(commandFooterButton); } } this.applicationMenuPopupPanel.add(this.footerPanel, BorderLayout.SOUTH); this.applicationMenuPopupPanel.setBorder( new Border() { @Override public Insets getBorderInsets(Component c) { return new Insets(20, 2, 2, 2); } @Override public boolean isBorderOpaque() { return true; } @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { g.setColor(FlamingoUtilities.getColor(Color.gray, "Label.disabledForeground")); g.drawRect(x, y, width - 1, height - 1); g.setColor( FlamingoUtilities.getColor(Color.gray, "Label.disabledForeground") .brighter() .brighter()); g.drawRect(x + 1, y + 1, width - 3, height - 3); FlamingoUtilities.renderSurface( g, applicationMenuPopupPanel, new Rectangle(x + 2, y + 2, width - 4, 24), false, false, false); // draw the application menu button JCommandButton button = applicationMenuPopupPanel.getAppMenuButton(); JRibbonApplicationMenuButton rendererButton = new JRibbonApplicationMenuButton( ((RibbonProvider) applicationMenuPopupPanel.getAppMenuButton()).getRibbon()); rendererButton.setPopupKeyTip(button.getPopupKeyTip()); rendererButton.setIcon(button.getIcon()); rendererButton.getPopupModel().setRollover(false); rendererButton.getPopupModel().setPressed(true); rendererButton.getPopupModel().setArmed(true); rendererButton.getPopupModel().setPopupShowing(true); CellRendererPane buttonRendererPane = new CellRendererPane(); Point buttonLoc = button.getLocationOnScreen(); Point panelLoc = c.getLocationOnScreen(); buttonRendererPane.setBounds( panelLoc.x - buttonLoc.x, panelLoc.y - buttonLoc.y, button.getWidth(), button.getHeight()); buttonRendererPane.paintComponent( g, rendererButton, (Container) c, -panelLoc.x + buttonLoc.x, -panelLoc.y + buttonLoc.y, button.getWidth(), button.getHeight(), true); } }); }
/** Default constructor that prepares the buttons displayed on this band. */ @SuppressWarnings("nls") public ServerBand() { super(Lang.getMsg(ServerBand.class, "title"), null); statusButton = new JCommandButton( Lang.getMsg(ServerBand.class, "status"), Utils.getResizableIconFromResource("setstatus.png")); statusButton.setActionRichTooltip( new RichTooltip( Lang.getMsg(ServerBand.class, "statusTooltipTitle"), Lang.getMsg(ServerBand.class, "statusTooltip"))); final ActionListener statusAction = new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final Editor currentEditor = MainFrame.getInstance().getCurrentQuestEditor(); final int id = currentEditor.getQuestID(); int status; try { status = currentEditor.getSelectedStatusNumber(); } catch (IllegalStateException exception) { JOptionPane.showMessageDialog( MainFrame.getInstance(), Lang.getMsg(ServerBand.class, "wrongSelectionText") + exception.getMessage(), Lang.getMsg(ServerBand.class, "wrongSelectionCaption"), JOptionPane.ERROR_MESSAGE); return; } int msgType = JOptionPane.INFORMATION_MESSAGE; String msgText = null; String msgCaption = null; try { final URL requestURL = new URL("http://illarion.org/easyquest/xml_setqueststatus.php"); final HttpURLConnection conn = (HttpURLConnection) requestURL.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); final String query = "character=" + URLEncoder.encode(Config.getInstance().getCharacter(), "UTF-8") + "&password="******"UTF-8") + "&questid=" + id + "&queststatus=" + status; final OutputStreamWriter output = new OutputStreamWriter(conn.getOutputStream()); output.write(query); output.flush(); output.close(); final String result = new Scanner(conn.getInputStream()).useDelimiter("\\A").next(); if (result.equals("SUCCESS")) { msgCaption = Lang.getMsg(ServerBand.class, "successCaption"); msgText = Lang.getMsg(ServerBand.class, "successText") + Config.getInstance().getCharacter(); } else { msgType = JOptionPane.ERROR_MESSAGE; switch (result) { case "E_MISS": msgCaption = Lang.getMsg(ServerBand.class, "incompatibleCaption"); msgText = Lang.getMsg(ServerBand.class, "incompatibleText"); break; case "E_CHAR": msgCaption = Lang.getMsg(ServerBand.class, "noCharCaption"); msgText = Lang.getMsg(ServerBand.class, "noCharText") + Config.getInstance().getCharacter(); break; case "E_LOGIN": msgCaption = Lang.getMsg(ServerBand.class, "noLoginCaption"); msgText = Lang.getMsg(ServerBand.class, "noLoginText"); break; } } } catch (@Nonnull final UnknownHostException exception) { msgType = JOptionPane.ERROR_MESSAGE; msgCaption = Lang.getMsg(ServerBand.class, "noHostCaption"); msgText = Lang.getMsg(ServerBand.class, "noHostText"); } catch (@Nonnull final Exception exception) { msgType = JOptionPane.ERROR_MESSAGE; msgCaption = Lang.getMsg(ServerBand.class, "failureCaption"); msgText = Lang.getMsg(ServerBand.class, "failureText"); } JOptionPane.showMessageDialog(MainFrame.getInstance(), msgText, msgCaption, msgType); } }; statusButton.addActionListener(statusAction); addCommandButton(statusButton, RibbonElementPriority.TOP); final List<RibbonBandResizePolicy> policies = new ArrayList<>(); policies.add(new CoreRibbonResizePolicies.Mirror(getControlPanel())); policies.add(new CoreRibbonResizePolicies.Mid2Low(getControlPanel())); setResizePolicies(policies); }