kerry
3 years ago
5 changed files with 74 additions and 77 deletions
@ -0,0 +1,39 @@ |
|||||||
|
package com.fr.design.style.background.gradient; |
||||||
|
|
||||||
|
import com.fr.design.DesignerEnvManager; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
import com.fr.design.style.color.ColorSelectDetailPane; |
||||||
|
import com.fr.design.style.color.ColorSelectDialog; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.Color; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Bjorn |
||||||
|
* @version 10.0 |
||||||
|
* Created by Bjorn on 2021-08-19 |
||||||
|
*/ |
||||||
|
public class FixedGradientBarNoTheme extends FixedGradientBar { |
||||||
|
|
||||||
|
|
||||||
|
public FixedGradientBarNoTheme(int minvalue, int maxvalue) { |
||||||
|
super(minvalue, maxvalue); |
||||||
|
} |
||||||
|
|
||||||
|
protected void clickButton(int select) { |
||||||
|
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE); |
||||||
|
Color selectColor = getList().get(select).getColorInner() == null ? Color.WHITE : getList().get(select).getColorInner(); |
||||||
|
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, selectColor, FixedGradientBarNoTheme.this); |
||||||
|
Color color = FixedGradientBarNoTheme.this.getColor(); |
||||||
|
if (color != null) { |
||||||
|
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color); |
||||||
|
getList().get(select).setColorInner(color); |
||||||
|
stateChanged(); |
||||||
|
FixedGradientBarNoTheme.this.repaint(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel initWindowPane(double preWidth) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -1,53 +0,0 @@ |
|||||||
package com.fr.design.style.background.gradient; |
|
||||||
|
|
||||||
import com.fr.base.background.ColorBackground; |
|
||||||
import com.fr.design.style.color.NewColorSelectPane; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.ChangeEvent; |
|
||||||
import javax.swing.event.ChangeListener; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Bjorn |
|
||||||
* @version 10.0 |
|
||||||
* Created by Bjorn on 2021-08-19 |
|
||||||
*/ |
|
||||||
public class FixedGradientBarWithPopMenu extends FixedGradientBar { |
|
||||||
|
|
||||||
private NewColorSelectPane colorPane; |
|
||||||
|
|
||||||
public FixedGradientBarWithPopMenu(int minvalue, int maxvalue) { |
|
||||||
super(minvalue, maxvalue); |
|
||||||
} |
|
||||||
|
|
||||||
protected void clickButton(int select) { |
|
||||||
setIndex(select); |
|
||||||
showPopupMenu(); |
|
||||||
} |
|
||||||
|
|
||||||
public JPanel initWindowPane(double preferredWidth) { |
|
||||||
// 下拉的时候重新生成面板,刷新最近使用颜色
|
|
||||||
colorPane = new NewColorSelectPane(false) { |
|
||||||
@Override |
|
||||||
public void setVisible(boolean b) { |
|
||||||
super.setVisible(b); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected boolean selectRealTime() { |
|
||||||
return false; |
|
||||||
} |
|
||||||
}; |
|
||||||
colorPane.addChangeListener(new ChangeListener() { |
|
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
hidePopupMenu(); |
|
||||||
setColor(((NewColorSelectPane) e.getSource()).getColor()); |
|
||||||
getList().get(getIndex()).setColorInner(getColor()); |
|
||||||
fireDisplayComponent(ColorBackground.getInstance(getColor())); |
|
||||||
FixedGradientBarWithPopMenu.this.stateChanged(); |
|
||||||
} |
|
||||||
}); |
|
||||||
return colorPane; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
Loading…
Reference in new issue