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

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

@ -1,11 +1,12 @@
package com.fr.design.menu; package com.fr.design.menu;
import java.awt.FlowLayout; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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; import com.fr.design.gui.itoolbar.UIToolbar;
/** /**
@ -16,6 +17,23 @@ public class ToolBarDef {
// item List. // item List.
private List<ShortCut> shortcutList = new ArrayList<ShortCut>(); 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 * 一个static的方法生成一个JToolBar
*/ */

Loading…
Cancel
Save