Building a Java Swing application from a configuration file - java

Do you know of any tutorial/example on how to code a dynamic GUI with Java Swing in Netbeans? What I'd like to do is:
Write a text configuration file with parameters for several components
Launch the GUI, which reads the configuration file and automatically builds the graphical interface for those components.
I've never worked with Java GUI before, so I'm not really sure where to start.

The Swing GUI Builder, (formerly Project Matisse), creates such configuration files as a normal part of its operation. The files have the extension .form.

http://download.oracle.com/javase/tutorial/uiswing/index.html
Everything for creating the GUI can be found there. You can choose your own configuration file format (XML, JSON), parse it and away you go. There are probably a number of solutions just like this in open source.

SwiXml looks like a possible answer for this.
I found this (and the likely dup using this query: http://www.google.com/search?q=dynamic+java+swing+gui).

Related

How to edit GUI designer from java class, since i can't find the ".form" file?

I opened a Form application source in IntelliJ, but i can't find the ".form" file, there are just java class. I want to know whether i could open it's GUI designer, and how?
but i can't find the ".form" file, there are just java class
You need to learn how to create GUIs, without the 'GUI designer' of an IDE. That's right, you'll need to actually learn Java. (Shock, horror.) GUI designers work better once you can code a GUI in pure Java, in any case.
I want to know whether i could open it's GUI designer,as figure 2, ..?
No. Most Java code for GUIs don't have an associated .form file.

Create custom Eclipse editor for only one project type

While browsing through the plugin "engine" of Eclipse I was wondering if it is possible to create a custom editor (implementation of EditorPart) which is used for all files of an extension but only if they are within a custom type of project? Let me explain my use case:
I use XML files for UI development together with some scripting language. Now I would like to make a plugin that offers realtime rendering of the current XML in the editor and some kind of WYSIWYG editing behavior. But of course this should only happen if the project is one of my custom project types that has these files. Browsing through the documentation I only found ways to restrict it to file extensions but not file extensions within a project. Is there a way to do so?
Best regards and thanks for any help! Cromon
You can't restrict an editors use to a particular project.
You can bind your editor to a Content Type. You can then use a IContentDescriber to examine a particular file and determine if it is valid for the content type. So if you can identify your XML files from their content only you can do what you want.
There is already a XMLContentDescriber class that provides core code for examining XML files.

How do I use existing raw java code in a new Netbeans GUI Builder

I have some existing hand written GUI code that I wrote in a text editor the hard way. It eventually compiled nicely but now I want to use the GUI builder in NetBeans v7.3 to make some extensive improvements. I cannot for the life of me find any information on how I can load/interface my .java file into the NetBeans IDE GUI Builder. Can anyone steer me to a solution or maybe suggest some keywords? Thanks...
Create a Project in NetBeans then Copy those .Java files into your Package. MAke Sure PAckage name is Correct. Now you can run the GUI from NEtbeans without any Issue. But If you want to use the Designer Mode of Netbeans you need to Create the JFRAME from Netbeans toolbox. Else all there will not be any Issue.
If you have prewritten GUI code that wasn't generated using NetBeans, it's practically impossible to edit it using NetBean's view editor. With that said, you have a couple options. If you designed your application using an MVC approach, then mocking up another view isn't too bad given that your controller and model are independent of the view (for the most part). If your GUI is pretty complex, then I would suggest continuing the project by hand. The GUI builder doesn't really have any benefits other than allowing the developer the ability to mock up designs in a faster manner.

How to manually organize files and folders in NetBeans?

I'd like to be able to manually adjust placement of objects in a project browser tree in netbeans. Reorder, introduce virtual folders, etc. Is it possible? Is there a plugin providing this functionality? Or should I try another IDE?
I do not think that NB has that functionality.... yet.
Before you invest in learning a different IDE, please file an issue that describes the functionality that you were looking for: http://netbeans.org/community/issues.html
(That is how open source improves)

Does it exist: context aware, autocompleting, XML editor with API for including into my app

I need an API-addressable, Java-based XML editor that is context aware. For instance, if you give the editor a schema for the XML document that is supposed to be generated, then, as the user is editing the XML, they will have access to recommendations and autocomplete for XML elements and attributes.
You haven't said what environment this should run in...
Assuming Java, the netbeans editor is very solid and it should be possible to embed it in external Java applications. Obviously, that would involve brining a large portion of netbean's code along with it though.
I haven't used it, but it looks like Jaxe might be provide a solution as well.
Something else to look at would be oXygen. The Author component can be integrated into a web application as a Java Applet.
http://www.oxygenxml.com/xml_author.html
Example:
http://www.oxygenxml.com/demo/AuthorDemoApplet/author-component-dita.html

Categories