|
|
@ -18,7 +18,10 @@ import javax.swing.event.ChangeEvent; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import javax.swing.plaf.basic.BasicSliderUI; |
|
|
|
import javax.swing.plaf.basic.BasicSliderUI; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.*; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
|
|
|
|
import java.awt.event.ItemListener; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -31,7 +34,7 @@ public class JSliderPane extends JPanel { |
|
|
|
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 = 14; |
|
|
|
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; |
|
|
|
private static final int HUNDRED = 100; |
|
|
|
private static final int HUNDRED = 100; |
|
|
@ -69,7 +72,7 @@ public class JSliderPane extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
public JSliderPane() { |
|
|
|
public JSliderPane() { |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
@ -92,19 +95,19 @@ public class JSliderPane extends JPanel { |
|
|
|
downButton.addActionListener(buttonActionListener); |
|
|
|
downButton.addActionListener(buttonActionListener); |
|
|
|
upButton.addActionListener(buttonActionListener); |
|
|
|
upButton.addActionListener(buttonActionListener); |
|
|
|
|
|
|
|
|
|
|
|
showValButton = new UIButton(showValSpinner.getValue()+"%"); |
|
|
|
showValButton = new UIButton(showValSpinner.getValue() + "%"); |
|
|
|
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); |
|
|
|
initUIRadioButton(); |
|
|
|
initUIRadioButton(); |
|
|
|
initPane(); |
|
|
|
initPane(); |
|
|
|
JPanel panel = new JPanel(new FlowLayout(1,1,0)); |
|
|
|
JPanel panel = new JPanel(new FlowLayout(1, 1, 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); |
|
|
|
this.add(panel,BorderLayout.NORTH); |
|
|
|
this.add(panel, BorderLayout.NORTH); |
|
|
|
this.setBounds(0,0,THREE_HUNDRED,ONE_EIGHT); |
|
|
|
this.setBounds(0, 0, THREE_HUNDRED, ONE_EIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static final JSliderPane getInstance() { |
|
|
|
public static final JSliderPane getInstance() { |
|
|
@ -115,7 +118,7 @@ public class JSliderPane extends JPanel { |
|
|
|
return THIS; |
|
|
|
return THIS; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initUIRadioButton(){ |
|
|
|
private void initUIRadioButton() { |
|
|
|
twoHundredButton = new UIRadioButton("200%"); |
|
|
|
twoHundredButton = new UIRadioButton("200%"); |
|
|
|
oneHundredButton = new UIRadioButton("100%"); |
|
|
|
oneHundredButton = new UIRadioButton("100%"); |
|
|
|
SevenFiveButton = new UIRadioButton("75%"); |
|
|
|
SevenFiveButton = new UIRadioButton("75%"); |
|
|
@ -131,7 +134,7 @@ public class JSliderPane extends JPanel { |
|
|
|
//TODO
|
|
|
|
//TODO
|
|
|
|
// selfAdaptButton.addItemListener();
|
|
|
|
// selfAdaptButton.addItemListener();
|
|
|
|
|
|
|
|
|
|
|
|
ButtonGroup bg=new ButtonGroup();// 初始化按钮组
|
|
|
|
ButtonGroup bg = new ButtonGroup();// 初始化按钮组
|
|
|
|
bg.add(twoHundredButton);// 加入按钮组
|
|
|
|
bg.add(twoHundredButton);// 加入按钮组
|
|
|
|
bg.add(oneHundredButton); |
|
|
|
bg.add(oneHundredButton); |
|
|
|
bg.add(SevenFiveButton); |
|
|
|
bg.add(SevenFiveButton); |
|
|
@ -142,24 +145,24 @@ public class JSliderPane extends JPanel { |
|
|
|
customButton.setSelected(true); |
|
|
|
customButton.setSelected(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initPane(){ |
|
|
|
private void initPane() { |
|
|
|
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}; |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
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[]{selfAdaptButton, null}, |
|
|
|
new Component[]{customButton,createSpinnerPanel()} |
|
|
|
new Component[]{customButton, createSpinnerPanel()} |
|
|
|
}; |
|
|
|
}; |
|
|
|
dialogContentPanel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
|
|
|
dialogContentPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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("%"); |
|
|
@ -178,14 +181,14 @@ public class JSliderPane extends JPanel { |
|
|
|
ChangeListener showValSpinnerChangeListener = new ChangeListener() { |
|
|
|
ChangeListener showValSpinnerChangeListener = new ChangeListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
int val = (int) ((UIBasicSpinner)e.getSource()).getValue(); |
|
|
|
int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
resolutionTimes = divide(showValue,100,2); |
|
|
|
resolutionTimes = divide(showValue, 100, 2); |
|
|
|
if (val > FOUR_HUNDRED){ |
|
|
|
if (val > FOUR_HUNDRED) { |
|
|
|
showValSpinner.setValue(FOUR_HUNDRED); |
|
|
|
showValSpinner.setValue(FOUR_HUNDRED); |
|
|
|
val = FOUR_HUNDRED; |
|
|
|
val = FOUR_HUNDRED; |
|
|
|
} |
|
|
|
} |
|
|
|
if (val < TEN){ |
|
|
|
if (val < TEN) { |
|
|
|
showValSpinner.setValue(TEN); |
|
|
|
showValSpinner.setValue(TEN); |
|
|
|
val = TEN; |
|
|
|
val = TEN; |
|
|
|
} |
|
|
|
} |
|
|
@ -196,11 +199,10 @@ public class JSliderPane extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定义一个监听器,用于监听所有滑动条
|
|
|
|
//定义一个监听器,用于监听所有滑动条
|
|
|
|
ChangeListener listener = new ChangeListener() |
|
|
|
ChangeListener listener = new ChangeListener() { |
|
|
|
{ |
|
|
|
public void stateChanged(ChangeEvent event) { |
|
|
|
public void stateChanged( ChangeEvent event) { |
|
|
|
|
|
|
|
//取出滑动条的值,并在文本中显示出来
|
|
|
|
//取出滑动条的值,并在文本中显示出来
|
|
|
|
if (!isButtonOrIsTxt){ |
|
|
|
if (!isButtonOrIsTxt) { |
|
|
|
customButton.setSelected(true); |
|
|
|
customButton.setSelected(true); |
|
|
|
EventQueue.invokeLater(new Runnable() { |
|
|
|
EventQueue.invokeLater(new Runnable() { |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
@ -210,7 +212,7 @@ public class JSliderPane extends JPanel { |
|
|
|
showValSpinner.setValue(times); |
|
|
|
showValSpinner.setValue(times); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
isButtonOrIsTxt = false; |
|
|
|
isButtonOrIsTxt = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -219,41 +221,41 @@ public class JSliderPane extends JPanel { |
|
|
|
ItemListener radioButtonItemListener = new ItemListener() { |
|
|
|
ItemListener radioButtonItemListener = new ItemListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
JRadioButton temp=(JRadioButton)e.getSource(); |
|
|
|
JRadioButton temp = (JRadioButton) e.getSource(); |
|
|
|
if(temp.isSelected()){ |
|
|
|
if (temp.isSelected()) { |
|
|
|
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%")))); |
|
|
|
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%")))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
private void refreshSlider(int val){ |
|
|
|
private void refreshSlider(int val) { |
|
|
|
showValue = val; |
|
|
|
showValue = val; |
|
|
|
if (showValue >HUNDRED){ |
|
|
|
if (showValue > HUNDRED) { |
|
|
|
slider.setValue((int)(showValue+TWO_HUNDRED)/SIX); |
|
|
|
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); |
|
|
|
}else if (showValue <HUNDRED){ |
|
|
|
} else if (showValue < HUNDRED) { |
|
|
|
slider.setValue((int)((showValue-TEN)/ONEPOINTEIGHT)); |
|
|
|
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); |
|
|
|
}else if (showValue == HUNDRED){ |
|
|
|
} else if (showValue == HUNDRED) { |
|
|
|
slider.setValue(HALF_HUNDRED); |
|
|
|
slider.setValue(HALF_HUNDRED); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void refreshBottun(int val){ |
|
|
|
private void refreshBottun(int val) { |
|
|
|
showValButton.setText(val+"%"); |
|
|
|
showValButton.setText(val + "%"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public double getResolutionTimes(){ |
|
|
|
public double getResolutionTimes() { |
|
|
|
return this.resolutionTimes; |
|
|
|
return this.resolutionTimes; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getshowValue(){ |
|
|
|
public int getshowValue() { |
|
|
|
return this.showValue; |
|
|
|
return this.showValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static double divide(double v1, double v2,int scale) { |
|
|
|
public static double divide(double v1, double v2, int scale) { |
|
|
|
BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
|
|
|
BigDecimal b1 = new BigDecimal(Double.toString(v1)); |
|
|
|
BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
|
|
|
BigDecimal b2 = new BigDecimal(Double.toString(v2)); |
|
|
|
return b1.divide(b2,scale).doubleValue(); |
|
|
|
return b1.divide(b2, scale).doubleValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ActionListener buttonActionListener = new ActionListener() { |
|
|
|
ActionListener buttonActionListener = new ActionListener() { |
|
|
@ -261,22 +263,22 @@ public class JSliderPane extends JPanel { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
showValue = (int) showValSpinner.getValue(); |
|
|
|
showValue = (int) showValSpinner.getValue(); |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
if(e.getActionCommand().equals("less")){ |
|
|
|
if (e.getActionCommand().equals("less")) { |
|
|
|
int newDownVal = showValue - TEN; |
|
|
|
int newDownVal = showValue - TEN; |
|
|
|
if (newDownVal >= TEN ){ |
|
|
|
if (newDownVal >= TEN) { |
|
|
|
showValue = newDownVal; |
|
|
|
showValue = newDownVal; |
|
|
|
showValSpinner.setValue(newDownVal); |
|
|
|
showValSpinner.setValue(newDownVal); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
showValue = newDownVal; |
|
|
|
showValue = newDownVal; |
|
|
|
showValSpinner.setValue(TEN); |
|
|
|
showValSpinner.setValue(TEN); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(e.getActionCommand().equals("more")){ |
|
|
|
if (e.getActionCommand().equals("more")) { |
|
|
|
int newUpVal = showValue + TEN; |
|
|
|
int newUpVal = showValue + TEN; |
|
|
|
if (newUpVal <= FOUR_HUNDRED ){ |
|
|
|
if (newUpVal <= FOUR_HUNDRED) { |
|
|
|
showValue = newUpVal; |
|
|
|
showValue = newUpVal; |
|
|
|
showValSpinner.setValue(newUpVal); |
|
|
|
showValSpinner.setValue(newUpVal); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
showValue = newUpVal; |
|
|
|
showValue = newUpVal; |
|
|
|
showValSpinner.setValue(FOUR_HUNDRED); |
|
|
|
showValSpinner.setValue(FOUR_HUNDRED); |
|
|
|
} |
|
|
|
} |
|
|
@ -287,51 +289,49 @@ public class JSliderPane extends JPanel { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void getTimes(int value) { |
|
|
|
private void getTimes(int value){ |
|
|
|
if (value == HALF_HUNDRED) { |
|
|
|
if (value == HALF_HUNDRED){ |
|
|
|
times = HUNDRED; |
|
|
|
times=HUNDRED; |
|
|
|
} else if (value < HALF_HUNDRED) { |
|
|
|
}else if (value < HALF_HUNDRED){ |
|
|
|
times = (int) Math.round(ONEPOINTEIGHT * value + TEN); |
|
|
|
times = (int) Math.round(ONEPOINTEIGHT*value + TEN); |
|
|
|
} else { |
|
|
|
}else { |
|
|
|
times = (int) (SIX * value - TWO_HUNDRED); |
|
|
|
times = (int) (SIX*value - TWO_HUNDRED); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JSpinner getShowVal(){ |
|
|
|
public JSpinner getShowVal() { |
|
|
|
return this.showValSpinner; |
|
|
|
return this.showValSpinner; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UIRadioButton getSelfAdaptButton(){ |
|
|
|
public UIRadioButton getSelfAdaptButton() { |
|
|
|
return this.selfAdaptButton; |
|
|
|
return this.selfAdaptButton; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void popupDialog(){ |
|
|
|
private void popupDialog() { |
|
|
|
Point btnCoords = upButton.getLocationOnScreen(); |
|
|
|
Point btnCoords = upButton.getLocationOnScreen(); |
|
|
|
if (dialog == null){ |
|
|
|
if (dialog == null) { |
|
|
|
dialog = new PopupPane(upButton,dialogContentPanel); |
|
|
|
dialog = new PopupPane(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, -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, -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, -DIALOG_HEIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) |
|
|
|
public static void main(String[] args) { |
|
|
|
{ |
|
|
|
|
|
|
|
JFrame jf = new JFrame("test"); |
|
|
|
JFrame jf = new JFrame("test"); |
|
|
|
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
|
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
|
JPanel content = (JPanel)jf.getContentPane(); |
|
|
|
JPanel content = (JPanel) jf.getContentPane(); |
|
|
|
content.setLayout(new BorderLayout()); |
|
|
|
content.setLayout(new BorderLayout()); |
|
|
|
content.add(JSliderPane.getInstance(),BorderLayout.CENTER); |
|
|
|
content.add(JSliderPane.getInstance(), BorderLayout.CENTER); |
|
|
|
GUICoreUtils.centerWindow(jf); |
|
|
|
GUICoreUtils.centerWindow(jf); |
|
|
|
jf.setSize(400, 80); |
|
|
|
jf.setSize(400, 80); |
|
|
|
jf.setVisible(true); |
|
|
|
jf.setVisible(true); |
|
|
@ -359,11 +359,10 @@ class JSliderPaneUI extends BasicSliderUI { |
|
|
|
public Dimension getThumbSize() { |
|
|
|
public Dimension getThumbSize() { |
|
|
|
Dimension size = new Dimension(); |
|
|
|
Dimension size = new Dimension(); |
|
|
|
|
|
|
|
|
|
|
|
if ( slider.getOrientation() == JSlider.VERTICAL ) { |
|
|
|
if (slider.getOrientation() == JSlider.VERTICAL) { |
|
|
|
size.width = VERTICAL_WIDTH; |
|
|
|
size.width = VERTICAL_WIDTH; |
|
|
|
size.height = VERTICAL_HEIGHT; |
|
|
|
size.height = VERTICAL_HEIGHT; |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
size.width = VERTICAL_WIDTH; |
|
|
|
size.width = VERTICAL_WIDTH; |
|
|
|
size.height = VERTICAL_HEIGHT; |
|
|
|
size.height = VERTICAL_HEIGHT; |
|
|
|
} |
|
|
|
} |
|
|
@ -377,14 +376,13 @@ class JSliderPaneUI extends BasicSliderUI { |
|
|
|
int h = knobBounds.height; |
|
|
|
int h = knobBounds.height; |
|
|
|
|
|
|
|
|
|
|
|
g.translate(knobBounds.x, knobBounds.y); |
|
|
|
g.translate(knobBounds.x, knobBounds.y); |
|
|
|
if ( slider.isEnabled() ) { |
|
|
|
if (slider.isEnabled()) { |
|
|
|
g.setColor(slider.getBackground()); |
|
|
|
g.setColor(slider.getBackground()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
g.setColor(slider.getBackground().darker()); |
|
|
|
g.setColor(slider.getBackground().darker()); |
|
|
|
} |
|
|
|
} |
|
|
|
g.setColor(Color.darkGray); |
|
|
|
g.setColor(Color.darkGray); |
|
|
|
g.fillRect(0, 1, w-SIX, h+1); |
|
|
|
g.fillRect(0, 1, w - SIX, h + 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** */ |
|
|
|
/** */ |
|
|
@ -399,8 +397,8 @@ class JSliderPaneUI extends BasicSliderUI { |
|
|
|
cy = (trackBounds.height / 2); |
|
|
|
cy = (trackBounds.height / 2); |
|
|
|
cw = trackBounds.width; |
|
|
|
cw = trackBounds.width; |
|
|
|
g.setColor(Color.lightGray); |
|
|
|
g.setColor(Color.lightGray); |
|
|
|
g.drawLine(0, cy, cw+FIVE, cy); |
|
|
|
g.drawLine(0, cy, cw + FIVE, cy); |
|
|
|
g.drawLine(FIVE+cw/2, cy-FOUR, FIVE+cw/2, cy+FOUR); |
|
|
|
g.drawLine(FIVE + cw / 2, cy - FOUR, FIVE + cw / 2, cy + FOUR); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
super.paintTrack(g); |
|
|
|
super.paintTrack(g); |
|
|
|
} |
|
|
|
} |
|
|
@ -416,17 +414,18 @@ class PopupPane extends JPopupMenu { |
|
|
|
private static final int UPLABEL_WIDTH = 300; |
|
|
|
private static final int UPLABEL_WIDTH = 300; |
|
|
|
private JComponent centerPane; |
|
|
|
private JComponent centerPane; |
|
|
|
private UILabel upLabel; |
|
|
|
private UILabel upLabel; |
|
|
|
PopupPane(UIButton b,JPanel dialogContentPanel) { |
|
|
|
|
|
|
|
|
|
|
|
PopupPane(UIButton b, JPanel dialogContentPanel) { |
|
|
|
contentPane = new JPanel(new BorderLayout()); |
|
|
|
contentPane = new JPanel(new BorderLayout()); |
|
|
|
centerPane = new JPanel(new BorderLayout()); |
|
|
|
centerPane = new JPanel(new BorderLayout()); |
|
|
|
upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce")); |
|
|
|
upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce")); |
|
|
|
upLabel.setOpaque(true); |
|
|
|
upLabel.setOpaque(true); |
|
|
|
upLabel.setPreferredSize(new Dimension(UPLABEL_WIDTH,UPLABEL_HEIGHT)); |
|
|
|
upLabel.setPreferredSize(new Dimension(UPLABEL_WIDTH, UPLABEL_HEIGHT)); |
|
|
|
upLabel.setBackground(Color.LIGHT_GRAY); |
|
|
|
upLabel.setBackground(Color.LIGHT_GRAY); |
|
|
|
upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray)); |
|
|
|
upLabel.setBorder(new MatteBorder(0, 0, 1, 0, Color.gray)); |
|
|
|
centerPane.add(dialogContentPanel,BorderLayout.NORTH); |
|
|
|
centerPane.add(dialogContentPanel, BorderLayout.NORTH); |
|
|
|
contentPane.add(upLabel,BorderLayout.NORTH); |
|
|
|
contentPane.add(upLabel, BorderLayout.NORTH); |
|
|
|
contentPane.add(centerPane,BorderLayout.CENTER); |
|
|
|
contentPane.add(centerPane, BorderLayout.CENTER); |
|
|
|
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
|
|
|
|
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
|
|
|
|
this.add(contentPane, BorderLayout.CENTER); |
|
|
|
this.add(contentPane, BorderLayout.CENTER); |
|
|
|
this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); |
|
|
|
this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); |
|
|
@ -434,5 +433,4 @@ class PopupPane extends JPopupMenu { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |