Browse Source

REPORT-134742 fix: 日期控件 southPane 组件替换,day label UI 调整

fbp/merge
lemon 4 months ago
parent
commit
bd0f57dbc5
  1. 54
      designer-base/src/main/java/com/fine/theme/light/ui/FineDayLabelUI.java
  2. 1
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  3. 305
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  4. 3
      designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java
  5. 28
      designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java
  6. 1
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties
  7. 17
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

54
designer-base/src/main/java/com/fine/theme/light/ui/FineDayLabelUI.java

@ -0,0 +1,54 @@
package com.fine.theme.light.ui;
import com.fr.design.gui.date.UIDayLabel;
import javax.swing.AbstractButton;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import java.awt.Color;
/**
* {@link UIDayLabel} UI 样式
* @author lemon
* @since
* Created on
*/
public class FineDayLabelUI extends FineButtonUI {
protected Color selectedBackground;
/**
* @param shared
* @since 2
*/
protected FineDayLabelUI(boolean shared) {
super(shared);
}
/**
* 创建UI
*
* @param c 组件
* @return ComponentUI
*/
public static ComponentUI createUI(JComponent c) {
return new FineDayLabelUI(false);
}
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
selectedBackground = UIManager.getColor("Calendar.day.selectedBackground");
}
@Override
protected Color getBackground(JComponent c) {
if (c instanceof UIDayLabel) {
return ((UIDayLabel) c).isSelected() ? selectedBackground : super.getBackground(c);
}
return super.getBackground(c);
}
}

1
designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java

