當前位置: 首頁>>代碼示例>>Java>>正文


Java JSlider.getMaximum方法代碼示例

本文整理匯總了Java中javax.swing.JSlider.getMaximum方法的典型用法代碼示例。如果您正苦於以下問題:Java JSlider.getMaximum方法的具體用法?Java JSlider.getMaximum怎麽用?Java JSlider.getMaximum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JSlider的用法示例。


在下文中一共展示了JSlider.getMaximum方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateSliderSpacing

import javax.swing.JSlider; //導入方法依賴的package包/類
public void updateSliderSpacing(JSlider slider) {
	int width = slider.getBounds().width;
	int max = slider.getMaximum();
	int spacing = 1;
	int mode = 1;
	double pxPerLabel = (double) width * spacing / max;
	if (pxPerLabel <= 0) {
		return;
	}
	while (pxPerLabel <= 30) {
		if (mode == 1) {
			spacing *= 2;
			pxPerLabel *= 2;
			mode = 2;
		} else if (mode == 2) {
			spacing = spacing * 5 / 2;
			pxPerLabel *= 2.5;
			mode = 5;
		} else {
			spacing *= 2;
			pxPerLabel *= 2;
			mode = 1;
		}
	}
	slider.setMajorTickSpacing(spacing);
	int min = slider.getMinimum();
	if (min % spacing > 0) {
		min += (spacing - (min % spacing));
	}
	slider.setLabelTable(slider.createStandardLabels(spacing, min));
}
 
開發者ID:moment-of-peace,項目名稱:AI-RRT-Motion-Planning,代碼行數:32,代碼來源:Visualiser.java

示例2: createLabelField

import javax.swing.JSlider; //導入方法依賴的package包/類
public static JPanel createLabelField(String preText, String postText, JSlider s) {
	JPanel p = new JPanel();

	JSpinner spin = new JSpinner(new SpinnerNumberModel(s.getValue(), s.getMinimum(), s.getMaximum(), 1));
	spin.addChangeListener(ce -> {s.setValue((Integer) spin.getValue());});
	p.add(new JLabel(preText));
	p.add(spin);
	p.add(new JLabel(postText));

	return p;
}
 
開發者ID:CalebKussmaul,項目名稱:GIFKR,代碼行數:12,代碼來源:ViewUtils.java

示例3: bitVal2SliderVal

import javax.swing.JSlider; //導入方法依賴的package包/類
/**
 * Maps from bit value to linear/log slider value.
 *
 * @param v bit value.
 * @param vmax max bit value.
 * @param slider the slider for the value.
 * @return the correct slider value.
 */
