From 010b07270f525be6ea3837656a51381a96964539 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 2 Aug 2017 20:00:59 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E7=BC=A9=E6=94=BE=E6=9D=A1=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=A7=86=E8=A7=89=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/locale/designer.properties | 4 + .../design/locale/designer_en_US.properties | 4 + .../design/locale/designer_ja_JP.properties | 4 + .../design/locale/designer_ko_KR.properties | 4 + .../design/locale/designer_zh_CN.properties | 4 + .../design/locale/designer_zh_TW.properties | 4 + .../fr/design/mainframe/JFormSliderPane.java | 120 ++++++++++-------- .../com/fr/design/mainframe/JSliderPane.java | 54 ++++---- 8 files changed, 118 insertions(+), 80 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 968e44ba69..8836399b6e 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/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-Text=Insert-Text 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 diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index c72a2b2944..695c42724c 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/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_Text=Insert-Text 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 diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index d299a90935..c89b90b0a1 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/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_Chart= FR-Designer_Insert_Text= +FR-Designer_Scale_Down= +FR-Designer_Scale_Up= +FR-Designer_Scale_Slider= +FR-Designer_Scale_Grade= diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index bf72a516b7..08aaa5c657 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/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_Text= FR-Designer_Insert_Formula= +FR-Designer_Scale_Down= +FR-Designer_Scale_Up= +FR-Designer_Scale_Slider= +FR-Designer_Scale_Grade= diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 7d1d62e970..6add40ade0 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/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_Widget_Visible=\u63A7\u4EF6\u53EF\u89C1 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 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 186bc20bc2..899a752036 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/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_Text= FR-Designer_Insert_Formula= +FR-Designer_Scale_Down= +FR-Designer_Scale_Up= +FR-Designer_Scale_Slider= +FR-Designer_Scale_Grade= diff --git a/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java b/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java index 6088ac01ef..b3be6c760f 100644 --- a/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; @@ -13,7 +14,6 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import javax.swing.*; -import javax.swing.border.MatteBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; @@ -32,7 +32,7 @@ public class JFormSliderPane extends JPanel { private static final int SIX = 6; private static final int TEN = 10; 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_HEIGHT = 20; 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 THREE_HUNDRED = 300; private static final int FOUR_HUNDRED = 400; - private static final int DIALOG_WIDTH = 150; - private static final int DIALOG_HEIGHT = 220; - private static final int SHOWVALBUTTON_WIDTH = 70; - private static final int SHOWVALBUTTON_HEIGHTH = 25; + private static final int DIALOG_WIDTH = 157; + private static final int DIALOG_HEIGHT = 172; + private static final int SLIDER_WIDTH = 220; + 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 double resolutionTimes = 1.0; private static JFormSliderPane THIS; @@ -54,7 +58,7 @@ public class JFormSliderPane extends JPanel { private int sliderValue; private UIButton downButton; private UIButton upButton; - private UIButton showValButton; + private JButton showValButton; private UIRadioButton twoHundredButton; private UIRadioButton oneHundredButton; private UIRadioButton SevenFiveButton; @@ -74,45 +78,50 @@ public class JFormSliderPane extends JPanel { slider = new UISlider(0, HUNDRED, HALF_HUNDRED); slider.setUI(new JSliderPaneUI(slider)); 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.setEnabled(true); showValSpinner.addChangeListener(showValSpinnerChangeListener); 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/moveDown.png")); - upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.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.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.setOpaque(false); + upButton.setBorderPainted(false); + upButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Up")); downButton.setActionCommand("less"); upButton.setActionCommand("more"); downButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener); - - showValButton = new UIButton(showValSpinner.getValue() + "%"); + showValButton = new JButton(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.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH)); showValButton.addActionListener(showValButtonActionListener); - + //TODO 先注释,需要自定义tooltip + showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade")); initUIRadioButton(); initPane(); - JPanel panel = new JPanel(new FlowLayout(1, 1, 0)); + JPanel panel = new JPanel(new FlowLayout(1, 5, 0)); panel.add(downButton); panel.add(slider); panel.add(upButton); panel.add(showValButton); + panel.setBackground(BACK_COLOR); this.add(panel, BorderLayout.NORTH); - this.setBounds(0, 0, THREE_HUNDRED, ONE_EIGHT); } public static final JFormSliderPane getInstance() { // if (THIS == null) { -// THIS = new JFormSliderPane(); +// THIS = new JSliderPane(); // } THIS = new JFormSliderPane(); return THIS; @@ -124,8 +133,10 @@ public class JFormSliderPane extends JPanel { SevenFiveButton = new UIRadioButton("75%"); fiveTenButton = new UIRadioButton("50%"); 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.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); twoHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener); SevenFiveButton.addItemListener(radioButtonItemListener); @@ -140,7 +151,7 @@ public class JFormSliderPane extends JPanel { bg.add(SevenFiveButton); bg.add(fiveTenButton); bg.add(twoFiveButton); -// bg.add(selfAdaptButton); + bg.add(selfAdaptButton); bg.add(customButton); customButton.setSelected(true); } @@ -149,25 +160,44 @@ public class JFormSliderPane extends JPanel { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; 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[][]{ + new Component[]{upLabel, null}, + new Component[]{septPane, null}, new Component[]{twoHundredButton, null}, new Component[]{oneHundredButton, null}, new Component[]{SevenFiveButton, null}, new Component[]{fiveTenButton, null}, new Component[]{twoFiveButton, null}, -// new Component[]{selfAdaptButton,null}, 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() { JPanel spinnerPanel = new JPanel(new FlowLayout()); spinnerPanel.add(showValSpinner); 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.setBackground(BACK_COLOR); return spinnerPanel; } @@ -314,14 +344,14 @@ public class JFormSliderPane extends JPanel { dialog = new FormPopupPane(upButton, dialogContentPanel); if (upButtonX == 0) { 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 { if (upButtonX == 0) { 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 { - 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 { - private JComponent contentPane; - private static final int UPLABEL_HEIGHT = 25; - 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; + private static final int DIALOG_WIDTH = 157; + private static final int DIALOG_HEIGHT = 172; FormPopupPane(UIButton b, JPanel dialogContentPanel) { - contentPane = new JPanel(new BorderLayout()); - 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.add(dialogContentPanel, BorderLayout.CENTER); this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); - this.setOpaque(false); + this.setBackground(new Color(245, 245, 247)); } diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index de0aca7344..50ca69a9e7 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/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 javax.swing.*; -import javax.swing.border.MatteBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.basic.BasicSliderUI; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.awt.geom.RoundRectangle2D; import java.math.BigDecimal; /** @@ -51,7 +48,7 @@ public class JSliderPane extends JPanel { 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); + private static final Color BACK_COLOR = new Color(245, 245, 247); public int showValue = 100; public double resolutionTimes = 1.0; private static JSliderPane THIS; @@ -85,36 +82,33 @@ public class JSliderPane extends JPanel { 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.setEnabled(true); showValSpinner.addChangeListener(showValSpinnerChangeListener); 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.setBorderPainted(false); - 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")); + 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.setOpaque(false); upButton.setBorderPainted(false); + upButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Up")); downButton.setActionCommand("less"); upButton.setActionCommand("more"); downButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener); showValButton = new JButton(showValSpinner.getValue() + "%"); showValButton.setOpaque(false); - showValButton.setMargin(new Insets(0,0,0,0)); + showValButton.setMargin(new Insets(0, 0, 0, 0)); showValButton.setFont(new Font("SimSun", Font.PLAIN, 12)); showValButton.setBackground(BACK_COLOR); showValButton.setBorderPainted(false); showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH)); showValButton.addActionListener(showValButtonActionListener); + //TODO 先注释,需要自定义tooltip +// showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade")); initUIRadioButton(); initPane(); JPanel panel = new JPanel(new FlowLayout(1, 5, 0)); @@ -126,6 +120,12 @@ public class JSliderPane extends JPanel { this.add(panel, BorderLayout.NORTH); } + public JToolTip createToolTip() { + JToolTip tip = new JToolTip(); + tip.setComponent(this); + return tip; + } + public static final JSliderPane getInstance() { // if (THIS == null) { // THIS = new JSliderPane(); @@ -172,9 +172,10 @@ public class JSliderPane extends JPanel { 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, 5)); + 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); @@ -195,6 +196,7 @@ public class JSliderPane extends JPanel { }; 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() { @@ -377,7 +379,7 @@ public class JSliderPane extends JPanel { class JSliderPaneUI extends BasicSliderUI { - private static final Color BACK_COLOR = new Color(245,245,247); + private static final Color BACK_COLOR = new Color(245, 245, 247); private static final int VERTICAL_WIDTH = 11; private static final int VERTICAL_HEIGHT = 16; private static final int FOUR = 4; @@ -402,9 +404,9 @@ class JSliderPaneUI extends BasicSliderUI { g2d.translate(knobBounds.x, knobBounds.y); // g2d.setColor(slider.getBackground()); // g2d.fillRect(0, FOUR, FOUR, 9); - g2d.setColor(new Color(51,51,52)); - g2d.drawRoundRect(0,SIX,FOUR,9,2,2); - g2d.fillRoundRect(0,SIX,FOUR,9,2,2); + g2d.setColor(new Color(51, 51, 52)); + g2d.drawRoundRect(0, SIX, FOUR, 9, 2, 2); + g2d.fillRoundRect(0, SIX, FOUR, 9, 2, 2); } /** */ @@ -420,8 +422,8 @@ class JSliderPaneUI extends BasicSliderUI { cw = trackBounds.width; g2.setPaint(BACK_COLOR); g2.fillRect(0, -cy, cw + 10, cy * 4); - g.setColor(new Color(216,216,216)); - g.drawLine(0, cy, cw +3, cy); + g.setColor(new Color(216, 216, 216)); + g.drawLine(0, cy, cw + 3, cy); g.drawLine(FIVE + cw / 2, cy - FOUR, FIVE + cw / 2, cy + FOUR); } else { super.paintTrack(g); @@ -431,15 +433,13 @@ class JSliderPaneUI extends BasicSliderUI { } class PopupPane extends JPopupMenu { - private JComponent contentPane; private static final int DIALOG_WIDTH = 157; private static final int DIALOG_HEIGHT = 192; PopupPane(JButton b, JPanel dialogContentPanel) { this.add(dialogContentPanel, BorderLayout.CENTER); this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); - this.setBackground(new Color(245,245,247)); -// this.setOpaque(false); + this.setBackground(new Color(245, 245, 247)); }