Browse Source
Merge in DESIGN/design from ~OBO/design1:release/11.0 to release/11.0 * commit '1203dd585a0452409b7e787b096e3bba0d2f457a': 改个默认颜色,把类中的去掉,不提代码了,就一行 少提一个类 改下注释 设计面板视觉优化,调整了主题面板的实现,可以根据布局自适应宽高,不写死宽度 REPORT-111566 【控件显示增强】设计面板视觉优化release/11.0
Obo-王学仁
11 months ago
10 changed files with 120 additions and 106 deletions
@ -1,70 +0,0 @@
|
||||
package com.fr.widgettheme.theme.panel; |
||||
|
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.frpane.FontSizeComboPane; |
||||
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.Color; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.util.Vector; |
||||
|
||||
/** |
||||
* 控件文本样式配置面板 |
||||
* 包含文本字体大小和字体颜色 |
||||
* |
||||
* @author oBo |
||||
* @since 11.0 |
||||
* Created on 2023/12/13 |
||||
*/ |
||||
public class WidgetTextStylePane extends JPanel { |
||||
|
||||
private final FontSizeComboPane fontSizePane; |
||||
|
||||
private final UIColorButton fontColorButton; |
||||
|
||||
public WidgetTextStylePane(int preferredWidth) { |
||||
this(null, preferredWidth); |
||||
} |
||||
|
||||
public WidgetTextStylePane(Vector<Integer> fontSizes, int preferredWidth) { |
||||
this.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||
this.setBorder(BorderFactory.createEmptyBorder()); |
||||
fontSizePane = new FontSizeComboPane(fontSizes); |
||||
fontColorButton = new UIColorButton(); |
||||
fontSizePane.setPreferredSize(new Dimension(preferredWidth, fontSizePane.getPreferredSize().height)); |
||||
this.add(fontSizePane); |
||||
this.add(fontColorButton); |
||||
} |
||||
|
||||
public void setTextStyle(ThemeTextStyle themeTextStyle) { |
||||
this.fontSizePane.setValue(themeTextStyle.getFontSize()); |
||||
this.fontColorButton.setColor(themeTextStyle.getFontColor()); |
||||
} |
||||
|
||||
public ThemeTextStyle getTextStyle() { |
||||
ThemeTextStyle themeTextStyle = new ThemeTextStyle(); |
||||
themeTextStyle.setFontSize(this.fontSizePane.getValue()); |
||||
themeTextStyle.setFontColor(this.fontColorButton.getColor()); |
||||
return themeTextStyle; |
||||
} |
||||
|
||||
public void setFontSizeValue(int fontSize) { |
||||
this.fontSizePane.setValue(fontSize); |
||||
} |
||||
|
||||
public void setFontColorValue(Color fontColor) { |
||||
this.fontColorButton.setColor(fontColor); |
||||
} |
||||
|
||||
public int getFontSizeValue() { |
||||
return this.fontSizePane.getValue(); |
||||
} |
||||
|
||||
public Color getFontColorValue() { |
||||
return this.fontColorButton.getColor(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.widgettheme.util; |
||||
|
||||
import com.fr.design.gui.frpane.FontSizeComboPane; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
|
||||
import javax.swing.Box; |
||||
import javax.swing.JPanel; |
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* 创建主题文本样式的工具类 |
||||
* |
||||
* @author obo |
||||
* @since 11.0 |
||||
* Created on 2023/12/21 |
||||
*/ |
||||
public class ThemeTextStylePaneCreator { |
||||
private ThemeTextStylePaneCreator() {} |
||||
|
||||
/** |
||||
* 创建主题文本样式配置面板 |
||||
* 包含字体大小下拉框和字体颜色按钮 |
||||
* 可以自适应布局 |
||||
* |
||||
* @param fontSizePane 字体大小配置 |
||||
* @param fontColorButton 字体颜色配置 |
||||
* @return 文本样式面板 |
||||
*/ |
||||
public static JPanel create(FontSizeComboPane fontSizePane, UIColorButton fontColorButton) { |
||||
Component[][] components = {{fontSizePane, Box.createHorizontalStrut(5), fontColorButton}}; |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {f}; |
||||
double[] columnSize = {f, p, p}; |
||||
int[][] rowCount = {{1, 1, 1}}; |
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 0, 0); |
||||
} |
||||
} |
Loading…
Reference in new issue