Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this questionI have a .java
file. I need to generate a .form
file using the .java
file. When I write a .java
file then automatically a .form
file should be created. By using java Swing, how can we create a .form
file?
Your question is as vague as they get, but usually it's the other way around - you generate java code from a form file created by a GUI designer such as NetBeans Matisse, Eclipse Jigloo or IntelliJ IDEA Forms Designer. Although they all use the .forms
extension, the internal format differs wildly on different IDEs - it's generally some XML markup that's later used to generate Java code related to the GUI layout, so you wouldn't have to code it yourself. I find it hard to believe you want to generate form files from an existing layout.
As far as I know Sun Java Studio Enterprise is based on NetBeans, so probably your GUI designer is Matisse. There is no way to regenerate the form from the Java code (at least nothing short of you writing some tool to parse the code in the initComponents()
method, which will be a start, but not enough to get everything back). As @gnoupi pointed out, in the other question you posted, your best bet would be to read the existing source and restore the form based on it. All this of course assumes that you're not using version control and there is no way to restore the project's missing form file from there.
精彩评论