|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.fr.design.gui.frpane; |
|
|
|
|
|
|
|
|
|
import com.fine.swing.ui.layout.Layouts; |
|
|
|
|
import com.formdev.flatlaf.util.ScaledEmptyBorder; |
|
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
@ -12,11 +13,14 @@ import java.awt.BorderLayout;
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.fix; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.flex; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNameObserver { |
|
|
|
|
private static final long serialVersionUID = -8681716725163358249L; |
|
|
|
|
private static double DRAG_BAR_WEIGHT = 0.64; |
|
|
|
|
private static double SPINNER_WIGHT = 0.36; |
|
|
|
|
private UISlider dragBar; |
|
|
|
|
private UISpinner spinner; |
|
|
|
|
private boolean isEditing = false; |
|
|
|
@ -40,11 +44,12 @@ public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNam
|
|
|
|
|
dragBar.setPaintLabels(true); |
|
|
|
|
dragBar.setMajorTickSpacing(minValue < 0 ? (int) maxValue : (int) maxValue - (int) minValue); |
|
|
|
|
spinner = createUISpinner(minValue, maxValue, dierta); |
|
|
|
|
spinner.getTextField().setBorder(new ScaledEmptyBorder(0, 0, 0, 0)); |
|
|
|
|
spinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")); |
|
|
|
|
spinner.setValue(dragBar.getValue()); |
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
this.add(Layouts.row( |
|
|
|
|
cell(dragBar).weight(0.7), flex(0.1), cell(spinner).weight(0.7) |
|
|
|
|
cell(dragBar).weight(DRAG_BAR_WEIGHT), fix(2), cell(spinner).weight(SPINNER_WIGHT) |
|
|
|
|
).getComponent()); |
|
|
|
|
dragBar.addChangeListener(e -> { |
|
|
|
|
if (globalNameListener != null && shouldResponseNameListener()) { |
|
|
|
|