Levy.Xie-解安森
2 months ago
17 changed files with 311 additions and 163 deletions
@ -0,0 +1,37 @@
|
||||
package com.fine.theme.light.ui; |
||||
|
||||
import com.formdev.flatlaf.ui.FlatComboBoxUI; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.UIManager; |
||||
import javax.swing.plaf.ComponentUI; |
||||
|
||||
|
||||
/** |
||||
* {@link com.fr.design.gui.icombocheckbox.UIComboCheckBox} 的 UI 样式 |
||||
* |
||||
* @author lemon |
||||
* @since 12.0 |
||||
* Created on 2024/09/27 |
||||
*/ |
||||
public class FineComboCheckBoxUI extends FlatComboBoxUI { |
||||
|
||||
public FineComboCheckBoxUI() { |
||||
super(); |
||||
} |
||||
|
||||
/** |
||||
* 创建UI |
||||
*/ |
||||
public static ComponentUI createUI(JComponent c) { |
||||
return new FineComboCheckBoxUI(); |
||||
} |
||||
|
||||
@Override |
||||
public void installUI(JComponent c) { |
||||
super.installUI(c); |
||||
c.setBackground(UIManager.getColor("ComboCheckBox.background")); |
||||
c.setBorder(UIManager.getBorder("ComboCheckBox.border")); |
||||
} |
||||
|
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,46 @@
|
||||
package com.fr.design.gui.storybook.components; |
||||
|
||||
import com.fr.design.gui.icombocheckbox.UIComboCheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.storybook.StoryBoard; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.stable.ArrayUtils; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
|
||||
import static com.fine.swing.ui.layout.Layouts.cell; |
||||
import static com.fine.swing.ui.layout.Layouts.flex; |
||||
|
||||
public class ComboCheckBoxStoryBoard extends StoryBoard { |
||||
public ComboCheckBoxStoryBoard() { |
||||
super("下拉多选框"); |
||||
|
||||
|
||||
add( |
||||
cell(new UILabel("普通状态")).with(this::h3), |
||||
cell(getComboCheckBox(ArrayUtils.toArray("测试1", "测试2", "测试3", "测试4"))), |
||||
|
||||
cell(new UILabel("长文字状态")).with(this::h3), |
||||
cell(getComboCheckBox(ArrayUtils.toArray("测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1", |
||||
"测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2", |
||||
"测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3", |
||||
"测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4"))), |
||||
|
||||
flex() |
||||
); |
||||
} |
||||
|
||||
private UIComboCheckBox getComboCheckBox(Object[] array) { |
||||
return new UIComboCheckBox(array, true) { |
||||
protected void setLayoutAndAddComponents() { |
||||
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
|
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel pane = getClickPane(); |
||||
pane.setOpaque(false); |
||||
this.add(pane, BorderLayout.CENTER); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue