|
|
@ -1,7 +1,9 @@ |
|
|
|
package com.fr.design.mainframe.alphafine.question; |
|
|
|
package com.fr.design.mainframe.alphafine.question; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.svg.SVGLoader; |
|
|
|
import com.fr.base.svg.SVGLoader; |
|
|
|
|
|
|
|
import com.fr.base.svg.SystemScaleUtils; |
|
|
|
import com.fr.design.mainframe.alphafine.AlphaFineUtil; |
|
|
|
import com.fr.design.mainframe.alphafine.AlphaFineUtil; |
|
|
|
|
|
|
|
import com.fr.design.utils.SvgPaintUtils; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Graphics; |
|
|
@ -23,6 +25,10 @@ public class QuestionPane extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg"); |
|
|
|
private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final int WIDTH = 40; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final int HEIGHT = 40; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public QuestionPane() { |
|
|
|
public QuestionPane() { |
|
|
|
this.setBackground(new Color(0, 0, 0, 0)); |
|
|
|
this.setBackground(new Color(0, 0, 0, 0)); |
|
|
@ -34,14 +40,21 @@ public class QuestionPane extends JPanel { |
|
|
|
Graphics2D g2 = (Graphics2D) g; |
|
|
|
Graphics2D g2 = (Graphics2D) g; |
|
|
|
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
|
|
|
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
|
|
|
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
|
|
|
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
|
|
|
|
|
|
|
SvgPaintUtils.beforePaint(g2); |
|
|
|
|
|
|
|
// 宽高保持
|
|
|
|
|
|
|
|
int width = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getWidth() * SVGLoader.SYSTEM_SCALE) : getWidth(); |
|
|
|
|
|
|
|
int height = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getHeight() * SVGLoader.SYSTEM_SCALE) : getHeight(); |
|
|
|
|
|
|
|
|
|
|
|
if (AlphaFineUtil.unread()) { |
|
|
|
if (AlphaFineUtil.unread()) { |
|
|
|
g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, getWidth(), getHeight(), this); |
|
|
|
g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, width, height, this); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, getWidth(), getHeight(), this); |
|
|
|
g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, width, height, this); |
|
|
|
} |
|
|
|
} |
|
|
|
int imageWidth = (int) (QUESTION_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE); |
|
|
|
|
|
|
|
int imageHeight = (int) (QUESTION_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE); |
|
|
|
int imageWidth = QUESTION_IMAGE.getWidth(this); |
|
|
|
g2.drawImage(QUESTION_IMAGE, (getWidth() - imageWidth) / 2, (getHeight() - imageHeight) / 2, imageWidth, imageHeight, this); |
|
|
|
int imageHeight = QUESTION_IMAGE.getHeight(this); |
|
|
|
|
|
|
|
g2.drawImage(QUESTION_IMAGE, (width - imageWidth) / 2, (height - imageHeight) / 2, imageWidth, imageHeight,this); |
|
|
|
|
|
|
|
SvgPaintUtils.afterPaint(g2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|