|
|
@ -2,6 +2,7 @@ package com.fr.design.mainframe; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
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.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.islider.UISlider; |
|
|
|
import com.fr.design.gui.islider.UISlider; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
@ -9,6 +10,7 @@ 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.event.DocumentEvent; |
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
@ -17,14 +19,24 @@ import javax.swing.plaf.basic.BasicSliderUI; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.*; |
|
|
|
import java.awt.event.*; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.Observable; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Created by MoMeak on 2017/7/13. |
|
|
|
* Created by MoMeak on 2017/7/13. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class JSliderPane extends JPanel { |
|
|
|
public class JSliderPane extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
private final int KERNING = 2; |
|
|
|
private static final double ONEPOINTEIGHT = 1.8; |
|
|
|
|
|
|
|
private static final int SIX = 6; |
|
|
|
|
|
|
|
private static final int TEN = 10; |
|
|
|
|
|
|
|
private static final int ONEEIGHT = 18; |
|
|
|
|
|
|
|
private static final int FOURTEN = 40; |
|
|
|
|
|
|
|
private static final int HALFHUNDRED = 50; |
|
|
|
|
|
|
|
private static final int HUNDRED = 100; |
|
|
|
|
|
|
|
private static final int TWOHUNDRED = 200; |
|
|
|
|
|
|
|
private static final int THREEHUNDRED = 300; |
|
|
|
|
|
|
|
private static final int FOURHUNDRED = 400; |
|
|
|
|
|
|
|
private static final int DIALOGWIDTH = 150; |
|
|
|
|
|
|
|
private static final int DIALOGHEIGHT = 200; |
|
|
|
public int showValue = 100; |
|
|
|
public int showValue = 100; |
|
|
|
public double resolutionTimes = 1.0; |
|
|
|
public double resolutionTimes = 1.0; |
|
|
|
private static JSliderPane THIS; |
|
|
|
private static JSliderPane THIS; |
|
|
@ -34,23 +46,30 @@ public class JSliderPane extends JPanel { |
|
|
|
private int sliderValue; |
|
|
|
private int sliderValue; |
|
|
|
private UIButton downButton; |
|
|
|
private UIButton downButton; |
|
|
|
private UIButton upButton; |
|
|
|
private UIButton upButton; |
|
|
|
|
|
|
|
private UIButton showValButton; |
|
|
|
|
|
|
|
private UIRadioButton twoHundredButton; |
|
|
|
|
|
|
|
private UIRadioButton oneHundredButton; |
|
|
|
|
|
|
|
private UIRadioButton SevenFiveButton; |
|
|
|
|
|
|
|
private UIRadioButton fiveTenButton; |
|
|
|
|
|
|
|
private UIRadioButton twoFiveButton; |
|
|
|
|
|
|
|
private UIRadioButton selfAdaptButton; |
|
|
|
|
|
|
|
private UIRadioButton customButton; |
|
|
|
//拖动条处理和button、直接输入不一样
|
|
|
|
//拖动条处理和button、直接输入不一样
|
|
|
|
private boolean isButtonOrIsTxt = true; |
|
|
|
private boolean isButtonOrIsTxt = true; |
|
|
|
private boolean isDialogOut = false; // 是否弹出
|
|
|
|
private PopupPane dialog; |
|
|
|
private Dialog dialog; |
|
|
|
private int upButtonX; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JSliderPane() { |
|
|
|
public JSliderPane() { |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
slider = new UISlider(0,100,50); |
|
|
|
slider = new UISlider(0,HUNDRED,HALFHUNDRED); |
|
|
|
slider.setUI(new JSliderPaneUI(slider)); |
|
|
|
slider.setUI(new JSliderPaneUI(slider)); |
|
|
|
slider.addChangeListener(listener); |
|
|
|
slider.addChangeListener(listener); |
|
|
|
|
|
|
|
|
|
|
|
showVal = new UITextField(); |
|
|
|
showVal = new UITextField(); |
|
|
|
showVal.setText("100%"); |
|
|
|
showVal.setText("100%"); |
|
|
|
showVal.setPreferredSize(new Dimension(40,18)); |
|
|
|
showVal.setPreferredSize(new Dimension(FOURTEN,ONEEIGHT)); |
|
|
|
showVal.getDocument().addDocumentListener(showValDocumentListener); |
|
|
|
showVal.getDocument().addDocumentListener(showValDocumentListener); |
|
|
|
// showVal.addMouseListener(showValMouseListener);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png")); |
|
|
|
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")); |
|
|
|
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png")); |
|
|
@ -61,21 +80,23 @@ public class JSliderPane extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
JPanel panel = new JPanel(new FlowLayout(1,1,0)); |
|
|
|
JPanel panel = new JPanel(new FlowLayout(1,1,0)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showValButton = new UIButton(showVal.getText()); |
|
|
|
|
|
|
|
showValButton.setBorderPainted(false); |
|
|
|
|
|
|
|
showValButton.setPreferredSize(new Dimension(HALFHUNDRED,ONEEIGHT)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showValButton.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
popupDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
panel.add(downButton); |
|
|
|
panel.add(downButton); |
|
|
|
panel.add(slider); |
|
|
|
panel.add(slider); |
|
|
|
panel.add(upButton); |
|
|
|
panel.add(upButton); |
|
|
|
panel.add(showVal); |
|
|
|
panel.add(showValButton); |
|
|
|
// JPanel panel = new JPanel(null);
|
|
|
|
|
|
|
|
// panel.add(downButton);
|
|
|
|
|
|
|
|
// panel.add(slider);
|
|
|
|
|
|
|
|
// panel.add(upButton);
|
|
|
|
|
|
|
|
// panel.add(showVal);
|
|
|
|
|
|
|
|
// downButton.setBounds(0,0,16,16);
|
|
|
|
|
|
|
|
// slider.setBounds(16+KERNING,0,160,16);
|
|
|
|
|
|
|
|
// upButton.setBounds(176+KERNING*2,0,16,16);
|
|
|
|
|
|
|
|
// showVal.setBounds(192+KERNING*3,0,40,16);
|
|
|
|
|
|
|
|
this.add(panel,BorderLayout.NORTH); |
|
|
|
this.add(panel,BorderLayout.NORTH); |
|
|
|
this.setBounds(0,0,300,16); |
|
|
|
this.setBounds(0,0,THREEHUNDRED,ONEEIGHT); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static final JSliderPane getInstance() { |
|
|
|
public static final JSliderPane getInstance() { |
|
|
@ -86,6 +107,24 @@ public class JSliderPane extends JPanel { |
|
|
|
return THIS; |
|
|
|
return THIS; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initUIRadioButton(){ |
|
|
|
|
|
|
|
twoHundredButton = new UIRadioButton("200%"); |
|
|
|
|
|
|
|
oneHundredButton = new UIRadioButton("100%"); |
|
|
|
|
|
|
|
SevenFiveButton = new UIRadioButton("75%"); |
|
|
|
|
|
|
|
fiveTenButton = new UIRadioButton("50%"); |
|
|
|
|
|
|
|
twoFiveButton = new UIRadioButton("25%"); |
|
|
|
|
|
|
|
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); |
|
|
|
|
|
|
|
customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ButtonGroup bg=new ButtonGroup();// 初始化按钮组
|
|
|
|
|
|
|
|
bg.add(twoHundredButton);// 加入按钮组
|
|
|
|
|
|
|
|
bg.add(oneHundredButton); |
|
|
|
|
|
|
|
bg.add(SevenFiveButton); |
|
|
|
|
|
|
|
bg.add(fiveTenButton); |
|
|
|
|
|
|
|
bg.add(twoFiveButton); |
|
|
|
|
|
|
|
bg.add(selfAdaptButton); |
|
|
|
|
|
|
|
bg.add(customButton); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定义一个监听器,用于监听所有滑动条
|
|
|
|
//定义一个监听器,用于监听所有滑动条
|
|
|
@ -115,7 +154,7 @@ public class JSliderPane extends JPanel { |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
resolutionTimes = divide(showValue,100,2); |
|
|
|
resolutionTimes = divide(showValue,100,2); |
|
|
|
refreshSlider(); |
|
|
|
refreshSlider(); |
|
|
|
refreshBody(); |
|
|
|
refreshBottun(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -129,49 +168,20 @@ public class JSliderPane extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
MouseListener showValMouseListener = new MouseListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
|
|
|
|
popupDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseReleased(MouseEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void refreshSlider(){ |
|
|
|
private void refreshSlider(){ |
|
|
|
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); |
|
|
|
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); |
|
|
|
if (showValue >100){ |
|
|
|
if (showValue >HUNDRED){ |
|
|
|
slider.setValue((int)(showValue+200)/6); |
|
|
|
slider.setValue((int)(showValue+TWOHUNDRED)/SIX); |
|
|
|
}else if (showValue <100){ |
|
|
|
}else if (showValue <HUNDRED){ |
|
|
|
slider.setValue((int)((showValue-10)/1.8)); |
|
|
|
slider.setValue((int)((showValue-TEN)/ONEPOINTEIGHT)); |
|
|
|
}else if (showValue == 100){ |
|
|
|
}else if (showValue == HUNDRED){ |
|
|
|
slider.setValue(50); |
|
|
|
slider.setValue(HALFHUNDRED); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void refreshBody(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// int resolution = (int) (ScreenResolution.getScreenResolution()*resolutionTimes);
|
|
|
|
|
|
|
|
// HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void refreshBottun(){ |
|
|
|
|
|
|
|
showValButton.setText(showVal.getText()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public double getResolutionTimes(){ |
|
|
|
public double getResolutionTimes(){ |
|
|
@ -188,42 +198,44 @@ public class JSliderPane extends JPanel { |
|
|
|
return b1.divide(b2,scale).doubleValue(); |
|
|
|
return b1.divide(b2,scale).doubleValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ActionListener buttonActionListener = new ActionListener() { |
|
|
|
ActionListener buttonActionListener = new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); |
|
|
|
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
if(e.getActionCommand().equals("less")){ |
|
|
|
if(e.getActionCommand().equals("less")){ |
|
|
|
int newDownVal = showValue - 10; |
|
|
|
int newDownVal = showValue - TEN; |
|
|
|
if (newDownVal >= 10 ){ |
|
|
|
if (newDownVal >= TEN ){ |
|
|
|
showValue = newDownVal; |
|
|
|
showValue = newDownVal; |
|
|
|
showVal.setText(newDownVal + "%"); |
|
|
|
showVal.setText(newDownVal + "%"); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
showValue = newDownVal; |
|
|
|
showValue = newDownVal; |
|
|
|
showVal.setText(10 + "%"); |
|
|
|
showVal.setText(TEN + "%"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(e.getActionCommand().equals("more")){ |
|
|
|
if(e.getActionCommand().equals("more")){ |
|
|
|
int newUpVal = showValue + 10; |
|
|
|
int newUpVal = showValue + TEN; |
|
|
|
if (newUpVal <= 400 ){ |
|
|
|
if (newUpVal <= FOURHUNDRED ){ |
|
|
|
showValue = newUpVal; |
|
|
|
showValue = newUpVal; |
|
|
|
showVal.setText(newUpVal + "%"); |
|
|
|
showVal.setText(newUpVal + "%"); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
showValue = newUpVal; |
|
|
|
showValue = newUpVal; |
|
|
|
showVal.setText(400 + "%"); |
|
|
|
showVal.setText(FOURHUNDRED + "%"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void getTimes(int value){ |
|
|
|
private void getTimes(int value){ |
|
|
|
if (value == 50){ |
|
|
|
if (value == HALFHUNDRED){ |
|
|
|
times=100; |
|
|
|
times=HUNDRED; |
|
|
|
}else if (value < 50){ |
|
|
|
}else if (value < HALFHUNDRED){ |
|
|
|
times = (int) Math.round(1.8*value + 10); |
|
|
|
times = (int) Math.round(ONEPOINTEIGHT*value + TEN); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
times = (int) (6*value - 200); |
|
|
|
times = (int) (SIX*value - TWOHUNDRED); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -233,17 +245,20 @@ public class JSliderPane extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void popupDialog(){ |
|
|
|
private void popupDialog(){ |
|
|
|
if (isDialogOut) { |
|
|
|
Point btnCoords = upButton.getLocationOnScreen(); |
|
|
|
dialog.setVisible(false); |
|
|
|
if (dialog == null){ |
|
|
|
isDialogOut = false; |
|
|
|
dialog = new PopupPane(upButton,showVal); |
|
|
|
return; |
|
|
|
if (upButtonX == 0) { |
|
|
|
} |
|
|
|
upButtonX = btnCoords.x; |
|
|
|
if (dialog == null) { |
|
|
|
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); |
|
|
|
dialog = new Dialog(showVal); |
|
|
|
} |
|
|
|
isDialogOut = true; |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
if (upButtonX == 0) { |
|
|
|
dialog.setVisible(true); |
|
|
|
upButtonX = btnCoords.x; |
|
|
|
isDialogOut = true; |
|
|
|
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -263,6 +278,12 @@ public class JSliderPane extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
class JSliderPaneUI extends BasicSliderUI { |
|
|
|
class JSliderPaneUI extends BasicSliderUI { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final int VERTICAL_WIDTH = 11; |
|
|
|
|
|
|
|
private static final int VERTICAL_HEIGHT = 16; |
|
|
|
|
|
|
|
private static final int FOUR = 4; |
|
|
|
|
|
|
|
private static final int FIVE = 5; |
|
|
|
|
|
|
|
private static final int SIX = 6; |
|
|
|
|
|
|
|
|
|
|
|
public JSliderPaneUI(UISlider b) { |
|
|
|
public JSliderPaneUI(UISlider b) { |
|
|
|
super(b); |
|
|
|
super(b); |
|
|
|
} |
|
|
|
} |
|
|
@ -276,12 +297,12 @@ class JSliderPaneUI extends BasicSliderUI { |
|
|
|
Dimension size = new Dimension(); |
|
|
|
Dimension size = new Dimension(); |
|
|
|
|
|
|
|
|
|
|
|
if ( slider.getOrientation() == JSlider.VERTICAL ) { |
|
|
|
if ( slider.getOrientation() == JSlider.VERTICAL ) { |
|
|
|
size.width = 11; |
|
|
|
size.width = VERTICAL_WIDTH; |
|
|
|
size.height = 16; |
|
|
|
size.height = VERTICAL_HEIGHT; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
size.width = 11; |
|
|
|
size.width = VERTICAL_WIDTH; |
|
|
|
size.height = 16; |
|
|
|
size.height = VERTICAL_HEIGHT; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return size; |
|
|
|
return size; |
|
|
@ -300,7 +321,7 @@ class JSliderPaneUI extends BasicSliderUI { |
|
|
|
g.setColor(slider.getBackground().darker()); |
|
|
|
g.setColor(slider.getBackground().darker()); |
|
|
|
} |
|
|
|
} |
|
|
|
g.setColor(Color.darkGray); |
|
|
|
g.setColor(Color.darkGray); |
|
|
|
g.fillRect(0, 1, w-6, h+1); |
|
|
|
g.fillRect(0, 1, w-SIX, h+1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** */ |
|
|
|
/** */ |
|
|
@ -315,43 +336,82 @@ 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+5, cy); |
|
|
|
g.drawLine(0, cy, cw+FIVE, cy); |
|
|
|
g.drawLine(5+cw/2, cy-4, 5+cw/2, cy+4); |
|
|
|
g.drawLine(FIVE+cw/2, cy-FOUR, FIVE+cw/2, cy+FOUR); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
super.paintTrack(g); |
|
|
|
super.paintTrack(g); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
class Dialog extends JDialog { |
|
|
|
class Dialog extends JDialog { |
|
|
|
private Container container; |
|
|
|
// private Container container;
|
|
|
|
private static final int RESIZE_RANGE = 4; |
|
|
|
// private static final int UPLABELHEIGHT = 25;
|
|
|
|
private Cursor originCursor; |
|
|
|
// private static final int HALFHUNDRED = 50;
|
|
|
|
private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); |
|
|
|
// private static final int DIALOGWIDTH = 150;
|
|
|
|
private Point mouseDownCompCoords; |
|
|
|
// private static final int DIALOGHEIGHT = 200;
|
|
|
|
private int minHeight; // 对话框最小高度
|
|
|
|
// private static final int UPLABELWIDTH = 300;
|
|
|
|
|
|
|
|
// private int minHeight; // 对话框最小高度
|
|
|
|
|
|
|
|
// private JComponent contentPane;
|
|
|
|
|
|
|
|
// private JComponent centerPane;
|
|
|
|
|
|
|
|
// private UILabel upLabel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public Dialog(UIButton b,UITextField j) {
|
|
|
|
|
|
|
|
// super(DesignerContext.getDesignerFrame());
|
|
|
|
|
|
|
|
// container = getContentPane();
|
|
|
|
|
|
|
|
// setUndecorated(true);
|
|
|
|
|
|
|
|
// 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(UPLABELWIDTH,UPLABELHEIGHT));
|
|
|
|
|
|
|
|
// upLabel.setBackground(Color.LIGHT_GRAY);
|
|
|
|
|
|
|
|
// upLabel.setBorder(BorderFactory.createLineBorder(Color.gray,1));
|
|
|
|
|
|
|
|
// upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray));
|
|
|
|
|
|
|
|
// centerPane.add(j,BorderLayout.NORTH);
|
|
|
|
|
|
|
|
// contentPane.add(upLabel,BorderLayout.NORTH);
|
|
|
|
|
|
|
|
// contentPane.add(centerPane,BorderLayout.CENTER);
|
|
|
|
|
|
|
|
//// contentPane.setBorder(BorderFactory.createLineBorder(Color.gray,1));
|
|
|
|
|
|
|
|
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
|
|
|
|
|
|
|
|
//// contentPane.add(new JPanel())
|
|
|
|
|
|
|
|
// container.add(contentPane, BorderLayout.CENTER);
|
|
|
|
|
|
|
|
// minHeight = container.getPreferredSize().height;
|
|
|
|
|
|
|
|
// setSize(DIALOGWIDTH, DIALOGHEIGHT);
|
|
|
|
|
|
|
|
//// validate();
|
|
|
|
|
|
|
|
// Point btnCoords = b.getLocationOnScreen();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// this.setLocation(btnCoords.x - DIALOGWIDTH + b.getWidth() +HALFHUNDRED, btnCoords.y -DIALOGHEIGHT);
|
|
|
|
|
|
|
|
//// initListener();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// this.setVisible(true);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
class PopupPane extends JPopupMenu { |
|
|
|
private JComponent contentPane; |
|
|
|
private JComponent contentPane; |
|
|
|
|
|
|
|
private static final int UPLABELHEIGHT = 25; |
|
|
|
|
|
|
|
private static final int HALFHUNDRED = 50; |
|
|
|
|
|
|
|
private static final int DIALOGWIDTH = 150; |
|
|
|
|
|
|
|
private static final int DIALOGHEIGHT = 200; |
|
|
|
|
|
|
|
private static final int UPLABELWIDTH = 300; |
|
|
|
|
|
|
|
private JComponent centerPane; |
|
|
|
private UILabel upLabel; |
|
|
|
private UILabel upLabel; |
|
|
|
|
|
|
|
PopupPane(UIButton b,UITextField j) { |
|
|
|
public Dialog(UITextField j) { |
|
|
|
|
|
|
|
super(DesignerContext.getDesignerFrame()); |
|
|
|
|
|
|
|
container = getContentPane(); |
|
|
|
|
|
|
|
setUndecorated(true); |
|
|
|
|
|
|
|
contentPane = new JPanel(new BorderLayout()); |
|
|
|
contentPane = new JPanel(new BorderLayout()); |
|
|
|
upLabel = new UILabel(Inter.getLocText("Enlarge_Or_Reduce")); |
|
|
|
centerPane = new JPanel(new BorderLayout()); |
|
|
|
|
|
|
|
upLabel = new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce")); |
|
|
|
upLabel.setOpaque(true); |
|
|
|
upLabel.setOpaque(true); |
|
|
|
upLabel.setPreferredSize(new Dimension(300,25)); |
|
|
|
upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT)); |
|
|
|
upLabel.setBackground(Color.LIGHT_GRAY); |
|
|
|
upLabel.setBackground(Color.LIGHT_GRAY); |
|
|
|
|
|
|
|
upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray)); |
|
|
|
|
|
|
|
centerPane.add(j,BorderLayout.NORTH); |
|
|
|
contentPane.add(upLabel,BorderLayout.NORTH); |
|
|
|
contentPane.add(upLabel,BorderLayout.NORTH); |
|
|
|
// contentPane.add(new JPanel())
|
|
|
|
contentPane.add(centerPane,BorderLayout.CENTER); |
|
|
|
container.add(contentPane, BorderLayout.CENTER); |
|
|
|
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
|
|
|
|
minHeight = container.getPreferredSize().height; |
|
|
|
this.add(contentPane, BorderLayout.CENTER); |
|
|
|
setSize(150, 250); |
|
|
|
this.setPreferredSize(new Dimension(DIALOGWIDTH, DIALOGHEIGHT)); |
|
|
|
// validate();
|
|
|
|
this.setOpaque(false); |
|
|
|
Point btnCoords = j.getLocationOnScreen(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setLocation(btnCoords.x -150+j.getWidth(), btnCoords.y -250); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// initListener();
|
|
|
|
|
|
|
|
this.setVisible(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |