当前位置: 首页>>代码示例>>Java>>正文


Java DefaultBoundedRangeModel类代码示例

本文整理汇总了Java中javax.swing.DefaultBoundedRangeModel的典型用法代码示例。如果您正苦于以下问题:Java DefaultBoundedRangeModel类的具体用法?Java DefaultBoundedRangeModel怎么用?Java DefaultBoundedRangeModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultBoundedRangeModel类属于javax.swing包,在下文中一共展示了DefaultBoundedRangeModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testIsKnown

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
public void testIsKnown() {
    class M extends DefaultBoundedRangeModel {

        @Override
        public void setValue(int n) {
            super.setValue(n);
            if (n > 10) {
                super.setValue(10);
                throw new CancelException();
            }
        }

    }
    M model = new M();
    LiveEngine instance = new LiveEngine(model);

    Map<?,?> path = instance.trace(Collections.singleton(last), Collections.<Object>singleton(list));

    assertEquals("Model stops at 10", 10, model.getValue());
    assertEquals("No path found", null, path);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:LiveEngineTest.java

示例2: RangeOptionUI

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
/**
 * Creates a new {@code RangeOptionUI} for the given
 * {@code RangeOption}.
 *
 * @param option The {@code RangeOption} to make a user interface for
 * @param editable boolean whether user can modify the setting
 */
public RangeOptionUI(final RangeOption option, boolean editable) {
    super(option, editable);

    JSlider slider = getComponent();

    slider.setModel(new DefaultBoundedRangeModel(option.getValueRank(), 0,
            0, option.getItemValues().size()-1));

    Hashtable<Integer, JComponent> labels
        = new Hashtable<>();
    int index = 0;
    for (String string : option.getItemValues().values()) {
        if (option.localizeLabels()) {
            labels.put(index, Utility.localizedLabel(string));
        } else {
            labels.put(index, new JLabel(string));
        }
        index++;
    }

    slider.setLabelTable(labels);
    slider.setValue(option.getValueRank());
    slider.setMajorTickSpacing(1);
    slider.setSnapToTicks(true);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:33,代码来源:RangeOptionUI.java

示例3: PercentageOptionUI

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
/**
 * Creates a new {@code PercentageOptionUI} for the given
 * {@code PercentageOption}.
 *
 * @param option The {@code PercentageOption} to make a user
 *     interface for.
 * @param editable boolean whether user can modify the setting
 */
public PercentageOptionUI(final PercentageOption option, boolean editable) {
    super(option, editable);

    JSlider slider = getComponent();

    slider.setModel(new DefaultBoundedRangeModel(option.getValue(), 0, 0, 100));
    Hashtable<Integer, JComponent> labels
        = new Hashtable<>();
    labels.put(0,   new JLabel("0 %"));
    labels.put(25,  new JLabel("25 %"));
    labels.put(50,  new JLabel("50 %"));
    labels.put(75,  new JLabel("75 %"));
    labels.put(100, new JLabel("100 %"));
    slider.setLabelTable(labels);
    slider.setValue(option.getValue());
    slider.setMajorTickSpacing(5);
    slider.setSnapToTicks(false);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:27,代码来源:PercentageOptionUI.java

示例4: HierarchiesPane

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
public HierarchiesPane(int tabPlacement, Locale locale, boolean child)
   {
super(tabPlacement);
addMouseListener(this);

popupMenu = new JPopupMenu();
if(child) {
    swapMenuItem = new JMenuItem("Swap comparator", KeyEvent.VK_S);
    addMenuItem(swapMenuItem);
} else {
    openMenuItem = new JMenuItem("Move to new window", KeyEvent.VK_W);
    addMenuItem(openMenuItem);
}

//int h = getHeight();
int h = getPreferredSize().height;
if(h > 0)
    h -= thumbWidth * 2;
if(h < thumbWidth)
    h = 2 * thumbWidth;
splitter = new DefaultBoundedRangeModel((h + 1)/2, 0, 0, h);
splitter.addChangeListener(this);

setLocale(locale);
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:26,代码来源:HierarchiesPane.java

示例5: PopupVolumeButton

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
public PopupVolumeButton(final PlayBin playbin) {
    this(new DefaultBoundedRangeModel() {

        private static final long serialVersionUID = 1462054216375236024L;

        @Override
        public int getMaximum() {
            return 100;
        }

        @Override
        public int getMinimum() {
            return 0;
        }

        @Override
        public int getValue() {
            return (int) ((playbin.getVolume() * 100.0) + 0.5);
        }

        @Override
        public void setValue(int percent) {
            playbin.setVolume(Math.max(Math.min((double) percent, 100d), 0d) / 100.0d);
        }
    });
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:27,代码来源:PopupVolumeButton.java

示例6: testgetHorizontalVisibility

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
public Result testgetHorizontalVisibility() {
    InstrumentedJTextField ijt = new InstrumentedJTextField();
    InstrumentedUILog.clear();        
    if (!ijt.getHorizontalVisibility().getClass().equals(DefaultBoundedRangeModel.class)) {
        return failed ("getHorizontalVisibility returns a wrong type value");
    }
    InstrumentedUILog.clear();
    if (ijt.getHorizontalVisibility() == null) {
        return failed("getHorizontalVisibility returns null");    
    }

    if (!InstrumentedUILog
            .equals(new Object[][] { 
                     { "JTextField.getHorizontalVisibility"}, 
            } )) {
        InstrumentedUILog.printLogAsArray();
        return failed("expected getHorizontalVisibility not to call any additional methods");    
    }        
return passed();
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:21,代码来源:JTextFieldTest.java

示例7: RangeOptionUI

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
/**
 * Creates a new <code>RangeOptionUI</code> for the given
 * <code>RangeOption</code>.
 *
 * @param option The <code>RangeOption</code> to make a user interface for
 * @param editable boolean whether user can modify the setting
 */
public RangeOptionUI(GUI gui, final RangeOption option, boolean editable) {
    super(gui, option, editable);

    JSlider slider = getComponent();

    slider.setModel(new DefaultBoundedRangeModel(option.getValueRank(), 0, 0, option.getItemValues().size() - 1));

    Hashtable<Integer, JComponent> labels = new Hashtable<Integer, JComponent>();
    int index = 0;
    for (String string : option.getItemValues().values()) {
        if (option.localizeLabels()) {
            labels.put(index, new JLabel(Messages.message(string)));
        } else {
            labels.put(index, new JLabel(string));
        }
        index++;
    }

    slider.setLabelTable(labels);
    slider.setValue(option.getValueRank());
    slider.setMajorTickSpacing(1);
    slider.setSnapToTicks(true);
}
 
开发者ID:vishal-mittal,项目名称:SOEN6471-FreeCol,代码行数:31,代码来源:RangeOptionUI.java

示例8: PercentageOptionUI

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
/**
 * Creates a new <code>PercentageOptionUI</code> for the given
 * <code>PercentageOption</code>.
 *
 * @param option The <code>PercentageOption</code> to make a user interface for
 * @param editable boolean whether user can modify the setting
 */
public PercentageOptionUI(GUI gui, final PercentageOption option, boolean editable) {
    super(gui, option, editable);

    JSlider slider = getComponent();

    slider.setModel(new DefaultBoundedRangeModel(option.getValue(), 0, 0, 100));
    Hashtable<Integer, JComponent> labels = new Hashtable<Integer, JComponent>();
    labels.put(new Integer(0), new JLabel("0 %"));
    labels.put(new Integer(25), new JLabel("25 %"));
    labels.put(new Integer(50), new JLabel("50 %"));
    labels.put(new Integer(75), new JLabel("75 %"));
    labels.put(new Integer(100), new JLabel("100 %"));
    slider.setLabelTable(labels);
    slider.setValue(option.getValue());
    slider.setMajorTickSpacing(5);
    slider.setSnapToTicks(false);
}
 
开发者ID:vishal-mittal,项目名称:SOEN6471-FreeCol,代码行数:25,代码来源:PercentageOptionUI.java

示例9: initComponents

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
private void initComponents() {
        setLayout(new BorderLayout());
        
//        if (UIUtils.isNimbus()) {
            progressDelegateModel = new DefaultBoundedRangeModel(4, 1, 0, 10);
            progressDelegate = new JProgressBar(progressDelegateModel);
            add(progressDelegate, BorderLayout.CENTER);
//        } else {
//            setBorder(new ThinBevelBorder(BevelBorder.LOWERED));
//            setOpaque(false);
//        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:DiscreteProgress.java

示例10: createThumbs

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
protected void createThumbs(int n) {
    thumbNum = n;
    sliderModels = new BoundedRangeModel[n];
    thumbRenderers = new Icon[n];
    fillColors = new Color[n];
    for (int i = 0; i < n; i++) {
        sliderModels[i] = new DefaultBoundedRangeModel(50, 0, 0, 100);
        thumbRenderers[i] = null;
        fillColors[i] = null;
    }
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:12,代码来源:MultiThumbSlider.java

示例11: createModel

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
public BoundedRangeModel createModel(final int min, final int max) {
	return new DefaultBoundedRangeModel(value.get(), 0, min, max) {
		@Override
		public void setValue(final int n) {
			super.setValue(n);
			set(n);
		}
	};
}
 
开发者ID:Njol,项目名称:Motunautr,代码行数:10,代码来源:MonitoredValue.java

示例12: copy

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
private DefaultBoundedRangeModel copy (BoundedRangeModel m)
{
    return new DefaultBoundedRangeModel(
            m.getValue(),
            m.getExtent(),
            m.getMinimum(),
            m.getMaximum());
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:9,代码来源:SheetAssembly.java

示例13: SliderWithSpinnerModel

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
/**
 * Constructs a new model. Precondition:
 * <code>minimum &lt;= value &lt;= maximum</code>.
 */
public SliderWithSpinnerModel(double value, double minimum,
        double maximum, double increment, double precision) {
    minimum = Math.min(minimum, value);
    maximum = Math.max(maximum, value);
    this.precision = precision;
    this.increment = increment;
    this.boundedRangeModel = new DefaultBoundedRangeModel(
            (int) (value / precision), 0, (int) (minimum / precision),
            (int) (maximum / precision));
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:15,代码来源:SliderWithSpinner.java

示例14: ClassySharkExporter

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
public ClassySharkExporter(ClassySharkDumpStrategy dumpStrategy) {
    super();

    JFrame owner = new JFrame("ClassySharkExporter");
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setCurrentDirectory(new File(System.getProperty("user.home")));
    int result = fileChooser.showOpenDialog(owner);

    if (result == JFileChooser.APPROVE_OPTION) {
        File selectedFile = fileChooser.getSelectedFile();

        final JDialog dialog = new JDialog(owner, "ClassyShark Exporter", true);
        BoundedRangeModel model = new DefaultBoundedRangeModel();
        JProgressBar progressBar = new JProgressBar(model);
        dialog.add(progressBar);
        dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        dialog.setResizable(false);
        dialog.setPreferredSize(new Dimension(300, 100));
        dialog.pack();
        dialog.setLocationRelativeTo(owner);
        BoundedRangeModelTask task = new BoundedRangeModelTask(model, dumpStrategy);

        task.go(() -> dialog.setVisible(false), selectedFile);

        dialog.setVisible(true);
        dialog.dispose();
        System.exit(0);
    }
}
 
开发者ID:borisf,项目名称:classyshark-export,代码行数:30,代码来源:ClassySharkExporter.java

示例15: ModernSlider

import javax.swing.DefaultBoundedRangeModel; //导入依赖的package包/类
public ModernSlider(int orientation, int min, int max, int value) {
    this.orientation = JSlider.HORIZONTAL;
    sliderModel = new DefaultBoundedRangeModel(value, 0, min, max);
    sliderModel.addChangeListener(changeListener);
    updateUI();
    init();
}
 
开发者ID:CollapsedDom,项目名称:Stud.IP-Client,代码行数:8,代码来源:ModernSlider.java


注:本文中的javax.swing.DefaultBoundedRangeModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。