java - 在SWT中如何将一个按钮放在另一个按钮前面

标签 java user-interface swt eclipse-rcp

如何在 SWT 中将“NewButton”放在“Button”前面?请引用下图: 也就是说,如何将“Button”发送到“NewButton”的后面呢? enter image description here

最佳答案

enter image description here

    public static void main(String[] args) {

    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setBounds(10,10,300,300);
    Button b =new Button(shell, SWT.NONE);
    b.setText("Button");
    b.setBounds(60,60,80,80);
    Button button = new Button(shell, SWT.PUSH);
    button.setText("NewButton");

    button.setBounds(120,120,90,90);
    button.moveAbove(b); shell.open();

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

关于java - 在SWT中如何将一个按钮放在另一个按钮前面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32751920/

相关文章:

Java:尝试从不同线程更新 SWT 标签时出现 NullPointerException

java - SWT GC : Color not correctly drawn on Windows

运行appium脚本时出现java.lang.ClassNotFoundException

java - StartActivityForResult - 检查是否存在额外的 Intent 或使用自定义结果代码?

java - 尝试显示 jsp 时出现 404 错误

javascript - jQuery 中指示表单完成的进度条

java - 在 Java Swing 中给按钮预设 "Style"

c++ - 组合可编辑 C++

java - 在 Enum 中保留可能的异常

java - 页面链接: easy with HTML but not with Java SWT