Browse Source

toolbar menu dock background

master
hzzz 7 years ago
parent
commit
4a863d0f55
  1. 3
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  2. 24
      designer_base/src/com/fr/design/menu/ToolBarDef.java

3
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -29,6 +29,7 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.ThemeUtils;
import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
@ -433,7 +434,7 @@ public abstract class ToolBarMenuDock {
toolBar = (UIToolbar) toolbarComponent;
toolBar.removeAll();
} else {
toolBar = ToolBarDef.createJToolBar();
toolBar = ToolBarDef.createJToolBar(ThemeUtils.BACK_COLOR);
}
toolBar.setFocusable(true);

24
designer_base/src/com/fr/design/menu/ToolBarDef.java

@ -1,11 +1,12 @@
package com.fr.design.menu;
import java.awt.FlowLayout;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.*;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
/**
@ -15,7 +16,24 @@ public class ToolBarDef {
// item List.
private List<ShortCut> shortcutList = new ArrayList<ShortCut>();
/*
* 一个static的方法生成一个JToolBar
*/
public static UIToolbar createJToolBar(Color background) {
UIToolbar toolbar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI(){
@Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(background);
g2.fillRect(0, 0, c.getWidth(), c.getHeight());
}
});
toolbar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
return toolbar;
}
/*
* 一个static的方法生成一个JToolBar
*/

Loading…
Cancel
Save