Browse Source

REPORT-2897 9.0设计器修改

缩放条部分视觉优化
master
MoMeak 7 years ago
parent
commit
010b07270f
  1. 4
      designer_base/src/com/fr/design/locale/designer.properties
  2. 4
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  3. 4
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  4. 4
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  5. 4
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  6. 4
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  7. 120
      designer_base/src/com/fr/design/mainframe/JFormSliderPane.java
  8. 28
      designer_base/src/com/fr/design/mainframe/JSliderPane.java

4
designer_base/src/com/fr/design/locale/designer.properties

@ -2098,3 +2098,7 @@ FR-Designer_Insert_Image=Insert_Image
FR-Designer_Insert-Chart=Insert-Chart FR-Designer_Insert-Chart=Insert-Chart
FR-Designer_Insert-Text=Insert-Text FR-Designer_Insert-Text=Insert-Text
FR-Designer_Insert_Formula=Insert_Formula FR-Designer_Insert_Formula=Insert_Formula
FR-Designer_Scale_Down=Scale_Down
FR-Designer_Scale_Up=Scale_Up
FR-Designer_Scale_Slider=Scale_Slider
FR-Designer_Scale_Grade=Scale_Grade

4
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2099,3 +2099,7 @@ FR-Designer_Insert_Image=Insert_Image
FR-Designer_Insert_Chart=Insert-Chart FR-Designer_Insert_Chart=Insert-Chart
FR-Designer_Insert_Text=Insert-Text FR-Designer_Insert_Text=Insert-Text
FR-Designer_Insert_Formula=Insert_Formula FR-Designer_Insert_Formula=Insert_Formula
FR-Designer_Scale_Down=Scale_Down
FR-Designer_Scale_Up=Scale_Up
FR-Designer_Scale_Slider=Scale_Slider
FR-Designer_Scale_Grade=Scale_Grade

4
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2080,3 +2080,7 @@ FR-Designer_Add_FloatElement=
FR-Designer_Insert_Image= FR-Designer_Insert_Image=
FR-Designer_Insert_Chart= FR-Designer_Insert_Chart=
FR-Designer_Insert_Text= FR-Designer_Insert_Text=
FR-Designer_Scale_Down=
FR-Designer_Scale_Up=
FR-Designer_Scale_Slider=
FR-Designer_Scale_Grade=

4
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2079,3 +2079,7 @@ FR-Designer_Insert_Image=
FR-Designer_Insert_Chart= FR-Designer_Insert_Chart=
FR-Designer_Insert_Text= FR-Designer_Insert_Text=
FR-Designer_Insert_Formula= FR-Designer_Insert_Formula=
FR-Designer_Scale_Down=
FR-Designer_Scale_Up=
FR-Designer_Scale_Slider=
FR-Designer_Scale_Grade=

4
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2106,3 +2106,7 @@ FR-Designer_Float_Visible=\u60AC\u6D6E\u5143\u7D20\u53EF\u89C1
FR-Designer_Cell_Value=\u5355\u5143\u683C\u503C FR-Designer_Cell_Value=\u5355\u5143\u683C\u503C
FR-Designer_Widget_Visible=\u63A7\u4EF6\u53EF\u89C1 FR-Designer_Widget_Visible=\u63A7\u4EF6\u53EF\u89C1
FR-Designer_Widget_Enabled=\u63A7\u4EF6\u53EF\u7528 FR-Designer_Widget_Enabled=\u63A7\u4EF6\u53EF\u7528
FR-Designer_Scale_Down=\u7F29\u5C0F
FR-Designer_Scale_Up=\u653E\u5927
FR-Designer_Scale_Slider=\u7F29\u653E\u6ED1\u5757
FR-Designer_Scale_Grade=\u7F29\u653E\u7EA7\u522B\uFF0C\u5355\u51FB\u540E\u8C03\u8282\u663E\u793A\u6BD4\u4F8B\u3002

4
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2098,3 +2098,7 @@ FR-Designer_Insert_Image=
FR-Designer_Insert_Chart= FR-Designer_Insert_Chart=
FR-Designer_Insert_Text= FR-Designer_Insert_Text=
FR-Designer_Insert_Formula= FR-Designer_Insert_Formula=
FR-Designer_Scale_Down=
FR-Designer_Scale_Up=
FR-Designer_Scale_Slider=
FR-Designer_Scale_Grade=

