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


Java KnobRange类代码示例

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


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

示例1: createContents

import de.linearbits.swt.widgets.KnobRange; //导入依赖的package包/类
/**
 * Creates the window's contents
 * 
 * @param shell
 *            the parent shell
 */
private void createContents(Shell shell) {
	shell.setLayout(new GridLayout(1, true));

	// Create the buttons to create tabs
	Composite composite = new Composite(shell, SWT.NONE);
	composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	composite.setLayout(new RowLayout());

	// Create the tabs
	tabFolder = new CTabFolder(shell, SWT.TOP);
	tabFolder.setBorderVisible(true);
	tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));

	CTabItem item1 = new CTabItem(tabFolder, SWT.NONE);
	item1.setText("Tab-1");
	
	Group group = new Group(tabFolder, SWT.NONE);
	group.setText("Knob-1");
	group.setLayout(new FillLayout());
	item1.setControl(group);
	
       // Create Knob
       new Knob<Integer>(group, SWT.NULL, new KnobRange.Integer(0, 10));
}
 
开发者ID:prasser,项目名称:swtknob,代码行数:31,代码来源:Example4.java

示例2: createKnobDouble

import de.linearbits.swt.widgets.KnobRange; //导入依赖的package包/类
/**
 * Creates a double knob
 * @param parent
 * @param min
 * @param max
 * @return
 */
protected Knob<Double> createKnobDouble(Composite parent, double min, double max) {
    Knob<Double> knob = new Knob<Double>(parent, SWT.NULL, new KnobRange.Double(min, max));
    knob.setLayoutData(GridDataFactory.swtDefaults().grab(false, false).align(SWT.CENTER, SWT.CENTER).hint(30, 30).create());
    knob.setDefaultColorProfile(defaultColorProfile);
    knob.setFocusedColorProfile(focusedColorProfile);
    return knob;
}
 
开发者ID:WiednerF,项目名称:ARXPlugin,代码行数:15,代码来源:ViewCriteriaListField.java

示例3: createKnobInteger

import de.linearbits.swt.widgets.KnobRange; //导入依赖的package包/类
/**
 * Creates a double knob
 * @param parent
 * @param min
 * @param max
 * @return
 */
protected Knob<Integer> createKnobInteger(Composite parent, int min, int max) {
    Knob<Integer> knob = new Knob<Integer>(parent, SWT.NULL, new KnobRange.Integer(min, max));
    knob.setLayoutData(GridDataFactory.swtDefaults().grab(false, false).align(SWT.CENTER, SWT.CENTER).hint(30, 30).create());
    knob.setDefaultColorProfile(defaultColorProfile);
    knob.setFocusedColorProfile(focusedColorProfile);
    return knob;
}
 
开发者ID:WiednerF,项目名称:ARXPlugin,代码行数:15,代码来源:ViewCriteriaListField.java

示例4: createKnob

import de.linearbits.swt.widgets.KnobRange; //导入依赖的package包/类
/**
 * Creates a knob
 * @param root
 * @param text
 * @return
 */
private Knob<Double> createKnob(Composite root) {
    Knob<Double> knob = new Knob<Double>(root, SWT.NULL, new KnobRange.Double(0d, 100d));
    knob.setLayoutData(GridDataFactory.swtDefaults().grab(true, true).align(SWT.CENTER, SWT.CENTER).hint(MIN_KNOB, MIN_KNOB).create());
    knob.setDefaultColorProfile(defaultColorProfile);
    knob.setFocusedColorProfile(focusedColorProfile);
    return knob;
}
 
开发者ID:WiednerF,项目名称:ARXPlugin,代码行数:14,代码来源:ComponentRiskThresholds.java

示例5: main

import de.linearbits.swt.widgets.KnobRange; //导入依赖的package包/类
/**
 * Main entry point
 * @param args
 */
public static void main(String[] args) {

    // Create display and shell
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("SWT");
    shell.setSize(230, 500);
    shell.setLayout(new GridLayout(1, false));

    // Create Knob
    final Knob<Integer> knob = new Knob<Integer>(shell, SWT.NULL, new KnobRange.Integer(20,60));
    knob.setLayoutData(new GridData(GridData.FILL_BOTH));
    
    // Create Label
    final Label label = new Label(shell, SWT.NULL);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    
    // Attach
    knob.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent arg0) {
            label.setText("Value: "+String.valueOf(knob.getValue()));
        }
    });
    

    // Open
    shell.open();

    // Event loop
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
    }
}
 
开发者ID:prasser,项目名称:swtknob,代码行数:39,代码来源:Example2.java

示例6: build

import de.linearbits.swt.widgets.KnobRange; //导入依赖的package包/类
/**
 * This Method builds the View and add all Attribut Weights
 * @author Florian Wiedner
 * @category ViewAttributeWeights
 * @since 1.7
 * @param parent The Parent Composite for adding
 */
