diff --git a/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java b/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java index ce3a2f9da..c4762f255 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java +++ b/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java @@ -168,7 +168,7 @@ public class JWizardPanel extends BasicPane { public void addNotify() { if (firstNotify) { Font font = stepTitleLabel.getFont(); - font = font.deriveFont(Font.BOLD, font.getSize() * 14 / 10.0F); + font = font.deriveFont(Font.BOLD, (float) (font.getSize() * 14 / 10.0D)); stepTitleLabel.setFont(font); firstNotify = false; } diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 5a722239c..e83cc85d4 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -398,8 +398,8 @@ public class MutilTempalteTabPane extends JComponent { //画下面的那条线 if (templateStartX < maxWidth) { GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); - generalPath.moveTo((float) templateStartX, getHeight() - 1.0F); - generalPath.lineTo((float) maxWidth, getHeight() - 1.0F); + generalPath.moveTo((float) templateStartX, (float) (getHeight() - 1.0D)); + generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1.0D)); g2d.fill(generalPath); //TODO hzzz delete // g2d.setPaint(UIConstants.LINE_COLOR); @@ -409,7 +409,7 @@ public class MutilTempalteTabPane extends JComponent { private void paintDefaultBackground(Graphics2D g2d) { //画默认背景 - g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, getHeight() - 1.0F, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, (float) (getHeight() - 1.0D), UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); g2d.fillRect(0, 0, getWidth(), getHeight()); } @@ -535,7 +535,7 @@ public class MutilTempalteTabPane extends JComponent { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1}; RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7); - g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, getHeight() - 1.0F, UIConstants.SELECT_TAB)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, (float) (getHeight() - 1.0D), UIConstants.SELECT_TAB)); //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 double specialLocation1 = 2.5; double specialLocation2 = 4.330127; @@ -590,9 +590,9 @@ public class MutilTempalteTabPane extends JComponent { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; if (selfIndex == mouseOveredIndex) { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1.0F, UIConstants.HOVER_BLUE)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, (float) (getHeight() - 1.0D), UIConstants.HOVER_BLUE)); } else { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1.0F, UIConstants.SHADOW_GREY)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, (float) (getHeight() - 1.0D), UIConstants.SHADOW_GREY)); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java index 6a92f5057..6b406588b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java @@ -176,11 +176,11 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { - gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1f, UIConstants.AUTHORITY_DARK_BLUE); + gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1F, UIConstants.AUTHORITY_DARK_BLUE); } else if (isPressedPainted) { - gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB); + gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1F, UIConstants.SELECT_TAB); }else{ - gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); + gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER); } fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC); @@ -189,11 +189,11 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { - gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); + gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1F, UIConstants.HOVER_BLUE); } else if (isPressedPainted) { - gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); + gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER); }else { - gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); + gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER); } fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC); } @@ -225,4 +225,4 @@ public class UISliderButtonUI extends BasicButtonUI { g2d.setColor(oldColor); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java index 4e50dd994..ce609cde8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java @@ -162,12 +162,12 @@ public class UITabButton extends UILabel implements UISelectedComponent { Color blue = UIConstants.LIGHT_BLUE; g2d.setColor(blue); g2d.fillRect(0, 1, w - 1, h / 2); - GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1, blue); + GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1F, blue); g2d.setPaint(gp); g2d.fillRect(0, h / 2, w - 1, h / 2); this.setForeground(UIConstants.FONT_COLOR); } else if (!isSelected() && !isRollover) { - GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1, DOWN); + GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1F, DOWN); g2d.setPaint(gp); g2d.fillRect(0, h / 2, w - 1, h / 2); this.setForeground(UIConstants.FONT_COLOR); @@ -178,4 +178,4 @@ public class UITabButton extends UILabel implements UISelectedComponent { } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java index 45c878419..2ba4f0243 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java @@ -220,7 +220,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{ protected void paintOtherBorder(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setStroke(UIConstants.BS); - Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1F, getHeight() - 1F, UIConstants.ARC, UIConstants.ARC); g2d.setColor(UIConstants.LINE_COLOR); g2d.draw(shape); } @@ -252,4 +252,4 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{ return true; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java index 74cd42a7e..ca4eddfe3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java @@ -3,6 +3,11 @@ */ package com.fr.design.gui.icombobox; +import com.fr.base.FRContext; +import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; +import com.fr.general.FRFont; +import com.fr.stable.Constants; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; @@ -11,18 +16,10 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; - import javax.swing.DefaultComboBoxModel; import javax.swing.JLabel; import javax.swing.JList; -import com.fr.base.FRContext; -import com.fr.base.GraphHelper; -import com.fr.base.ScreenResolution; -import com.fr.general.FRFont; - -import com.fr.stable.Constants; - /** * Combobox for selecting line styles. @@ -88,13 +85,13 @@ public class LineComboBox extends UIComboBox { FontMetrics fm = GraphHelper.getFontMetrics(rfont); if (style == Constants.LINE_NONE) { //draw "none" string - GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2 + fm.getAscent()); + GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2D + fm.getAscent()); } else { - GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2, style); + GraphHelper.drawLine(g2d, 4, d.height / 2D, d.width - 8D, d.height / 2D, style); } if(isShowAxisWithLineStyle()) { // 带有坐标轴箭头的样式. - drawArrow(g2d, new Point2D.Double(4, d.height / 2), new Point2D.Double(d.width - 8, d.height/2)); + drawArrow(g2d, new Point2D.Double(4, d.height / 2D), new Point2D.Double(d.width - 8D, d.height / 2D)); } } @@ -142,4 +139,4 @@ public class LineComboBox extends UIComboBox { private int style = Constants.LINE_NONE; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java index 9f96f655e..6130050dc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java @@ -172,11 +172,9 @@ public class UIComboBoxButton extends JButton { } c.setBackground(UIManager.getColor("ComboBox.focusBackground")); if (c instanceof JComponent) { - mustResetOpaque = true; JComponent jc = (JComponent) c; - savedOpaque = jc.isOpaque(); + jc.isOpaque(); jc.setOpaque(true); - paintFocus = true; } } else { c.setForeground(comboBox.getForeground()); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index eadb94109..4d844336f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -46,7 +46,7 @@ public class UIModeControlContainer extends JLayeredPane { private boolean isHideMode = false; private boolean isSheeetCovered = false; - private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 30 / 100.0F); + private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f); public UIModeControlContainer() { this(new JPanel(), new JPanel()); diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java index 844120c51..a14de81c5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java @@ -287,7 +287,7 @@ public class UIBasicMenuItemUI extends MenuItemUI { View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { d = getPreferredSize(c); - d.width -= v.getPreferredSpan(View.X_AXIS) - v.getMinimumSpan(View.X_AXIS); + d.width -= (double) v.getPreferredSpan(View.X_AXIS) - (double) v.getMinimumSpan(View.X_AXIS); } return d; } @@ -345,7 +345,7 @@ public class UIBasicMenuItemUI extends MenuItemUI { View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { d = getPreferredSize(c); - d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS); + d.width += (double) v.getMaximumSpan(View.X_AXIS) - (double) v.getPreferredSpan(View.X_AXIS); } return d; } @@ -816,7 +816,6 @@ public class UIBasicMenuItemUI extends MenuItemUI { // get Accelerator text KeyStroke accelerator = b.getAccelerator(); String acceleratorText = ""; - drawMenu(acceleratorText, accelerator, c, ic, maxValue, offset, paintIcon, b); String text = layoutMenuItem(fm, b.getText(), fmAccel, acceleratorText, ic, null, arrowIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, @@ -834,43 +833,6 @@ public class UIBasicMenuItemUI extends MenuItemUI { g.setFont(holdf); } - private void drawMenu(String acceleratorText, KeyStroke accelerator, JComponent c, - Icon ic, int maxValue, int offset, Icon paintIcon, JMenuItem b) { - if (accelerator != null) { - int modifiers = accelerator.getModifiers(); - if (modifiers > 0) { - acceleratorText = KeyEvent.getKeyModifiersText(modifiers); - //acceleratorText += "-"; - acceleratorText += acceleratorDelimiter; - } - - int keyCode = accelerator.getKeyCode(); - if (keyCode != 0) { - acceleratorText += KeyEvent.getKeyText(keyCode); - } else { - acceleratorText += accelerator.getKeyChar(); - } - } - if (!isTopLevelMenu()) { - if (c instanceof JCheckBoxMenuItem || c instanceof JRadioButtonMenuItem) { - ic = checkIcon; - if (checkIcon.getIconWidth() < maxValue) { - ic = new EmptyIcon(maxValue, checkIcon.getIconHeight()); - offset = (maxValue - checkIcon.getIconWidth()) / 2; - } - paintIcon = null; - } else if (c instanceof JMenuItem) { - if (ic == null || ic.getIconWidth() < maxValue) { - int height = (ic == null) ? 2 : b.getIcon().getIconHeight(); - int width = (ic == null) ? 2 : b.getIcon().getIconWidth(); - offset = (maxValue - width) / 2; - ic = new EmptyIcon(maxValue, height); - } - } - } - } - - private void drawAccText(String acceleratorText, Graphics g, JComponent p, ButtonModel model, FontMetrics fmAccel, JComponent c) { if (acceleratorText != null && !ComparatorUtils.equals(acceleratorText, "")) { //Get the maxAccWidth from the parent to calculate the offset. diff --git a/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java b/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java index d950e91ed..938e0cacc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java @@ -157,8 +157,7 @@ public class UIMenuTable extends JTable { @Override public TableCellRenderer getDefaultRenderer(Class columnClass) { - columnClass = UITable.class; - return super.getDefaultRenderer(columnClass); + return super.getDefaultRenderer(UITable.class); } private class UITableRender implements TableCellRenderer { diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java index c4df50e82..30074f563 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java @@ -72,6 +72,7 @@ public class UIProgressBorder extends UIRoundedBorder { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } + @SuppressWarnings("squid:S2164") private void paintBorderShadow(Graphics2D g2, int shadowWidth, int x, int y, int width, int height) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); shadowWidth = Math.max(shadowWidth, 2); @@ -85,6 +86,7 @@ public class UIProgressBorder extends UIRoundedBorder { } } + @SuppressWarnings("squid:S2164") private static Color getMixedColor(Color c1, float pct1, Color c2, float pct2) { float[] clr1 = c1.getComponents(null); float[] clr2 = c2.getComponents(null); diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java index 851f90797..821ebbc33 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java @@ -165,50 +165,6 @@ public class UIBasicScrollBarUI extends BasicScrollBarUI { // drawColorAndLength(g, t, x2, y2, color); } - private void drawColorAndLength(Graphics g, Rectangle t, int x2, int y2, Color color) { - - if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { - int y1 = t.y + (t.height) / 2 - 4; - y2 = Math.min(y1 + 8, t.y + t.height - 5); - - int y = y1; - // we take only saturation & brightness and apply them - // to the background color (normal/rollover/pressed) - g.setColor(UISBChooser.getAdjustedColor(color, 0, 71)); - while (y < y2) { - g.drawLine(5, y, 11, y); - y += 2; - } - - y = y1 + 1; - g.setColor(UISBChooser.getAdjustedColor(color, 0, -13)); - while (y < y2) { - g.drawLine(6, y, 12, y); - y += 2; - } - } else { - int x1 = t.x + (t.width) / 2 - 4; - x2 = Math.min(x1 + 8, t.x + t.width - 5); - - int x = x1 + 1; - // we take only saturation & brightness and apply them - // to the background color (normal/rollover/pressed) - g.setColor(UISBChooser.getAdjustedColor(color, 0, 71)); - while (x < x2) { - g.drawLine(x, 5, x, 11); - x += 2; - } - - x = x1; - g.setColor(UISBChooser.getAdjustedColor(color, 0, -13)); - while (x < x2) { - g.drawLine(x, 6, x, 12); - x += 2; - } - } - } - - private void drawVertical(Graphics g, Rectangle t, int xs, int ys, int x2, Color pressedColor, Color rolloverColor, Color normalColor) { diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java index a6ba74283..c780eeb2d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java @@ -90,6 +90,7 @@ public class UISBChooser extends JDialog { (frame.getHeight() - getSize().height) / 2); } + @SuppressWarnings("squid:S1226") private void initP3(JPanel p3, JPanel p1) { p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 3, 8)); p3.add(new JLabel("R:")); @@ -198,6 +199,7 @@ public class UISBChooser extends JDialog { twoColorField.setUpperColor(outColor); } + @SuppressWarnings("squid:S2164") public static Color getAdjustedColor(Color inColor, int sat, int bri) { Color briColor = inColor; @@ -219,9 +221,9 @@ public class UISBChooser extends JDialog { int dg = briColor.getGreen() - satColor.getGreen(); int db = briColor.getBlue() - satColor.getBlue(); - r = briColor.getRed() - (int) Math.round(dr * sat / VALUE * 1.0); - g = briColor.getGreen() - (int) Math.round(dg * sat / VALUE * 1.0); - b = briColor.getBlue() - (int) Math.round(db * sat / VALUE * 1.0); + r = briColor.getRed() - (int) Math.round(dr * sat / (VALUE * 1.0)); + g = briColor.getGreen() - (int) Math.round(dg * sat / (VALUE * 1.0)); + b = briColor.getBlue() - (int) Math.round(db * sat / (VALUE * 1.0)); } else { float d = ColorRoutines.getGreyValue(briColor); float dr = briColor.getRed() - d; diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java index 4ee6fe978..b201365a8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java @@ -656,7 +656,7 @@ public class SyntaxView extends View implements TabExpander, if (tabSize == 0) return x; int ntabs = (((int) x) - tabBase) / tabSize; - return tabBase + ((ntabs + 1) * tabSize); + return (float) (tabBase + ((ntabs + 1) * tabSize)); } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java index 189501894..0d3b493dd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java @@ -9,6 +9,7 @@ package com.fr.design.gui.syntax.ui.rsyntaxtextarea; import java.util.Iterator; +import java.util.NoSuchElementException; /** @@ -73,6 +74,9 @@ class TokenIterator implements Iterator { token = null; } } + else { + throw new NoSuchElementException(); + } return t; } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java index e99208afc..97e367ef0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java @@ -268,7 +268,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, if (host.getEOLMarkersVisible()) { g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE)); - g.drawString("\u00B6", x, y-fontHeight); + g.drawString("\u00B6", x, (float) (y-fontHeight)); } } @@ -458,7 +458,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, if (host.getEOLMarkersVisible()) { g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE)); - g.drawString("\u00B6", x, y-fontHeight); + g.drawString("\u00B6", x, (float) (y-fontHeight)); } } @@ -841,10 +841,11 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, * @return the tab stop, measured in points >= 0 */ public float nextTabStop(float x, int tabOffset) { - if (tabSize == 0) + if (tabSize == 0) { return x; + } int ntabs = ((int) x - tabBase) / tabSize; - return tabBase + ((ntabs + 1) * tabSize); + return (float) (tabBase + ((ntabs + 1) * tabSize)); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java index 5a4ba1eda..a41f03a9d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java @@ -69,7 +69,7 @@ public class LogHandlerBarUI extends ComponentUI implements MouseListener, Focus int w = button.getWidth(); int h = button.getHeight(); Graphics2D g2d = (Graphics2D) g; - GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, h - 1, darkColor); + GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, h - 1f, darkColor); g2d.setPaint(gp); g2d.fillRect(0, 0, w, h); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index 15d8bae63..8216ad573 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -31,7 +31,7 @@ import java.util.List; public class FileVersionDialog extends UIDialog { - public static final long DELAY = 24 * 60 * 60 * 1000; + public static final long DELAY = 24 * 60 * 60 * 1000L; private UIButton okBtn; private UIButton cancelBtn; private DateEditor dateEditor; diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java index ffb4e1eb0..886076ca0 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java @@ -159,15 +159,15 @@ public class PatternBackgroundPane extends BPane { Dimension d = getSize(); this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, - d.width - 1, d.height - 1)); + d.width - 1d, d.height - 1d)); if (this.pIndex == patternIndex) {// it's selected. g2d.setPaint(new Color(255, 51, 0)); } else { g2d.setPaint(Color.gray); } - GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, - d.height - 1)); + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1d, + d.height - 1d)); } public Dimension getPreferredSize() { diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java index 8c99a89cd..3dd59bd5b 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java @@ -152,8 +152,8 @@ public class TextureBackgroundPane extends BPane { Dimension d = getSize(); g2d.setPaint(this.buttonTexturePaint); - GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1, - d.height - 1)); + GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1d, + d.height - 1d)); if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's // selected. @@ -161,8 +161,8 @@ public class TextureBackgroundPane extends BPane { } else { g2d.setPaint(Color.gray); } - GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, - d.height - 1)); + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1d, + d.height - 1d)); } public Dimension getPreferredSize() { diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index 79ecdc946..c7cf4f783 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java @@ -332,8 +332,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec * @param p The point where the MouseEvent occurred. */ private void updateS(Point p) { - float h = p.x * 1f / IMG_WIDTH; - float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; + double h = p.x * 1D / IMG_WIDTH; + double b = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT; internalChange = true; hSpinner.setValue(new Integer((int) (h * H_MAX))); @@ -349,8 +349,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec * @param p The point where the MouseEvent occurred. */ private void updateB(Point p) { - float h = p.x * 1f / IMG_WIDTH; - float s = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; + double h = p.x * 1D / IMG_WIDTH; + double s = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT; internalChange = true; hSpinner.setValue(new Integer((int) (h * H_MAX))); @@ -523,9 +523,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec private void adjustHSLValue(float[] hsbVals) { if (!spinnerTrigger) { - hSpinner.setValue(new Integer((int) (hsbVals[0] * HSPINNER_VALUE))); - sSpinner.setValue(new Integer((int) (hsbVals[1] * SSPINNER_VALUE))); - bSpinner.setValue(new Integer((int) (hsbVals[2] * LSPINNER_VALUE))); + hSpinner.setValue(new Integer((int) ((double) hsbVals[0] * HSPINNER_VALUE))); + sSpinner.setValue(new Integer((int) ((double) hsbVals[1] * SSPINNER_VALUE))); + bSpinner.setValue(new Integer((int) ((double) hsbVals[2] * LSPINNER_VALUE))); } switch (locked) { case HLOCKED: @@ -534,9 +534,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec } if (!handlingMouse) { gradientPoint.x = (int) ((1 - - ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_WIDTH); + - ((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE) * IMG_WIDTH); gradientPoint.y = (int) ((1 - - ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); + - ((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE) * IMG_HEIGHT); } break; case SLOCKED: @@ -544,9 +544,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec slider.setValue(((Number) sSpinner.getValue()).intValue()); } if (!handlingMouse) { - gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); + gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE * IMG_WIDTH); gradientPoint.y = (int) ((1 - - ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); + - ((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE) * IMG_HEIGHT); } break; case BLOCKED: @@ -554,18 +554,18 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec slider.setValue(((Number) bSpinner.getValue()).intValue()); } if (!handlingMouse) { - gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); + gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE * IMG_WIDTH); gradientPoint.y = (int) ((1 - - ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_HEIGHT); + - ((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE) * IMG_HEIGHT); } break; } } private void updateImageAndTrack() { - float h = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; - float s = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; - float b = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; + float h = (float) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE); + float s = (float) (((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE); + float b = (float) (((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE); spinnerTrigger = true; getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b))); @@ -837,12 +837,12 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec private void updateHLockImage() { int index = 0; int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; - float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; + float hValue = (float)(((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE ); for (int j = 0; j < IMG_HEIGHT; j++) { for (int i = 0; i < IMG_WIDTH; i++) { - pix[index++] = Color.HSBtoRGB(hValue, (IMG_WIDTH - i * 1f) / IMG_WIDTH, - (IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR); + pix[index++] = Color.HSBtoRGB(hValue, (float) ((IMG_WIDTH - i * 1D) / IMG_WIDTH), + (float) ((IMG_HEIGHT - j * 1D) / IMG_HEIGHT)) | (BINARY_FOR_EIGHT << TWENTY_FOUR); } } @@ -1076,4 +1076,4 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec public void colorSetted(ColorCell cc) { } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index 0ccff309f..f1f0a293d 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -1209,7 +1209,7 @@ public class GridUI extends ComponentUI { * @return 有效返回true */ public static boolean validate(Rectangle2D rect) { - return rect != null && rect.getX() != INVALID_INTEGER; + return rect != null && ComparatorUtils.equals(rect.getX(), INVALID_INTEGER); } @@ -1268,4 +1268,4 @@ public class GridUI extends ComponentUI { paginateLineList.add(new Line2D.Double(0, sumHeight, width, sumHeight)); } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java b/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java index 89509b994..4529465c7 100644 --- a/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java +++ b/designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java @@ -141,7 +141,7 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader { ImageFrame imageFrame = loader.load(i, w, h, preserveRatio, smooth); images[i] = convert(imageFrame); synchronized (this) { - this.notify(); + notifyAll(); } } } catch (ImageStorageException e) {