120
designer_base/src/com/fr/design/mainframe/JFormSliderPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -13,7 +14,6 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
@ -32,7 +32,7 @@ public class JFormSliderPane extends JPanel {
private static final int SIX = 6; private static final int SIX = 6;
private static final int TEN = 10; private static final int TEN = 10;
private static final int ONE_EIGHT = 18; private static final int ONE_EIGHT = 18;
private static final int FONT_SIZE = 14; private static final int FONT_SIZE = 12;
private static final int SPINNER_WIDTH = 45; private static final int SPINNER_WIDTH = 45;
private static final int SPINNER_HEIGHT = 20; private static final int SPINNER_HEIGHT = 20;
private static final int HALF_HUNDRED = 50; private static final int HALF_HUNDRED = 50;
@ -40,10 +40,14 @@ public class JFormSliderPane extends JPanel {
private static final int TWO_HUNDRED = 200; private static final int TWO_HUNDRED = 200;
private static final int THREE_HUNDRED = 300; private static final int THREE_HUNDRED = 300;
private static final int FOUR_HUNDRED = 400; private static final int FOUR_HUNDRED = 400;
private static final int DIALOG_WIDTH = 150; private static final int DIALOG_WIDTH = 157;
private static final int DIALOG_HEIGHT = 220; private static final int DIALOG_HEIGHT = 172;
private static final int SHOWVALBUTTON_WIDTH = 70; private static final int SLIDER_WIDTH = 220;
private static final int SHOWVALBUTTON_HEIGHTH = 25; private static final int SLIDER_HEIGHT = 20;
private static final int SHOWVALBUTTON_WIDTH = 40;
private static final int SHOWVALBUTTON_HEIGHTH = 20;
private static final int SLIDER_GAP = 5;
private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JFormSliderPane THIS; private static JFormSliderPane THIS;
@ -54,7 +58,7 @@ public class JFormSliderPane extends JPanel {
private int sliderValue; private int sliderValue;
private UIButton downButton; private UIButton downButton;
private UIButton upButton; private UIButton upButton;
private UIButton showValButton; private JButton showValButton;
private UIRadioButton twoHundredButton; private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton; private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton; private UIRadioButton SevenFiveButton;
@ -74,45 +78,50 @@ public class JFormSliderPane extends JPanel {
slider = new UISlider(0, HUNDRED, HALF_HUNDRED); slider = new UISlider(0, HUNDRED, HALF_HUNDRED);
slider.setUI(new JSliderPaneUI(slider)); slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener); slider.addChangeListener(listener);
slider.setPreferredSize(new Dimension(220, 20));
//去掉虚线框
slider.setFocusable(false);
slider.setToolTipText(Inter.getLocText("FR-Designer_Scale_Slider"));
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1)); showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1));
showValSpinner.setEnabled(true); showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener); showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT)); showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
//MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧 downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"));
// JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0"); downButton.setOpaque(false);
// showValSpinner.setEditor(editor); downButton.setBorderPainted(false);
// JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); downButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Down"));
// textField.setEditable(true); upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"));
// DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory(); upButton.setOpaque(false);
// NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter(); upButton.setBorderPainted(false);
// formatter.setAllowsInvalid(false); upButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Up"));
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png"));
downButton.setActionCommand("less"); downButton.setActionCommand("less");
upButton.setActionCommand("more"); upButton.setActionCommand("more");
downButton.addActionListener(buttonActionListener); downButton.addActionListener(buttonActionListener);
upButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener);
showValButton = new JButton(showValSpinner.getValue() + "%");
showValButton = new UIButton(showValSpinner.getValue() + "%"); showValButton.setOpaque(false);
showValButton.setMargin(new Insets(0, 0, 0, 0));
showValButton.setFont(new Font("SimSun", Font.PLAIN, 12));
showValButton.setBackground(BACK_COLOR);
showValButton.setBorderPainted(false); showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH)); showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValButton.addActionListener(showValButtonActionListener); showValButton.addActionListener(showValButtonActionListener);
//TODO 先注释,需要自定义tooltip
showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade"));
initUIRadioButton(); initUIRadioButton();
initPane(); initPane();
JPanel panel = new JPanel(new FlowLayout(1, 1, 0)); JPanel panel = new JPanel(new FlowLayout(1, 5, 0));
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
panel.add(showValButton); panel.add(showValButton);
panel.setBackground(BACK_COLOR);
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
this.setBounds(0, 0, THREE_HUNDRED, ONE_EIGHT);
} }
public static final JFormSliderPane getInstance() { public static final JFormSliderPane getInstance() {
// if (THIS == null) { // if (THIS == null) {
// THIS = new JFormSliderPane(); // THIS = new JSliderPane();
// } // }
THIS = new JFormSliderPane(); THIS = new JFormSliderPane();
return THIS; return THIS;
@ -124,8 +133,10 @@ public class JFormSliderPane extends JPanel {
SevenFiveButton = new UIRadioButton("75%"); SevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%"); fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%"); twoFiveButton = new UIRadioButton("25%");
// selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
selfAdaptButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton")); customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton"));
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener); twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener); SevenFiveButton.addItemListener(radioButtonItemListener);
@ -140,7 +151,7 @@ public class JFormSliderPane extends JPanel {
bg.add(SevenFiveButton); bg.add(SevenFiveButton);
bg.add(fiveTenButton); bg.add(fiveTenButton);
bg.add(twoFiveButton); bg.add(twoFiveButton);
// bg.add(selfAdaptButton); bg.add(selfAdaptButton);
bg.add(customButton); bg.add(customButton);
customButton.setSelected(true); customButton.setSelected(true);
} }
@ -149,25 +160,44 @@ public class JFormSliderPane extends JPanel {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
UILabel upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
upLabel.setOpaque(false);
JPanel septPane = new JPanel(new BorderLayout());
JSeparator sept = new JSeparator();
sept.setBackground(new Color(232, 232, 233));
septPane.add(sept, BorderLayout.NORTH);
septPane.setBorder(BorderFactory.createEmptyBorder(2, 5, 1, 10));
septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR);
// selfAdaptButton.setBackground(BACK_COLOR);
customButton.setBackground(BACK_COLOR);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{upLabel, null},
new Component[]{septPane, null},
new Component[]{twoHundredButton, null}, new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null}, new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null}, new Component[]{SevenFiveButton, null},
new Component[]{fiveTenButton, null}, new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null}, new Component[]{twoFiveButton, null},
// new Component[]{selfAdaptButton,null},
new Component[]{customButton, createSpinnerPanel()} new Component[]{customButton, createSpinnerPanel()}
}; };
dialogContentPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); dialogContentPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM, 0);
dialogContentPanel.setBackground(BACK_COLOR);
dialogContentPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
} }
private JPanel createSpinnerPanel() { private JPanel createSpinnerPanel() {
JPanel spinnerPanel = new JPanel(new FlowLayout()); JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner); spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%"); UILabel percent = new UILabel("%");
percent.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE)); percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
spinnerPanel.add(percent); spinnerPanel.add(percent);
spinnerPanel.setBackground(BACK_COLOR);
return spinnerPanel; return spinnerPanel;
} }
@ -314,14 +344,14 @@ public class JFormSliderPane extends JPanel {
dialog = new FormPopupPane(upButton, dialogContentPanel); dialog = new FormPopupPane(upButton, dialogContentPanel);
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH + SLIDER_GAP, -DIALOG_HEIGHT);
} }
} else { } else {
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH + SLIDER_GAP, -DIALOG_HEIGHT);
} else { } else {
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH + SLIDER_GAP, -DIALOG_HEIGHT);
} }
} }
} }
@ -341,29 +371,13 @@ public class JFormSliderPane extends JPanel {
class FormPopupPane extends JPopupMenu { class FormPopupPane extends JPopupMenu {
private JComponent contentPane; private static final int DIALOG_WIDTH = 157;
private static final int UPLABEL_HEIGHT = 25; private static final int DIALOG_HEIGHT = 172;
private static final int DIALOG_WIDTH = 150;
private static final int DIALOG_HEIGHT = 220;
private static final int UPLABEL_WIDTH = 300;
private JComponent centerPane;
private UILabel upLabel;
FormPopupPane(UIButton b, JPanel dialogContentPanel) { FormPopupPane(UIButton b, JPanel dialogContentPanel) {
contentPane = new JPanel(new BorderLayout()); this.add(dialogContentPanel, BorderLayout.CENTER);
centerPane = new JPanel(new BorderLayout());
upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
upLabel.setOpaque(true);
upLabel.setPreferredSize(new Dimension(UPLABEL_WIDTH, UPLABEL_HEIGHT));
upLabel.setBackground(Color.LIGHT_GRAY);
upLabel.setBorder(new MatteBorder(0, 0, 1, 0, Color.gray));
centerPane.add(dialogContentPanel, BorderLayout.NORTH);
contentPane.add(upLabel, BorderLayout.NORTH);
contentPane.add(centerPane, BorderLayout.CENTER);
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
this.add(contentPane, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
this.setOpaque(false); this.setBackground(new Color(245, 245, 247));
} }

28
designer_base/src/com/fr/design/mainframe/JSliderPane.java

@ -14,17 +14,14 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.basic.BasicSliderUI; import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.awt.geom.RoundRectangle2D;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
@ -85,24 +82,19 @@ public class JSliderPane extends JPanel {
slider.setPreferredSize(new Dimension(220, 20)); slider.setPreferredSize(new Dimension(220, 20));
//去掉虚线框 //去掉虚线框
slider.setFocusable(false); slider.setFocusable(false);
slider.setToolTipText(Inter.getLocText("FR-Designer_Scale_Slider"));
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1)); showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1));
showValSpinner.setEnabled(true); showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener); showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT)); showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
//MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧
// JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
// showValSpinner.setEditor(editor);
// JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
// textField.setEditable(true);
// DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
// NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
// formatter.setAllowsInvalid(false);
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")); downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"));
downButton.setOpaque(false); downButton.setOpaque(false);
downButton.setBorderPainted(false); downButton.setBorderPainted(false);
downButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Down"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")); upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"));
upButton.setOpaque(false); upButton.setOpaque(false);
upButton.setBorderPainted(false); upButton.setBorderPainted(false);
upButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Up"));
downButton.setActionCommand("less"); downButton.setActionCommand("less");
upButton.setActionCommand("more"); upButton.setActionCommand("more");
downButton.addActionListener(buttonActionListener); downButton.addActionListener(buttonActionListener);
@ -115,6 +107,8 @@ public class JSliderPane extends JPanel {
showValButton.setBorderPainted(false); showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH)); showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValButton.addActionListener(showValButtonActionListener); showValButton.addActionListener(showValButtonActionListener);
//TODO 先注释,需要自定义tooltip
// showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade"));
initUIRadioButton(); initUIRadioButton();
initPane(); initPane();
JPanel panel = new JPanel(new FlowLayout(1, 5, 0)); JPanel panel = new JPanel(new FlowLayout(1, 5, 0));
@ -126,6 +120,12 @@ public class JSliderPane extends JPanel {
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
} }
public JToolTip createToolTip() {
JToolTip tip = new JToolTip();
tip.setComponent(this);
return tip;
}
public static final JSliderPane getInstance() { public static final JSliderPane getInstance() {
// if (THIS == null) { // if (THIS == null) {
// THIS = new JSliderPane(); // THIS = new JSliderPane();
@ -174,7 +174,8 @@ public class JSliderPane extends JPanel {
JSeparator sept = new JSeparator(); JSeparator sept = new JSeparator();
sept.setBackground(new Color(232, 232, 233)); sept.setBackground(new Color(232, 232, 233));
septPane.add(sept, BorderLayout.NORTH); septPane.add(sept, BorderLayout.NORTH);
septPane.setBorder(BorderFactory.createEmptyBorder(2, 5, 1, 5)); septPane.setBorder(BorderFactory.createEmptyBorder(2, 5, 1, 10));
septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR); SevenFiveButton.setBackground(BACK_COLOR);
@ -195,6 +196,7 @@ public class JSliderPane extends JPanel {
}; };
dialogContentPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM, 0); dialogContentPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM, 0);
dialogContentPanel.setBackground(BACK_COLOR); dialogContentPanel.setBackground(BACK_COLOR);
dialogContentPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
} }
private JPanel createSpinnerPanel() { private JPanel createSpinnerPanel() {
@ -431,7 +433,6 @@ class JSliderPaneUI extends BasicSliderUI {
} }
class PopupPane extends JPopupMenu { class PopupPane extends JPopupMenu {
private JComponent contentPane;
private static final int DIALOG_WIDTH = 157; private static final int DIALOG_WIDTH = 157;
private static final int DIALOG_HEIGHT = 192; private static final int DIALOG_HEIGHT = 192;
@ -439,7 +440,6 @@ class PopupPane extends JPopupMenu {
this.add(dialogContentPanel, BorderLayout.CENTER); this.add(dialogContentPanel, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
this.setBackground(new Color(245, 245, 247)); this.setBackground(new Color(245, 245, 247));
// this.setOpaque(false);
} }

Loading…
Cancel
Save