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


Java Knob類代碼示例

本文整理匯總了Java中de.linearbits.swt.widgets.Knob的典型用法代碼示例。如果您正苦於以下問題:Java Knob類的具體用法?Java Knob怎麽用?Java Knob使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: createLabel

import de.linearbits.swt.widgets.Knob; //導入依賴的package包/類
/**
 * Creates a label for a knob
 * @param root
 * @param knob
 */
private CLabel createLabel(final Composite root, 
                           final Knob<Double> knob) {

    // Label
    String text = "100%"; //$NON-NLS-1$
    final CLabel label = new CLabel(root, SWT.NONE);
    label.setText(text);
    label.setAlignment(SWT.LEFT);
    label.setLayoutData(SWTUtil.createFillGridData());
    label.setToolTipText(text);
    
    // Listen
    knob.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent arg0) {
            updateLabel(knob, label);
        }
    });
    
    // Return
    return label;
}
 
開發者ID:WiednerF,項目名稱:ARXPlugin,代碼行數:28,代碼來源:ComponentRiskThresholds.java

示例2: createContents

import de.linearbits.swt.widgets.Knob; //導入依賴的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

示例3: createKnobDouble

import de.linearbits.swt.widgets.Knob; //導入依賴的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

示例4: createKnobInteger

import de.linearbits.swt.widgets.Knob; //導入依賴的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

示例5: createKnob

import de.linearbits.swt.widgets.Knob; //導入依賴的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

示例6: main

import de.linearbits.swt.widgets.Knob; //導入依賴的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

示例7: build

import de.linearbits.swt.widgets.Knob; //導入依賴的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

示例8: updateLabel

import de.linearbits.swt.widgets.Knob; //導入依賴的package包/類
/**
 * Updates the value on the label
 * @param knob
 * @param label
 */
private void updateLabel(Knob<Double> knob, CLabel label) {
    String text = SWTUtil.getPrettyString(knob.getValue())+"%"; //$NON-NLS-1$
    label.setText(text);
    label.setToolTipText(text);
}
 
開發者ID:WiednerF,項目名稱:ARXPlugin,代碼行數:11,代碼來源:ComponentRiskThresholds.java

示例9: main

import de.linearbits.swt.widgets.Knob; //導入依賴的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

示例10: createKnobDouble

import de.linearbits.swt.widgets.Knob; //導入依賴的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.Knob類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。