|
|
@ -1,11 +1,15 @@ |
|
|
|
package com.fr.design.mainframe; |
|
|
|
package com.fr.design.mainframe; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
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; |
|
|
|
import com.fr.design.gui.islider.UISlider; |
|
|
|
import com.fr.design.gui.islider.UISlider; |
|
|
|
|
|
|
|
import com.fr.design.gui.ispinner.UIBasicSpinner; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
|
|
|
|
|
|
|
@ -13,8 +17,6 @@ import javax.swing.*; |
|
|
|
import javax.swing.border.MatteBorder; |
|
|
|
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.DocumentListener; |
|
|
|
|
|
|
|
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.*; |
|
|
@ -29,6 +31,9 @@ public class JSliderPane 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 ONEEIGHT = 18; |
|
|
|
private static final int ONEEIGHT = 18; |
|
|
|
|
|
|
|
private static final int FONTSIZE = 14; |
|
|
|
|
|
|
|
private static final int SPINNERWIDTH= 45; |
|
|
|
|
|
|
|
private static final int SPINNERHEIGHT = 20; |
|
|
|
private static final int TWOFIVE = 25; |
|
|
|
private static final int TWOFIVE = 25; |
|
|
|
private static final int FOURTEN = 40; |
|
|
|
private static final int FOURTEN = 40; |
|
|
|
private static final int HALFHUNDRED = 50; |
|
|
|
private static final int HALFHUNDRED = 50; |
|
|
@ -37,11 +42,14 @@ public class JSliderPane extends JPanel { |
|
|
|
private static final int THREEHUNDRED = 300; |
|
|
|
private static final int THREEHUNDRED = 300; |
|
|
|
private static final int FOURHUNDRED = 400; |
|
|
|
private static final int FOURHUNDRED = 400; |
|
|
|
private static final int DIALOGWIDTH = 150; |
|
|
|
private static final int DIALOGWIDTH = 150; |
|
|
|
private static final int DIALOGHEIGHT = 200; |
|
|
|
private static final int DIALOGHEIGHT = 240; |
|
|
|
|
|
|
|
private static final int SHOWVALBUTTONWIDTH = 70; |
|
|
|
|
|
|
|
private static final int SHOWVALBUTTONHEIGHTH = 25; |
|
|
|
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; |
|
|
|
private UITextField showVal; |
|
|
|
private UITextField showVal; |
|
|
|
|
|
|
|
private JSpinner showValSpinner; |
|
|
|
private UISlider slider; |
|
|
|
private UISlider slider; |
|
|
|
private int times; |
|
|
|
private int times; |
|
|
|
private int sliderValue; |
|
|
|
private int sliderValue; |
|
|
@ -59,6 +67,7 @@ public class JSliderPane extends JPanel { |
|
|
|
private boolean isButtonOrIsTxt = true; |
|
|
|
private boolean isButtonOrIsTxt = true; |
|
|
|
private PopupPane dialog; |
|
|
|
private PopupPane dialog; |
|
|
|
private int upButtonX; |
|
|
|
private int upButtonX; |
|
|
|
|
|
|
|
private JPanel dialogContentPanel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JSliderPane() { |
|
|
|
public JSliderPane() { |
|
|
@ -67,11 +76,18 @@ public class JSliderPane extends JPanel { |
|
|
|
slider.setUI(new JSliderPaneUI(slider)); |
|
|
|
slider.setUI(new JSliderPaneUI(slider)); |
|
|
|
slider.addChangeListener(listener); |
|
|
|
slider.addChangeListener(listener); |
|
|
|
|
|
|
|
|
|
|
|
showVal = new UITextField(); |
|
|
|
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOURHUNDRED, 1)); |
|
|
|
showVal.setText("100%"); |
|
|
|
showValSpinner.setEnabled(true); |
|
|
|
showVal.setPreferredSize(new Dimension(FOURTEN,ONEEIGHT)); |
|
|
|
showValSpinner.addChangeListener(showValSpinnerChangeListener); |
|
|
|
showVal.getDocument().addDocumentListener(showValDocumentListener); |
|
|
|
showValSpinner.setPreferredSize(new Dimension(SPINNERWIDTH, SPINNERHEIGHT)); |
|
|
|
|
|
|
|
//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")); |
|
|
|
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")); |
|
|
|
downButton.setActionCommand("less"); |
|
|
|
downButton.setActionCommand("less"); |
|
|
@ -79,25 +95,20 @@ public class JSliderPane extends JPanel { |
|
|
|
downButton.addActionListener(buttonActionListener); |
|
|
|
downButton.addActionListener(buttonActionListener); |
|
|
|
upButton.addActionListener(buttonActionListener); |
|
|
|
upButton.addActionListener(buttonActionListener); |
|
|
|
|
|
|
|
|
|
|
|
JPanel panel = new JPanel(new FlowLayout(1,1,0)); |
|
|
|
showValButton = new UIButton(showValSpinner.getValue()+"%"); |
|
|
|
|
|
|
|
|
|
|
|
showValButton = new UIButton(showVal.getText()); |
|
|
|
|
|
|
|
showValButton.setBorderPainted(false); |
|
|
|
showValButton.setBorderPainted(false); |
|
|
|
showValButton.setPreferredSize(new Dimension(HALFHUNDRED,TWOFIVE)); |
|
|
|
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTONWIDTH,SHOWVALBUTTONHEIGHTH)); |
|
|
|
|
|
|
|
showValButton.addActionListener(showValButtonActionListener); |
|
|
|
|
|
|
|
|
|
|
|
showValButton.addActionListener(new ActionListener() { |
|
|
|
initUIRadioButton(); |
|
|
|
@Override |
|
|
|
initPane(); |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
JPanel panel = new JPanel(new FlowLayout(1,1,0)); |
|
|
|
popupDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
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,THREEHUNDRED,ONEEIGHT); |
|
|
|
this.setBounds(0,0,THREEHUNDRED,ONEEIGHT); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static final JSliderPane getInstance() { |
|
|
|
public static final JSliderPane getInstance() { |
|
|
@ -116,6 +127,13 @@ public class JSliderPane extends JPanel { |
|
|
|
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")); |
|
|
|
customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton")); |
|
|
|
customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton")); |
|
|
|
|
|
|
|
twoHundredButton.addItemListener(radioButtonItemListener); |
|
|
|
|
|
|
|
oneHundredButton.addItemListener(radioButtonItemListener); |
|
|
|
|
|
|
|
SevenFiveButton.addItemListener(radioButtonItemListener); |
|
|
|
|
|
|
|
fiveTenButton.addItemListener(radioButtonItemListener); |
|
|
|
|
|
|
|
twoFiveButton.addItemListener(radioButtonItemListener); |
|
|
|
|
|
|
|
//TODO
|
|
|
|
|
|
|
|
// selfAdaptButton.addItemListener();
|
|
|
|
|
|
|
|
|
|
|
|
ButtonGroup bg=new ButtonGroup();// 初始化按钮组
|
|
|
|
ButtonGroup bg=new ButtonGroup();// 初始化按钮组
|
|
|
|
bg.add(twoHundredButton);// 加入按钮组
|
|
|
|
bg.add(twoHundredButton);// 加入按钮组
|
|
|
@ -125,8 +143,53 @@ public class JSliderPane extends JPanel { |
|
|
|
bg.add(twoFiveButton); |
|
|
|
bg.add(twoFiveButton); |
|
|
|
bg.add(selfAdaptButton); |
|
|
|
bg.add(selfAdaptButton); |
|
|
|
bg.add(customButton); |
|
|
|
bg.add(customButton); |
|
|
|
|
|
|
|
customButton.setSelected(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initPane(){ |
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
|
|
|
double[] columnSize = { p, f }; |
|
|
|
|
|
|
|
double[] rowSize = { p,p,p,p,p,p,p}; |
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel createSpinnerPanel(){ |
|
|
|
|
|
|
|
JPanel spinnerPanel = new JPanel(new FlowLayout()); |
|
|
|
|
|
|
|
spinnerPanel.add(showValSpinner); |
|
|
|
|
|
|
|
UILabel percent = new UILabel("%"); |
|
|
|
|
|
|
|
percent.setFont(new Font("Dialog", Font.PLAIN, FONTSIZE)); |
|
|
|
|
|
|
|
spinnerPanel.add(percent); |
|
|
|
|
|
|
|
return spinnerPanel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ActionListener showValButtonActionListener = new ActionListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
popupDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChangeListener showValSpinnerChangeListener = new ChangeListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|
|
|
|
int val = (int) ((UIBasicSpinner)e.getSource()).getValue(); |
|
|
|
|
|
|
|
isButtonOrIsTxt = true; |
|
|
|
|
|
|
|
resolutionTimes = divide(showValue,100,2); |
|
|
|
|
|
|
|
refreshSlider(val); |
|
|
|
|
|
|
|
refreshBottun(val); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定义一个监听器,用于监听所有滑动条
|
|
|
|
//定义一个监听器,用于监听所有滑动条
|
|
|
|
ChangeListener listener = new ChangeListener() |
|
|
|
ChangeListener listener = new ChangeListener() |
|
|
@ -134,13 +197,13 @@ public class JSliderPane extends JPanel { |
|
|
|
public void stateChanged( ChangeEvent event) { |
|
|
|
public void stateChanged( ChangeEvent event) { |
|
|
|
//取出滑动条的值,并在文本中显示出来
|
|
|
|
//取出滑动条的值,并在文本中显示出来
|
|
|
|
if (!isButtonOrIsTxt){ |
|
|
|
if (!isButtonOrIsTxt){ |
|
|
|
JSlider source = (JSlider) event.getSource(); |
|
|
|
customButton.setSelected(true); |
|
|
|
EventQueue.invokeLater(new Runnable() { |
|
|
|
EventQueue.invokeLater(new Runnable() { |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
sliderValue = slider.getValue(); |
|
|
|
sliderValue = slider.getValue(); |
|
|
|
getTimes(sliderValue); |
|
|
|
getTimes(sliderValue); |
|
|
|
showValue = times; |
|
|
|
showValue = times; |
|
|
|
showVal.setText(times + "%"); |
|
|
|
showValSpinner.setValue(times); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}else { |
|
|
|
}else { |
|
|
@ -149,28 +212,18 @@ public class JSliderPane extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
DocumentListener showValDocumentListener = new DocumentListener() { |
|
|
|
ItemListener radioButtonItemListener = new ItemListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
JRadioButton temp=(JRadioButton)e.getSource(); |
|
|
|
resolutionTimes = divide(showValue,100,2); |
|
|
|
if(temp.isSelected()){ |
|
|
|
refreshSlider(); |
|
|
|
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%")))); |
|
|
|
refreshBottun(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
|
|
|
|
// refreshSlider();
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void changedUpdate(DocumentEvent e) { |
|
|
|
|
|
|
|
// refreshSlider();
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
private void refreshSlider(){ |
|
|
|
private void refreshSlider(int val){ |
|
|
|
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); |
|
|
|
showValue = val; |
|
|
|
if (showValue >HUNDRED){ |
|
|
|
if (showValue >HUNDRED){ |
|
|
|
slider.setValue((int)(showValue+TWOHUNDRED)/SIX); |
|
|
|
slider.setValue((int)(showValue+TWOHUNDRED)/SIX); |
|
|
|
}else if (showValue <HUNDRED){ |
|
|
|
}else if (showValue <HUNDRED){ |
|
|
@ -181,8 +234,8 @@ public class JSliderPane extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void refreshBottun(){ |
|
|
|
private void refreshBottun(int val){ |
|
|
|
showValButton.setText(showVal.getText()); |
|
|
|
showValButton.setText(val+"%"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public double getResolutionTimes(){ |
|
|
|
public double getResolutionTimes(){ |
|
|
@ -202,29 +255,30 @@ public class JSliderPane extends JPanel { |
|
|
|
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 = (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; |
|
|
|
showVal.setText(newDownVal + "%"); |
|
|
|
showValSpinner.setValue(newDownVal); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
showValue = newDownVal; |
|
|
|
showValue = newDownVal; |
|
|
|
showVal.setText(TEN + "%"); |
|
|
|
showValSpinner.setValue(TEN); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(e.getActionCommand().equals("more")){ |
|
|
|
if(e.getActionCommand().equals("more")){ |
|
|
|
int newUpVal = showValue + TEN; |
|
|
|
int newUpVal = showValue + TEN; |
|
|
|
if (newUpVal <= FOURHUNDRED ){ |
|
|
|
if (newUpVal <= FOURHUNDRED ){ |
|
|
|
showValue = newUpVal; |
|
|
|
showValue = newUpVal; |
|
|
|
showVal.setText(newUpVal + "%"); |
|
|
|
showValSpinner.setValue(newUpVal); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
showValue = newUpVal; |
|
|
|
showValue = newUpVal; |
|
|
|
showVal.setText(FOURHUNDRED + "%"); |
|
|
|
showValSpinner.setValue(FOURHUNDRED); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
isButtonOrIsTxt = true; |
|
|
|
|
|
|
|
customButton.setSelected(true); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -241,38 +295,42 @@ public class JSliderPane extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public UITextField getShowVal(){ |
|
|
|
public JSpinner getShowVal(){ |
|
|
|
return this.showVal; |
|
|
|
return this.showValSpinner; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public UIRadioButton getSelfAdaptButton(){ |
|
|
|
|
|
|
|
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,showVal); |
|
|
|
dialog = new PopupPane(upButton,dialogContentPanel); |
|
|
|
if (upButtonX == 0) { |
|
|
|
if (upButtonX == 0) { |
|
|
|
upButtonX = btnCoords.x; |
|
|
|
upButtonX = btnCoords.x; |
|
|
|
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); |
|
|
|
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() + SHOWVALBUTTONWIDTH , -DIALOGHEIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
if (upButtonX == 0) { |
|
|
|
if (upButtonX == 0) { |
|
|
|
upButtonX = btnCoords.x; |
|
|
|
upButtonX = btnCoords.x; |
|
|
|
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); |
|
|
|
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +SHOWVALBUTTONWIDTH, -DIALOGHEIGHT); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); |
|
|
|
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +SHOWVALBUTTONWIDTH, -DIALOGHEIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -345,66 +403,25 @@ class JSliderPaneUI extends BasicSliderUI { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
class Dialog extends JDialog { |
|
|
|
|
|
|
|
// private Container container;
|
|
|
|
|
|
|
|
// 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 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 { |
|
|
|
class PopupPane extends JPopupMenu { |
|
|
|
private JComponent contentPane; |
|
|
|
private JComponent contentPane; |
|
|
|
private static final int UPLABELHEIGHT = 25; |
|
|
|
private static final int UPLABELHEIGHT = 25; |
|
|
|
private static final int HALFHUNDRED = 50; |
|
|
|
private static final int HALFHUNDRED = 50; |
|
|
|
private static final int DIALOGWIDTH = 150; |
|
|
|
private static final int DIALOGWIDTH = 150; |
|
|
|
private static final int DIALOGHEIGHT = 200; |
|
|
|
private static final int DIALOGHEIGHT = 240; |
|
|
|
private static final int UPLABELWIDTH = 300; |
|
|
|
private static final int UPLABELWIDTH = 300; |
|
|
|
private JComponent centerPane; |
|
|
|
private JComponent centerPane; |
|
|
|
private UILabel upLabel; |
|
|
|
private UILabel upLabel; |
|
|
|
PopupPane(UIButton b,UITextField j) { |
|
|
|
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(UPLABELWIDTH,UPLABELHEIGHT)); |
|
|
|
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)); |
|
|
|
upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray)); |
|
|
|
centerPane.add(j,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));
|
|
|
|