帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

64 lines
1.7 KiB

package com.fr.design.style;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.background.ColorBackground;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundCustomJComponent;
import com.fr.design.style.color.NewColorSelectPane;
/**
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间:2011-11-24 下午03:02:37
* 类说明: 自定义形状的 弹出box
*/
public class CustomSelectBox extends AbstractPopBox {
private Color color;
public CustomSelectBox(int direction) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setSize(20, 20);
displayComponent = new BackgroundCustomJComponent(direction);
this.add(displayComponent, BorderLayout.CENTER);
displayComponent.setOpaque(false);
displayComponent.setPreferredSize(new Dimension(20, 15));
this.setSelectObject(Color.BLACK);
this.addMouseListener(mouseListener);
}
@Override
public JPanel initWindowPane(double preferredWidth) {
NewColorSelectPane colorPane = new NewColorSelectPane();
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
NewColorSelectPane source = (NewColorSelectPane)e.getSource();
setSelectObject(source.getColor());
hidePopupMenu();
}
});
return colorPane;
}
public Color getSelectObject() {
return this.color;
}
public void setSelectObject(Color color) {
this.color = color;
fireDisplayComponent(ColorBackground.getInstance(color));
}
}