|
|
@ -1,35 +1,38 @@ |
|
|
|
package com.fr.design.gui.itoolbar; |
|
|
|
package com.fr.design.gui.itoolbar; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JToolBar; |
|
|
|
public class UIToolbar extends JToolBar { |
|
|
|
|
|
|
|
private static final int TOOLBAR_HEIGNT = 26; |
|
|
|
|
|
|
|
|
|
|
|
public class UIToolbar extends JToolBar{ |
|
|
|
public UIToolbar() { |
|
|
|
private static final int TOOLBAR_HEIGNT = 26; |
|
|
|
this(FlowLayout.LEFT); |
|
|
|
public UIToolbar() { |
|
|
|
} |
|
|
|
this(FlowLayout.LEFT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public UIToolbar(int align) { |
|
|
|
public UIToolbar(int align, UIToolBarUI uiToolBarUI) { |
|
|
|
super(); |
|
|
|
super(); |
|
|
|
setFloatable(false); |
|
|
|
setFloatable(false); |
|
|
|
setRollover(true); |
|
|
|
setRollover(true); |
|
|
|
setLayout(new FlowLayout(align, 4, 0)); |
|
|
|
setLayout(new FlowLayout(align, 4, 0)); |
|
|
|
setUI(new UIToolBarUI()); |
|
|
|
setUI(uiToolBarUI); |
|
|
|
setBorderPainted(false); |
|
|
|
setBorderPainted(false); |
|
|
|
setBackground(Color.RED); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public UIToolbar(int align) { |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
this(align, new UIToolBarUI()); |
|
|
|
Dimension dim = super.getPreferredSize(); |
|
|
|
} |
|
|
|
dim.height = TOOLBAR_HEIGNT; |
|
|
|
|
|
|
|
return dim; |
|
|
|
@Override |
|
|
|
} |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
|
|
|
|
Dimension dim = super.getPreferredSize(); |
|
|
|
|
|
|
|
dim.height = TOOLBAR_HEIGNT; |
|
|
|
|
|
|
|
return dim; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void checkComponentsByNames (boolean flag, ArrayList<String> names) { |
|
|
|
public void checkComponentsByNames(boolean flag, ArrayList<String> names) { |
|
|
|
for (int i = 0; i < getComponentCount(); i ++) { |
|
|
|
for (int i = 0; i < getComponentCount(); i++) { |
|
|
|
Component component = getComponents()[i]; |
|
|
|
Component component = getComponents()[i]; |
|
|
|
if (names.contains(component.getName())) { |
|
|
|
if (names.contains(component.getName())) { |
|
|
|
component.setEnabled(flag); |
|
|
|
component.setEnabled(flag); |
|
|
|