我正在学习如何使用Eclipse IDE,并尝试运行在Eclipse中构建的组合。 但是,我无法运行GUI,有人可以帮忙吗? 我知道我需要public static void main(String[] args)
但是我需要添加什么方法才能使其正常运行? 谁能帮帮我吗。
package gui; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Combo; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.plaf.metal.MetalIconFactory; import org.eclipse.swt.custom.CCombo; import org.eclipse.wb.swt.SWTResourceManager; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; public class GUI extends Composite { // Strings to use as list items private static final String[] items = { "Item 1", "Item 2", "Item 3", "Item 4" }; public Framework(Composite parent, int style) { super(parent, style); Combo comboBox= new Combo(this, SWT.DROP_DOWN); comboBox.setBounds(174, 36, 534, 20); comboBox.setItems(Algorithms); Label lblOut = new Label(this, SWT.NONE); lblOut.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblOut.setBounds(38, 145, 534, 327); Button btnExit = new Button(this, SWT.NONE); btnExit.setText("EXIT"); btnExit.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); btnExit.setBounds(591, 421, 166, 51); btnExit.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { System.exit(0); } }); } @Override protected void checkSubclass() { // Disable the check that prevents subclassing of SWT components } public static void main(String[] args) { Framework framework = new Framework(); Composite c = new Composite(framework, SWT.NONE); } }
我在Framework framework = new Framework();
上遇到错误Framework framework = new Framework();
因为我需要两个参数parent, font
。 请帮助并解释我只是Java的初学者。