private int bitVal2SliderVal(final int v, final int vmax, final JSlider slider) {
    int s = 0;
    final double sm = slider.getMaximum();
    final double vm = vmax;
    s = (int) Math.round((sm * v) / vm);
    // log.info("bitValue=" + v + " -> sliderValue=" + s);
    return s;
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:17,代碼來源:TowerOnChip6BitVDACControl.java

示例4: sliderVal2BitVal

import javax.swing.JSlider; //導入方法依賴的package包/類
/**
 * Maps from linear slider to linear/exponential bit value.
 *
 * @param vmax max bit value.
 * @param slider the slider.
 * @return the bit value.
 */
private int sliderVal2BitVal(final int vmax, final JSlider slider) {
    int v = 0;
    final int s = slider.getValue();
    final double sm = slider.getMaximum();
    final double vm = vmax;
    v = (int) Math.round((vm * s) / sm);
    // log.info("sliderValue=" + s + " -> bitValue=" + v);
    return v;
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:17,代碼來源:TowerOnChip6BitVDACControl.java

示例5: bitVal2SliderVal

import javax.swing.JSlider; //導入方法依賴的package包/類
/** Maps from bit value to linear/log slider value.
 * 
 * @param v bit value.
 * @param vmax max bit value.
 * @param slider the slider for the value.
 * @return the correct slider value.
 */
private int bitVal2SliderVal(int v, int vmax, JSlider slider) {
    int s = 0;
    double sm = slider.getMaximum();
    double vm = vmax;
    s = (int) Math.round(sm*v/vm);
    //log.info("bitValue=" + v + " -> sliderValue=" + s);
    return s;
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:16,代碼來源:AddressedIPotCFGUIControl.java

示例6: sliderVal2BitVal

import javax.swing.JSlider; //導入方法依賴的package包/類
/** Maps from linear slider to linear/exponential bit value.
     *
     * @param vmax max bit value.
     * @param slider the slider.au
     * @return the bit value.
     */
    private int sliderVal2BitVal(int vmax, JSlider slider) {
        int v = 0;
        float s = slider.getValue();
        double sm = slider.getMaximum();
        double vm = vmax;
        v = (int) Math.round(vm*s/sm);
//        log.info("sliderValue=" + s + " -> bitValue=" + v +" Max bit: "+vmax+" Max slider: "+sm);
        return v;
    }
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:16,代碼來源:AddressedIPotCFGUIControl.java

示例7: bitVal2SliderVal

import javax.swing.JSlider; //導入方法依賴的package包/類
/** Maps from bit value to linear/log slider value.
     * 
     * @param v bit value.
     * @param vmax max bit value.
     * @param slider the slider for the value.
     * @return the correct slider value.
     */
    private int bitVal2SliderVal(int v, int vmax, JSlider slider) {
        int s = 0;
        double sm = slider.getMaximum();
        double vm = vmax;
        s = (int) Math.round(sm*v/vm);;
//        log.info("bitValue=" + v + " -> sliderValue=" + s);
        return s;
    }
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:16,代碼來源:ShiftedSourceControlsCF.java

示例8: sliderVal2BitVal

import javax.swing.JSlider; //導入方法依賴的package包/類
/** Maps from linear slider to linear/exponential bit value.
     *
     * @param vmax max bit value.
     * @param slider the slider.
     * @return the bit value.
     */
    private int sliderVal2BitVal(int vmax, JSlider slider) {
        int v = 0;
        int s = slider.getValue();
        double sm = slider.getMaximum();
        double vm = vmax;
        v = (int) Math.round(vm*s/sm);
//        log.info("sliderValue=" + s + " -> bitValue=" + v);
        return v;
    }
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:16,代碼來源:ShiftedSourceControlsCF.java

示例9: bitVal2SliderVal

import javax.swing.JSlider; //導入方法依賴的package包/類
/** Maps from bit value to linear/log slider value.
     * 
     * @param v bit value.
     * @param vmax max bit value.
     * @param slider the slider for the value.
     * @return the correct slider value.
     */
    private int bitVal2SliderVal(int v, int vmax, JSlider slider) {
        int s = 0;
        if (v < knee) {
            s = v;
        } else {
            double sm = slider.getMaximum();
            double vm = vmax;
            s = (int) (knee + Math.round((sm - knee) * log2((double) v - (knee - 1)) / log2(vm - (knee - 1))));
        }
//        log.info("bitValue=" + v + " -> sliderValue=" + s);
        return s;
    }
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:20,代碼來源:ConfigurableIPotGUIControl.java

示例10: sliderVal2BitVal

import javax.swing.JSlider; //導入方法依賴的package包/類
/** Maps from linear slider to linear/exponential bit value.
     *
     * @param vmax max bit value.
     * @param slider the slider.
     * @return the bit value.
     */
    private int sliderVal2BitVal(int vmax, JSlider slider) {
        int v = 0;
        int s = slider.getValue();
        if (s < knee) {
            v = s;
        } else {
            double sm = slider.getMaximum();
            double vm = vmax;
            v = (int) (knee - 1 + Math.round(Math.pow(2, (s - knee) * (log2(vm - (knee - 1))) / (sm - knee))));
        }
//        log.info("sliderValue=" + s + " -> bitValue=" + v);
        return v;
    }
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:20,代碼來源:ConfigurableIPotGUIControl.java

示例11: sliderValueFromBitValue

import javax.swing.JSlider; //導入方法依賴的package包/類
private int sliderValueFromBitValue(JSlider s) {
    double f = (double) s.getValue() / s.getMaximum(); // fraction of slider
    int v = (int) Math.round(f * pot.getMaxBitValue());
    return v;
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:6,代碼來源:VPotSliderTextControl.java

示例12: sliderValueFromBitValue

import javax.swing.JSlider; //導入方法依賴的package包/類
private int sliderValueFromBitValue(JSlider s) {
    double f = (double) s.getValue() / s.getMaximum(); // fraction of slider
    int v = (int) Math.round(Math.pow(2, f * pot.getNumBits())); // bit value is 2^(frac*Numbits)
    return v;
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:6,代碼來源:AddressedIPotSliderTextControl.java


注:本文中的javax.swing.JSlider.getMaximum方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。