Example usage for com.jgoodies.forms.layout ConstantSize getValue

List of usage examples for com.jgoodies.forms.layout ConstantSize getValue

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout ConstantSize getValue.

Prototype

public double getValue() 

Source Link

Document

Returns this size's value.

Usage

From source file:com.intellij.uiDesigner.radComponents.FormLayoutColumnProperties.java

License:Apache License

private static void showConstantSize(final ConstantSize size, final JComboBox unitsCombo,
        final JSpinner spinner) {
    double value = size.getValue();
    ConstantSize.Unit unit = size.getUnit();
    if (unit.equals(ConstantSize.DIALOG_UNITS_X) || unit.equals(ConstantSize.DIALOG_UNITS_Y)) {
        unitsCombo.setSelectedItem("dlu");
    } else {/*from www. j ava2 s  . c  o m*/
        unitsCombo.setSelectedItem(unit.abbreviation());
    }

    spinner.setModel(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0));
    spinner.setValue(value);
}

From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java

License:Apache License

private static ConstantSize scaleSize(final FormSpec rowSpec, final RadContainer container, final int newPx) {
    if (rowSpec.getSize() instanceof ConstantSize) {
        ConstantSize oldSize = (ConstantSize) rowSpec.getSize();
        int oldPx = oldSize.getPixelSize(container.getDelegee());
        double newValue = Math.round(oldSize.getValue() * newPx / oldPx * 10) / 10;
        return new ConstantSize(newValue, oldSize.getUnit());
    }//from  w w w.ja  v a 2 s.co  m
    return new ConstantSize(newPx, ConstantSize.PIXEL);
}