欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
使用DecoratedField裝飾SWT
 
DecoratedField用來(lái)實(shí)現對Control的裝飾,可以為button,combo,text等控件做出如下效果。
控件邊上提示的種類(lèi)有4種,分別是Proposal, Required, error, warning.
代碼很簡(jiǎn)單:
package jface;

import org.eclipse.jface.fieldassist.DecoratedField;
import org.eclipse.jface.fieldassist.FieldDecoration;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jface.fieldassist.IControlCreator;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

/**
 * This class demonstrates TableViewers
 
*/

public class FieldDecorationDemo {

    
public void run() {
        Display display 
= new Display();
        Shell shell 
= new Shell(display);
        shell.setSize(
200200);
        shell.setText(
"Button Example");
        shell.setLayout(
new GridLayout());

        createFieldDecoration(shell);

        shell.open();
        
while (!shell.isDisposed()) {
            
if (!display.readAndDispatch())
                display.sleep();
        }

        display.dispose();
    }


    
private void createFieldDecoration(Shell shell) {
        createCombo(shell);
        createButton(shell);
        createText(shell);
    }


    
private void createText(Shell shell) {
        IControlCreator cbCtrl 
= new IControlCreator() {

            
public Control createControl(final Composite parent, final int style) {
                Text text 
= new Text(parent, style);
                text.setText(
"text");
                
return text;
            }

        }
;
        DecoratedField dField 
= new DecoratedField(shell, SWT.BORDER, cbCtrl);
        FieldDecoration decoration 
= FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
        dField.addFieldDecoration(decoration, SWT.LEFT 
| SWT.TOP, false);
    }


    
private void createButton(Shell shell) {
        IControlCreator cbCtrl 
= new IControlCreator() {

            
public Control createControl(final Composite parent, final int style) {
                Button button 
= new Button(parent, style);
                button.setText(
"button");
                
return button;
            }

        }
;
        DecoratedField dField 
= new DecoratedField(shell, SWT.BORDER, cbCtrl);
        FieldDecoration decoration 
= FieldDecorationRegistry.getDefault().getFieldDecoration(
                FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
        dField.addFieldDecoration(decoration, SWT.LEFT 
| SWT.TOP, false);
    }


    
private void createCombo(Shell shell) {
        IControlCreator cbCtrl 
= new IControlCreator() {

            
public Control createControl(final Composite parent, final int style) {
                Combo cb 
= new Combo(parent, style);
                cb.setText(
"combo");
                
return cb;
            }

        }
;
        DecoratedField dField 
= new DecoratedField(shell, SWT.BORDER, cbCtrl);
        FieldDecoration decoration 
= FieldDecorationRegistry.getDefault()
                .getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED);
        dField.addFieldDecoration(decoration, SWT.RIGHT 
| SWT.TOP, false);
    }


    
public static void main(String[] args) {
        
new FieldDecorationDemo().run();
    }

}

 
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Eclise Rcp 系列一 第一個(gè)SWT程序
采用SWT實(shí)現系統文件夾的樹(shù)形結構顯示
Eclipse配置SWT軟件開(kāi)發(fā)環(huán)境
Eclipse RCP 開(kāi)發(fā):從登錄對話(huà)框說(shuō)開(kāi)去 - 海邊沫沫 - BlogJava
SWT實(shí)現彈出日歷控件
使用Eclipse RCP進(jìn)行桌面程序開(kāi)發(fā)(二):菜單、工具欄和對話(huà)框 - 海邊沫沫 - ...
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久