@ -51,6 +51,7 @@ public interface FineUIStyle {
String DEFAULT_TABLE = "defaultTable";
String WHITE_BUTTON = "whiteButton";
String ORIGINAL_BUTTON = "originalButton";
String GRAY_BUTTON = "grayButton";
String DETAIL_LABEL = "detailLabel";
String WIDGET_EVENT_LABEL = "widgetEventLabel";

305
designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java

@ -2,10 +2,11 @@ package com.fr.design.gui.date;
import com.fanruan.product.ProductConstantsBase;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.background.GradientBackground;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.carton.MonthlyCartonFile;
import com.fr.design.carton.SwitchForSwingChecker;
@ -22,7 +23,6 @@ import com.fr.stable.StringUtils;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
@ -38,13 +38,11 @@ import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@ -56,29 +54,21 @@ import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineUIScale.createScaleDimension;
import static com.fine.theme.utils.FineUIScale.scale;
import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT;
import static com.fine.theme.utils.FineUIStyle.setStyle;
public class UICalendarPanel extends JPanel {
private static final Font FONT_UI = DesignUtils.getDefaultGUIFont().applySize(scale(12));
private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"), Font.PLAIN, scale(12));
private static final int WEEKDAY_COUNT = 7;
private static final int TOTAL_DAYS_COUNT = 42;
private static final int WIDTH = scale(31);
private static final int HEIGHT = scale(19);
private static final int START_X = scale(30);
private static final int START_Y = scale(19);
protected final Insets defaultInsets = new Insets(0, 6, 0, 6);
//卡顿日志所在地址
private static final String JOURNAL_FILE_PATH = StableUtils.pathJoin(ProductConstantsBase.getEnvHome(), "journal_log");
protected Color selectedBackground;
protected Color selectedForeground;
protected Color background;
protected Color foreground;
protected Color hoverBackground;
protected Color pressedBackground;
protected Color defaultBackground;
private Calendar calendar = null;
private UILabel monthLabel = null;
@ -88,12 +78,11 @@ public class UICalendarPanel extends JPanel {
private boolean isSupportDateChangeListener = false;
private java.util.Date selectedDate = null;
private boolean isTimePicker;
private final Color LABEL_FORGE_GROUND = new Color(0x6F6F6);
private MouseListener todayListener;
private UIDayLabel lbToday;
private int dateButtonArc;
private int dateButtonWidth;
private int dateButtonHeight;
private static final int WEEK_LABEL_WIDTH = 24;
private static final int WEEK_LABEL_HEIGHT = 24;
private final int ICON_WIDTH = 12;
/**
* 一个int类型用于判断日历是否是专门用于处理卡顿的设计器反馈箱中的日历
* 0表示是
@ -133,21 +122,6 @@ public class UICalendarPanel extends JPanel {
this.selectedDate = selectedDate;
this.isTimePicker = isTimerPicker;
calendar = Calendar.getInstance();
hoverBackground = UIManager.getColor("Calendar.hoverBackground");
pressedBackground = UIManager.getColor("Calendar.pressedBackground");
selectedBackground = UIManager.getColor("Calendar.selectedBackground");
defaultBackground = UIManager.getColor("Calendar.defaultBackground");
selectedForeground = UIManager.getColor(
"ComboBox.selectionForeground");
background = UIManager.getColor("ComboBox.background");
foreground = UIManager.getColor("ComboBox.foreground");
dateButtonArc = UIManager.getInt("Calendar.dateButton.arc");
dateButtonWidth = UIManager.getInt("Calendar.dateButton.width");
dateButtonHeight = UIManager.getInt("Calendar.dateButton.height");
dayBttListener = createDayBttListener();
//renderer this
@ -171,17 +145,14 @@ public class UICalendarPanel extends JPanel {
// << < yyyy/MM/dd > >>
private JPanel createNorthPane() {
JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
pNorth.setBackground(new Color(0xFFFFFF));
pNorth.setPreferredSize(new Dimension(pNorth.getPreferredSize().width, scale(40)));
pNorth.setOpaque(false);
pNorth.add(Box.createHorizontalStrut(5));
pNorth.add(createSkipButton(Calendar.YEAR, -1, new LazyIcon("drag_left")));
pNorth.add(Box.createHorizontalStrut(11));
UIButton monthMinus = createSkipButton(Calendar.MONTH, -1, new LazyIcon("left_arrow"));
pNorth.add(monthMinus);
monthLabel = new UILabel("", UILabel.CENTER);
monthLabel.setBackground(new Color(0xFFFFFF));
monthLabel.setForeground(new Color(0x000000));
monthLabel.setFont(FONT_UI);
pNorth.add(Box.createHorizontalGlue());
pNorth.add(monthLabel);
@ -201,8 +172,7 @@ public class UICalendarPanel extends JPanel {
private JPanel createCenterPane() {
//星期日 星期一 星期二 星期三 星期四 星期五 星期六
JPanel pWeeks = new JPanel(new GridLayout(1, 7, 9, 0));
pWeeks.setBackground(defaultBackground);
pWeeks.setOpaque(true);
pWeeks.setOpaque(false);
String[] strWeeks = new String[]{StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tue"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Wed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Thu"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Fri"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sat")
@ -210,41 +180,35 @@ public class UICalendarPanel extends JPanel {
for (int i = 1; i <= WEEKDAY_COUNT; i++) {
UILabel label = new UILabel();
label.setHorizontalAlignment(UILabel.CENTER);
label.setForeground(new Color(0x4D4C4C));
label.setFont(FONT_BLACK);
label.setText(strWeeks[i]);
label.setPreferredSize(scale(new Dimension(dateButtonWidth, dateButtonHeight)));
label.setPreferredSize(createScaleDimension(WEEK_LABEL_WIDTH, WEEK_LABEL_HEIGHT));
pWeeks.add(label);
}
pWeeks.setBorder(new ScaledEmptyBorder(3, 9, 3, 9));
//中间放日期的面板
days = new DayPane();
days.setOpaque(true);
days.setPreferredSize(scale(new Dimension(pWeeks.getPreferredSize().width, 165)));
days.setOpaque(false);
days.setPreferredSize(new Dimension(pWeeks.getPreferredSize().width, scale(165)));
JPanel pCenter = FRGUIPaneFactory.createBorderLayout_S_Pane();
pCenter.setOpaque(true);
pCenter.setOpaque(false);
pCenter.add(pWeeks, BorderLayout.NORTH);
pCenter.add(days, BorderLayout.CENTER);
//显示今天的日期,直接单击图标跳到今天
GradientPane pToday = new GradientPane(new GradientBackground(pressedBackground, pressedBackground, GradientBackground.TOP2BOTTOM), false);
pToday.setPreferredSize(new Dimension(pToday.getPreferredSize().width, scale(30)));
pToday.setLayout(new BorderLayout());
lbToday = new UIDayLabel(new Date(), false);
lbToday.setForeground(new Color(0x000000));
pToday.setBorder(FineBorderFactory.createDefaultTopBorder());
todayListener = createTodayListener(pToday, lbToday);
lbToday.setPreferredSize(new Dimension(lbToday.getPreferredSize().width, scale(30)));
lbToday.setBorder(FineBorderFactory.createDefaultTopBorder());
todayListener = createTodayListener(lbToday);
lbToday.addMouseListener(todayListener);
pToday.setBackground(defaultBackground);
pToday.add(lbToday, BorderLayout.CENTER);
pCenter.add(pToday, BorderLayout.SOUTH);
pCenter.add(lbToday, BorderLayout.SOUTH);
return pCenter;
}
private JPanel createSouthPane() {
JPanel sPane = new JPanel();
sPane.setBackground(Color.WHITE);
sPane.setOpaque(false);
sPane.setLayout(new BorderLayout());
UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":");
timeLabel.setFont(FONT_UI);
@ -252,7 +216,7 @@ public class UICalendarPanel extends JPanel {
UIButton okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")) {
public Dimension getPreferredSize() {
return scale(new Dimension(48, 24));
return createScaleDimension(48, 24);
}
public Insets getInsets() {
@ -276,13 +240,6 @@ public class UICalendarPanel extends JPanel {
return sPane;
}
public void resetHMSPaneSelectedNumberField() {
if (this.hms != null) {
this.hms.selectedNumberField = this.hms.hField;
this.hms.nextButton.requestFocus();
}
}
/**
* 创建上一月,下一月,上一年,下一年"按钮"
*
@ -304,7 +261,6 @@ public class UICalendarPanel extends JPanel {
public void mouseReleased(MouseEvent e) {
calendar.add(field, amount);
updateDays();
resetHMSPaneSelectedNumberField();
}
};
}
@ -356,10 +312,9 @@ public class UICalendarPanel extends JPanel {
}
} else {
label.addMouseListener(dayBttListener);
label.setEnabled(isCurrentMonth);
}
if (!isCurrentMonth) {
label.setForeground(LABEL_FORGE_GROUND);
FineUIStyle.setStyle(label, FineUIStyle.GRAY_BUTTON);
}
}
/**
@ -405,28 +360,19 @@ public class UICalendarPanel extends JPanel {
}
for (int i = 0; i < TOTAL_DAYS_COUNT; i++) {
setupCalendar.add(Calendar.DATE, 1);
GradientPane gp = new GradientPane(new GradientBackground(defaultBackground, defaultBackground, GradientBackground.TOP2BOTTOM), true, true);
gp.setIndex(i);
gp.setLayout(new BorderLayout());
gp.setBorder(null);
UIDayLabel label = new UIDayLabel(setupCalendar.getTime());
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setPreferredSize(new Dimension(dateButtonWidth, dateButtonHeight));
label.setIndex(i);
if ("1".equals(label.getText())) {
isCurrentMonth = !isCurrentMonth;
}
setUIDayLabel(label, isCurrentMonth, setupCalendar, logSet);
days.add(label);
//当前选择的日期
if (setupCalendar.get(Calendar.DAY_OF_MONTH) == selectedCalendar.get(Calendar.DAY_OF_MONTH) && isCurrentMonth) {
gp.setGradientBackground(new GradientBackground(selectedBackground, selectedBackground, GradientBackground.TOP2BOTTOM));
gp.add(label, BorderLayout.CENTER);
days.add(gp);
label.getModel().setSelected(true);
days.setSelectedIndex(i);
this.selectedDate = label.getDate();
this.calendar.setTime(this.selectedDate);
} else {
gp.add(label, BorderLayout.CENTER);
days.add(gp);
}
}
days.setBorder(new ScaledEmptyBorder(3, 9, 3, 9));
@ -440,30 +386,11 @@ public class UICalendarPanel extends JPanel {
}
}
protected MouseListener createTodayListener(final GradientPane jp, final UIDayLabel label) {
protected MouseListener createTodayListener(final UIDayLabel label) {
return new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
jp.setPaintGradientBackground(true);
jp.repaint();
jp.setBackground(pressedBackground);
}
@Override
public void mouseExited(MouseEvent e) {
jp.setBackground(defaultBackground);
}
@Override
public void mouseEntered(MouseEvent e) {
jp.setBackground(hoverBackground);
}
@Override
public void mouseReleased(MouseEvent e) {
jp.setBackground(defaultBackground);
jp.setPaintGradientBackground(false);
jp.repaint();
if (isTimePicker) {
UICalendarPanel.this.setSelectedDate(label.getDate());
updateDays();
@ -472,7 +399,6 @@ public class UICalendarPanel extends JPanel {
UICalendarPanel.this.setSelectedDate(label.getDate());
UICalendarPanel.this.isSupportDateChangeListener = false;
}
resetHMSPaneSelectedNumberField();
}
};
}
@ -482,12 +408,7 @@ public class UICalendarPanel extends JPanel {
public void mousePressed(MouseEvent e) {
if (isEnabled()) {
UIDayLabel com = (UIDayLabel) e.getComponent();
GradientPane gp = (GradientPane) com.getParent();
if (days.selectedIndex != -1) {
((GradientPane) days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFFFFFF), new Color(0xFFFFFF), GradientBackground.TOP2BOTTOM));
}
gp.setGradientBackground(new GradientBackground(pressedBackground, pressedBackground, GradientBackground.TOP2BOTTOM));
days.setSelectedIndex(gp.getIndex());
days.setSelectedIndex(com.getIndex());
}
}
@ -501,29 +422,21 @@ public class UICalendarPanel extends JPanel {
UICalendarPanel.this.setSelectedDate(com.getDate());
UICalendarPanel.this.isSupportDateChangeListener = false;
}
resetHMSPaneSelectedNumberField();
}
public void mouseEntered(MouseEvent e) {
if (isEnabled()) {
JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() == days.selectedIndex) {
UIDayLabel com = (UIDayLabel) e.getComponent();
if (com.getIndex() == days.selectedIndex) {
return;
}
gp.setGradientBackground(new GradientBackground(hoverBackground, hoverBackground, GradientBackground.TOP2BOTTOM));
days.setFloatIndex(gp.getIndex());
days.setFloatIndex(com.getIndex());
}
}
public void mouseExited(MouseEvent e) {
if (isEnabled()) {
JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() != days.selectedIndex) {
gp.setGradientBackground(new GradientBackground(defaultBackground, defaultBackground, GradientBackground.TOP2BOTTOM));
}
days.setFloatIndex(-1);
days.repaint();
}
@ -567,66 +480,6 @@ public class UICalendarPanel extends JPanel {
return selectedDate;
}
private class GradientPane extends JPanel {
private int index;
private boolean isGradientBackground;
private boolean roundPane = false;
private GradientBackground gradientBackground;
public GradientPane() {
}
public GradientPane(GradientBackground gradientBackground, boolean isGradientBackground) {
super();
this.gradientBackground = gradientBackground;
this.isGradientBackground = isGradientBackground;
}
public GradientPane(GradientBackground gradientBackground, boolean isGradientBackground, boolean roundPane) {
super();
this.gradientBackground = gradientBackground;
this.isGradientBackground = isGradientBackground;
this.roundPane = roundPane;
}
public void paint(Graphics g) {
if (roundPane) {
RoundRectangle2D rect = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), dateButtonArc, dateButtonArc);
g.setClip(rect);
}
super.paint(g);
if (isGradientBackground && gradientBackground != null) {
gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight()));
}
paintChildren(g);
}
public void setPaintGradientBackground(boolean flag) {
this.isGradientBackground = flag;
}
public void setGradientBackground(GradientBackground gradientBackground) {
this.gradientBackground = gradientBackground;
}
public void setIndex(int i) {
this.index = i;
}
public int getIndex() {
return this.index;
}
public void setForeground(Color c) {
super.setForeground(c);
if (getComponentCount() > 0) {
getComponent(0).setForeground(c);
}
}
}
private class DayPane extends JPanel {
private Color floatColor = new Color(0xC5E2F9);
private int floateIndex;
@ -636,7 +489,6 @@ public class UICalendarPanel extends JPanel {
floateIndex = -1;
selectedIndex = -1;
this.setLayout(new GridLayout(6, 7, scale(9), scale(3)));
this.setBackground(defaultBackground);
}
@ -647,9 +499,6 @@ public class UICalendarPanel extends JPanel {
if (floateIndex > -1) {
g.setColor(floatColor);
}
if (selectedIndex > -1) {
g.setColor(selectedBackground);
}
g.setColor(oldColor);
}
@ -659,12 +508,6 @@ public class UICalendarPanel extends JPanel {
}
public void setSelectedIndex(int index) {
if (this.selectedIndex != -1 && this.selectedIndex < getComponentCount()) {
this.getComponent(selectedIndex).setForeground(Color.black);
}
if (index != -1 && index < getComponentCount()) {
this.getComponent(index).setForeground(Color.WHITE);
}
this.selectedIndex = index;
repaint();
}
@ -673,12 +516,9 @@ public class UICalendarPanel extends JPanel {
private class HMSPane extends JPanel {
private boolean isRolOver;
private UIButton preButton;
private UIButton nextButton;
private CalendarNumberField hField;
private CalendarNumberField mField;
private CalendarNumberField sField;
private CalendarNumberField selectedNumberField;
public HMSPane() {
this.setLayout(new BorderLayout(0, 0));
@ -707,36 +547,62 @@ public class UICalendarPanel extends JPanel {
hField = new CalendarNumberField(23);
mField = new CalendarNumberField(59);
sField = new CalendarNumberField(59);
selectedNumberField = hField;
this.add(row(cell(combineFieldArrowPane(hField)), cell(createGapLabel()), cell(combineFieldArrowPane(mField)),
cell(createGapLabel()), cell(combineFieldArrowPane(sField)), fix(4)).getComponent(), BorderLayout.CENTER);
}
private JPanel combineFieldArrowPane(CalendarNumberField field) {
JPanel panel = new JPanel(new BorderLayout());
panel.setOpaque(false);
Insets insets = FineUIUtils.getUIInsets("InputTextField.borderInsets", defaultInsets);
field.setBorder(new ScaledEmptyBorder(insets.top, insets.left, insets.bottom, insets.right));
UIButton preButton = createArrowButton(new LazyIcon("up_arrow", ICON_WIDTH));
UIButton nextButton = createArrowButton(new LazyIcon("down_arrow", ICON_WIDTH));
JPanel arrowPane = new JPanel();
arrowPane.setPreferredSize(createScaleDimension(12, 24));
arrowPane.setLayout(new GridLayout(2, 1));
arrowPane.add(preButton);
arrowPane.add(nextButton);
arrowPane.setOpaque(false);
panel.add(field, BorderLayout.CENTER);
panel.add(arrowPane, BorderLayout.EAST);
panel.setBorder(new FineRoundBorder());
nextButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
field.setValue(field.getIntValue() - 1);
field.requestFocus();
field.selectAll();
preButton = new UIButton(UIConstants.ARROW_UP_ICON) {
public boolean shouldResponseChangeListener() {
return false;
}
};
preButton.setRoundBorder(true, Constants.LEFT);
nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON) {
});
preButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
field.setValue(field.getIntValue() + 1);
field.requestFocus();
field.selectAll();
}
});
return panel;
}
private UIButton createArrowButton(Icon icon) {
UIButton arrowButton = new UIButton(icon) {
public boolean shouldResponseChangeListener() {
return false;
}
};
nextButton.setRoundBorder(true, Constants.LEFT);
JPanel arrowPane = new JPanel();
arrowPane.setPreferredSize(scale(new Dimension(12, 24)));
arrowPane.setLayout(new GridLayout(2, 1));
arrowPane.add(preButton);
arrowPane.add(nextButton);
this.add(row(cell(hField), cell(createGapLabel()), cell(mField), cell(createGapLabel()), cell(sField), fix(4)).getComponent(), BorderLayout.CENTER);
this.add(arrowPane, BorderLayout.EAST);
setStyle(arrowButton, STYLE_TEXT);
return arrowButton;
}
private void initListener() {
MouseAdapter backgroundAdapter = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
HMSPane.this.selectedNumberField = (CalendarNumberField) e.getComponent();
}
@Override
public void mouseExited(MouseEvent e) {
isRolOver = false;
@ -752,23 +618,6 @@ public class UICalendarPanel extends JPanel {
hField.addMouseListener(backgroundAdapter);
mField.addMouseListener(backgroundAdapter);
sField.addMouseListener(backgroundAdapter);
nextButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
HMSPane.this.selectedNumberField.setValue(HMSPane.this.selectedNumberField.getIntValue() - 1);
HMSPane.this.selectedNumberField.requestFocus();
HMSPane.this.selectedNumberField.selectAll();
}
});
preButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
HMSPane.this.selectedNumberField.setValue(HMSPane.this.selectedNumberField.getIntValue() + 1);
HMSPane.this.selectedNumberField.requestFocus();
HMSPane.this.selectedNumberField.selectAll();
}
});
}
private JPanel createGapLabel() {

3
designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java

@ -235,9 +235,6 @@ public class UIDatePicker extends UIComboBox implements Serializable {
if (willHide || UIDatePicker.this.isEnabled() == false) {
return;
}
if (calendarPanel != null) {
calendarPanel.resetHMSPaneSelectedNumberField();
}
super.show();
}

28
designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java

@ -1,17 +1,28 @@
package com.fr.design.gui.date;
import com.fine.theme.utils.FineUIStyle;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.DesignUtils;
import java.awt.Insets;
import java.text.SimpleDateFormat;
import java.util.Date;
import static com.fine.theme.utils.FineUIScale.scale;
public class UIDayLabel extends UILabel {
/**
* 日期控件day label
* @author lemon
* @since
* Created on
*/
public class UIDayLabel extends UIButton {
private static final String UI_CLASS_ID = "DayLabelUI";
private Date date = null;
private int index;
/**
* 日期格式TODAY/TIP用
@ -27,8 +38,10 @@ public class UIDayLabel extends UILabel {
}
public UIDayLabel(Date date, boolean isSmallLabel) {
FineUIStyle.setStyle(this, FineUIStyle.ORIGINAL_BUTTON);
setHorizontalAlignment(UILabel.CENTER);
setFont(DesignUtils.getDefaultGUIFont().applySize(scale(12)));
setMargin(new Insets(0, 0, 0, 0));
this.date = date;
if (isSmallLabel) {
setText(dayFormat.format(date));
@ -46,4 +59,17 @@ public class UIDayLabel extends UILabel {
this.date = date;
}
public void setIndex(int i) {
this.index = i;
}
public int getIndex() {
return this.index;
}
@Override
public String getUIClassID() {
return UI_CLASS_ID;
}
}

1
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties

@ -7,6 +7,7 @@ ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI
ComboBoxUI=com.fine.theme.light.ui.FineComboBoxUI
DesktopIconUI=com.formdev.flatlaf.ui.FlatDesktopIconUI
DesktopPaneUI=com.formdev.flatlaf.ui.FlatDesktopPaneUI
DayLabelUI=com.fine.theme.light.ui.FineDayLabelUI
EditorPaneUI=com.formdev.flatlaf.ui.FlatEditorPaneUI
FileChooserUI=com.formdev.flatlaf.ui.FlatFileChooserUI
FormattedTextFieldUI=com.formdev.flatlaf.ui.FlatFormattedTextFieldUI

17
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -411,13 +411,7 @@ Label.warningColor = #F1393C
Label.secondaryColor = #0A1C38A8
# ---- Calendar ----
Calendar.hoverBackground = #E6E9EF
Calendar.pressedBackground = #DADEE7
Calendar.selectedBackground = #2576EF
Calendar.defaultBackground = $fill.normal
Calendar.dateButton.arc = 6
Calendar.dateButton.width = 24
Calendar.dateButton.height = 24
Calendar.day.selectedBackground = #2576EF
#---- HelpButton ----
@ -1411,9 +1405,16 @@ chart.selectedBorderColor = #2576EF
[style]Button.originalButton = \
borderColor: null; \
background: null; \
background: $fill.normal; \
hoverBorderColor: null;
[style]Button.grayButton = \
foreground: fade(@foreground, 29%); \
borderColor: null; \
background: $fill.normal; \
hoverBorderColor: null;
[style]Label.detailLabel = \
foreground: fade(@foreground, 90%); \
background: $fill.normal;

Loading…
Cancel
Save