Browse Source

REPORT-70458 tab的悬浮状态不正确

feature/x
hades 2 years ago
parent
commit
539d6465d0
  1. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  2. 20
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java

14
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java

@ -360,6 +360,7 @@ public class AlphaFineFrame extends JFrame {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
for (SelectedLabel label : selectedLabelList) { for (SelectedLabel label : selectedLabelList) {
label.setSelected(false); label.setSelected(false);
label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8);
} }
selectedLabel.setSelected(true); selectedLabel.setSelected(true);
tabLabel.setText(selectedLabel.getText()); tabLabel.setText(selectedLabel.getText());
@ -394,6 +395,19 @@ public class AlphaFineFrame extends JFrame {
} }
} }
} }
private Color defaultColor;
@Override
public void mouseEntered(MouseEvent e) {
defaultColor = selectedLabel.getForeground();
selectedLabel.setForeground(AlphaFineConstants.SUSPENDED_COLOR);
}
@Override
public void mouseExited(MouseEvent e) {
selectedLabel.setForeground(defaultColor);
}
}); });
tabPane.add(selectedLabel); tabPane.add(selectedLabel);
} }

20
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java

@ -1,22 +1,14 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.AlphaFineUtil;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager;
import com.fr.design.menu.SnapChatUtil;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.geom.Ellipse2D;
import java.util.List;
import java.util.Set;
/** /**
* @author hades * @author hades
@ -30,7 +22,6 @@ public class SelectedLabel extends UILabel {
private static final int GAP = 2; private static final int GAP = 2;
private boolean selected; private boolean selected;
private boolean hasRead;
private CellType cellType; private CellType cellType;
public SelectedLabel(String text, CellType cellType, boolean selected) { public SelectedLabel(String text, CellType cellType, boolean selected) {
@ -53,11 +44,8 @@ public class SelectedLabel extends UILabel {
g2d.setColor(UIConstants.FLESH_BLUE); g2d.setColor(UIConstants.FLESH_BLUE);
setForeground(UIConstants.FLESH_BLUE); setForeground(UIConstants.FLESH_BLUE);
g2d.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1); g2d.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1);
} else {
setForeground(AlphaFineConstants.FOREGROUND_COLOR_8);
} }
if (cellType == CellType.PRODUCT_NEWS && AlphaFineUtil.unread()) { if (cellType == CellType.PRODUCT_NEWS && AlphaFineUtil.unread()) {
Color oldColor = g.getColor(); Color oldColor = g.getColor();
g2d.setColor(Color.RED); g2d.setColor(Color.RED);
@ -77,14 +65,6 @@ public class SelectedLabel extends UILabel {
this.selected = selected; this.selected = selected;
} }
public boolean isHasRead() {
return hasRead;
}
public void setHasRead(boolean hasRead) {
this.hasRead = hasRead;
}
public CellType getCellType() { public CellType getCellType() {
return cellType; return cellType;
} }

Loading…
Cancel
Save