我已将JFormDesigner集成到我的eclipse版本:3.3.2中,我遇到的错误并不完全在主题中,因为它受限于150个字符。
所以我在下面列出了:
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NoSuchMethodError: org.eclipse.jface.internal.text.html.BrowserInformationControl.<init>(Lorg/eclipse/swt/widgets/Shell;IILjava/lang/String;)V)
at org.eclipse.swt.SWT.error(SWT.java:4083)
at org.eclipse.swt.SWT.error(SWT.java:3998)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
上面是我运行从JFormDesigner转换为Java程序的JPanel类时遇到的错误日志。
我的程序运行没有错误,但它确实显示了UI框架。
我一直在寻找问题,也得到了一些新的结果
删除下面给出的文件
.metadata\.plugins\org.eclipse.ui.workbench\workbench.xml
.metadata\.plugins\org.eclipse.core.resources\.snap
但这确实解决了我的问题。我想知道在Eclipse中安装JFormDesigner插件时需要注意的事项。
任何人都可以有解决方案。请告诉我。
------------------编辑部分----------------------
请找到以下代码:
import java.awt.*;
import javax.swing.*;
/*
* Created by JFormDesigner on Sun Aug 10 19:28:27 IST 2014
*/
public class StartUp_frm extends JPanel{
/**
*
*/
private static final long serialVersionUID = 1L;
public StartUp_frm() {
initComponents();
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license -
frame_startup = new JPanel();
lbl_copyright = new JLabel();
lbl_content = new JLabel();
pbar_loading = new JProgressBar();
lbl_welcomeText2 = new JLabel();
lbl_welcomeText3 = new JLabel();
label2 = new JLabel();
//======== frame_startup ========
{
// JFormDesigner evaluation mark
frame_startup.setBorder(new javax.swing.border.CompoundBorder(
new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
"JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
java.awt.Color.red), frame_startup.getBorder())); frame_startup.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});
frame_startup.setLayout(null);
//---- lbl_copyright ----
lbl_copyright.setText("copyright tANiapps");
lbl_copyright.setFont(new Font("Calibri", Font.PLAIN, 18));
lbl_copyright.setEnabled(false);
frame_startup.add(lbl_copyright);
lbl_copyright.setBounds(290, 240, 150, 39);
//---- lbl_content ----
lbl_content.setText("load changing contents");
lbl_content.setHorizontalAlignment(SwingConstants.CENTER);
lbl_content.setFont(new Font("Calibri", Font.PLAIN, 22));
frame_startup.add(lbl_content);
lbl_content.setBounds(40, 180, 365, 50);
//---- pbar_loading ----
pbar_loading.setBackground(Color.red);
frame_startup.add(pbar_loading);
pbar_loading.setBounds(10, 140, 420, 30);
//---- lbl_welcomeText2 ----
lbl_welcomeText2.setText("FASHION GARAGE ");
lbl_welcomeText2.setFont(new Font("Bradley Hand ITC", Font.BOLD | Font.ITALIC, 22));
lbl_welcomeText2.setHorizontalAlignment(SwingConstants.CENTER);
frame_startup.add(lbl_welcomeText2);
lbl_welcomeText2.setBounds(65, 50, 335, 50);
//---- lbl_welcomeText3 ----
lbl_welcomeText3.setText("to StickyStock ");
lbl_welcomeText3.setFont(new Font("Bradley Hand ITC", Font.BOLD, 22));
lbl_welcomeText3.setHorizontalAlignment(SwingConstants.CENTER);
frame_startup.add(lbl_welcomeText3);
lbl_welcomeText3.setBounds(90, 85, 260, 50);
//---- label2 ----
label2.setText("Welcome, ");
label2.setHorizontalAlignment(SwingConstants.CENTER);
label2.setFont(new Font("Bradley Hand ITC", Font.BOLD, 22));
frame_startup.add(label2);
label2.setBounds(105, 25, 235, 30);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < frame_startup.getComponentCount(); i++) {
Rectangle bounds = frame_startup.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = frame_startup.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
frame_startup.setMinimumSize(preferredSize);
frame_startup.setPreferredSize(preferredSize);
}
}
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner Evaluation license -
private JPanel frame_startup;
private JLabel lbl_copyright;
private JLabel lbl_content;
private static JProgressBar pbar_loading;
private JLabel lbl_welcomeText2;
private JLabel lbl_welcomeText3;
private JLabel label2;
// JFormDesigner - End of variables declaration //GEN-END:variables
public static void main(String[] args) {
// TODO Auto-generated method stub
StartUp_frm obj = new StartUp_frm();
//pbar_loading code
/*Thread t = new Thread() {
public void run() {
int i = 0;
while (i <= 100) {
pbar_loading.setValue(i);
try {
sleep(90);
} catch (InterruptedException ex) {
System.out.println("pbar_loading problem : " + ex);
}
i++;
}
}
};
t.start();*/
}
}
这是来自JFormDesigner的转换代码。当我运行它时,没有输出零错误。它至少应该向我展示设计的GUI。
答案 0 :(得分:0)
代码正在尝试查找构造函数
public BrowserInformationControl(Shell parent, int shellStyle, int style, String statusFieldText)
内部类org.eclipse.jface.internal.text.html.BrowserInformationControl
的。这曾经存在于旧版本的Eclipse中,包括3.3,但在以后的版本中不存在。
您需要使用具有此版本BrowserInformationControl
的旧版Eclipse运行或更新为更新的代码。
由于BrowserInformationControl
是一个内部类,因此该代码违反了Eclipse API Rules of Engagement,因此在不同版本的Eclipse上运行是不安全的。