private void build(Composite parent){
		if(this.composite==null&&this.fields!=null){
		 // Create layout
		this.composite = new Composite(parent, SWT.NONE);
		this.composite.setLayout(GridLayoutFactory.swtDefaults().numColumns(fields.length).margins(0, 0).equalWidth(true).create());
        	 // Create composites
            for(int i=0; i<this.fields.length; i++){
                Composite c = new Composite(this.composite, SWT.NONE);
                c.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.CENTER).create());
                c.setLayout(GridLayoutFactory.swtDefaults().numColumns(1).margins(2, 0).create());
                
                //Create Label
                Label label = new Label(c, SWT.CENTER);
                label.setText(this.fields[i]);
                label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
                //Create Knob
                final Knob<Double> knob = new Knob<Double>(c, SWT.NULL, new KnobRange.Double(0d, 1d));
                knob.setLayoutData(GridDataFactory.swtDefaults().grab(false, false).align(SWT.CENTER, SWT.CENTER).hint(MIN_KNOB, MIN_KNOB).create());
                knob.setDefaultColorProfile(defaultColorProfile);
                knob.setFocusedColorProfile(focusedColorProfile);
                
                //Create Text
                final Text labelObject = new Text(c, SWT.CENTER);
                labelObject.setText("0.0"); //$NON-NLS-1$
                labelObject.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
                labelObject.setEditable(false);
                labelObject.setEnabled(true);
                final ARXFields fieldObject=meta.getField(fields[i]);
                knob.setValue(fieldObject.getAttributeWeight());
                labelObject.setText(knob.getValue()+"");
                knob.addSelectionListener(new SelectionAdapter(){
                    public void widgetSelected(SelectionEvent arg0) {
                        double value = knob.getValue();
                        labelObject.setText(value+"");
                        labelObject.setToolTipText(String.valueOf(value));
                        fieldObject.setAttributeWeight(value);
                        meta.setChanged(true);
                    }
                });
            }	            
		}
}
 
开发者ID:WiednerF,项目名称:ARXPlugin,代码行数:50,代码来源:ViewAttributeWeights.java

示例7: main

import de.linearbits.swt.widgets.KnobRange; //导入依赖的package包/类
/**
 * Main entry point
 * @param args
 */
public static void main(String[] args) {
    
    // Create display and shell
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("SWT");
    shell.setSize(70, 150);
    shell.setLayout(new GridLayout(1, false));

    // Create color profiles
    KnobColorProfile defaultProfile = KnobColorProfile.createFocusedSystemProfile(display);
    KnobColorProfile focusedProfile = KnobColorProfile.createFocusedBlueRedProfile(display);

    // Create Knob
    final Knob<Long> knob1 = new Knob<Long>(shell, SWT.NULL, new KnobRange.Long(1l, 20l));
    GridData data1 = new GridData();
    data1.heightHint = 50;
    data1.widthHint = 50;
    knob1.setLayoutData(data1);
    knob1.setDefaultColorProfile(defaultProfile);
    knob1.setFocusedColorProfile(focusedProfile);
    
    // Create Knob
    Knob<Long> knob2 = new Knob<Long>(shell, SWT.NULL, new KnobRange.Long(1l, 20l));
    GridData data2 = new GridData();
    data2.heightHint = 50;
    data2.widthHint = 50;
    knob2.setLayoutData(data2);
    knob2.setDefaultColorProfile(defaultProfile);
    knob2.setFocusedColorProfile(focusedProfile);

    // Focus list
    shell.setTabList(new Control[]{knob1, knob2});

    // Open
    shell.open();

    // Event loop
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
    }
    
    if (!defaultProfile.isDisposed()) defaultProfile.dispose();
    if (!focusedProfile.isDisposed()) focusedProfile.dispose();
}
 
开发者ID:prasser,项目名称:swtknob,代码行数:50,代码来源:Example3.java

示例8: createKnobDouble

import de.linearbits.swt.widgets.KnobRange; //导入依赖的package包/类
/**
   * Creates a double knob
   * @param parent The parent Composite
   * @param min The Minimum Value
   * @param max The Maximum Value
   * @since 1.1
* @category Parameters
* @see <a href="http://arx.deidentifier.org">ARX Deidentifier Project
*      Website</a>
   * @return A new Knob for Doubles
   */
  protected Knob<Double> createKnobDouble(Composite parent, double min, double max) {
      Knob<Double> knob = new Knob<Double>(parent, SWT.NULL, new KnobRange.Double(min, max));
      knob.setLayoutData(GridDataFactory.swtDefaults().grab(false, false).align(SWT.CENTER, SWT.CENTER).hint(30, 30).create());
      knob.setDefaultColorProfile(defaultColorProfile);
      knob.setFocusedColorProfile(focusedColorProfile);
      return knob;
  }
 
开发者ID:WiednerF,项目名称:ARXPlugin,代码行数:19,代码来源:ViewAttributeWeights.java


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