How to use a Java GUI designer for Clojure? - java

I'm LOVING coding with Clojure. It's a great language! But until the moment I haven't found any GUI designer for Clojure (with drag and drop components such as Visual Studio's Form Designer, etc). I'm studying programming and my teachers are used to require we do forms. Sometimes the forms are very simple, sometimes more complex.
What I really want to know is: What's the best way to integrate Clojure code within a Java Swing project? I know all that stuff off using jars from compiled Clojure code, but it doesn't seem the right way to do it (coding Clojure, compiling it than using it in the Java project).
I usually use NetBeans for Java projects and Atom + proto-repl for Clojure.
Thank you! (and sorry for any English mistake)

I use seesaw (https://github.com/daveray/seesaw/tree/develop). It is not a GUI designer, only a library/DSL for constructing user interfaces in Clojure build on swing but in clojure, because of REPL, is very easy to develop gui interface interactively (see the tutorial https://gist.github.com/daveray/1441520)

Related

How can I use eclipse to build a GUI? (I want to use only swing/awt and no other packages)

I usually write java code using a simple text editor and .bat files to compile and run. I'm not used to IDEs like Eclipse or Netbeans and as a result every GUI I've made so far has been written by hand.
Questions:
Can I use eclipse to build a GUI easily (e.g. drag-drop features)?
Can this generated code use only the basic java packages (swing, awt) and not any other package provided by the IDE?
I'm saying this because -correct me if I'm wrong- from what I have read so far, I understand that Eclipse and other IDEs use their own packages (to achieve better layouts for example). I would like to avoid this dependency and if possible copy-paste the code generated by Eclipse and then work in the simple way I'm used to.
Thanks in advance.
[edit]
Having tried it for a couple of days, I can now say that WindowsBuilder is exactly what I was looking for. Thank you for all your replies.
Eclipse uses the Standard Widget Toolkit (SWT, not included in JRE by default), Netbeans uses Swing (included).
Since recent Eclipse versions, it includes WindowBuilder to create Swing or SWT via drag'n'drop. WindowBuilder is even bidirectional, so code generation is supported as well as reflecting hand-made changes. It don't know if Netbeans includes this feature, too. In 'New' dialog of Eclipse you find everything you need under the WindowBuilder category.
Yes , You can use the feature of drag and Drop in java by going through these few Steps:
Help → Eclipse MarketPlace → WindowBuilder(Install)
Can I use eclipse to build a GUI easily (e.g. drag-drop features)?
Yes, go to the Marketplace and pull in WindowsBuilder; it supports bi-directional GUI drag-n-drop / direct-code editing.
Can this generated code use only the basic java packages (swing, awt) and not any other package provided by the IDE?
The code generated by the Swing Design tool is strictly Swing/AWT based.
It does offer design tools for SWT and GWT as well.
If you want to create Drag n Drop Swing GUI, you should try Netbeans. Eclipse may have a plugin but i usually find netbeans very good in GUI and it is also recommended by Sun for making Swing/AWT GUI
I haven't seen such in Eclipse. In Netbeans you can of course. But I am warning you! Create the GUI by hand. Netbeans is using GroupLayout to build drag and drop GUI, and that's a nightmare when you look at it!!! If eclipse has the same function, don't expect more than this!! Apart from that, not like .NET, most Java developers create everything by hand (Yes, real programming..That's why most say Java is hard). So, it is better if you can get used to it :)

How to program a Dreamweaver-style IDE, integrated with language engines?

Premise:
I started writing an IDE web application a year or so ago. It would be similar to Adobe's Dreamweaver. It would have a WYSIWYG, text editor, and debugging tools. Of course, there are other new features that I'd like to write- otherwise, I wouldn't be writing my own IDE. I wrote a syntax highlighter and parser in JavaScript and started writing the WYSIWYG using the HTML DOM. However, as fast as rendering and JavaScript engines have gotten, they aren't the best choice for writing an IDE. So, yes, I realize how difficult an IDE is to program.
Question: Currently, I plan to write the IDE in Java or C++ (preferably Java). Instead of writing my own interpreter for PHP/HTML/CSS/JavaScript/etc., I'd like to integrate my application with as many existing tools as I can. I know Java has Rhino and Quercus. Gecko and pretty much any JavaScript engine can be integrated with C++. My question is:
What are the best engines available for C++ and Java? For PHP, HTML, CSS, and JavaScript specifically.
Would it be possible to tap into these engines to write a debugger and other tools? Preferably, as unobtrusively as possible, so I can update engine versions without much hassle.
I'm not sure what the best way to approach this. I'd prefer not to have to go back and rewrite the whole thing because my design is flawed. Any suggestions would be deeply appreciated.
I would start with an open source IDE and extend it. Netbeans and Eclipse already support a good number of languages and have debuggers.
IntelliJ CE supports all the languages mentioned, so perhaps you only need to extend it to do what you want. You might not need to write any code at all. ;)

Integrating Eclipse JDT Core into a new editor

I'm building a Java IDE and am trying to implement autocompletion or intellisense. After looking around for something that will do most of the work for me (not reinventing the wheel etc) I've pulled the code for Eclipse JDT core and am trying to figure out how to implement it in my own IDE. I'm obviously working under the assumption that this is possible.
If anyone knows a lot about Eclipse JDT Core, implementing intellisense, or other fun things that would help me accomplish my goal and would like to weigh in, I would appreciate it! Thanks!
Another module that could help when implementing intellisense would be XText
(might be a bit too generic for your specific JDT domain)
Xtext is a framework for development of programming languages and domain specific languages (DSLs). Just describe your very own DSL using Xtext's simple EBNF grammar language and the generator will create a parser, an AST-meta model (implemented in EMF) as well as a full-featured Eclipse text editor from that.
alt text http://www.eclipse.org/Xtext/documentation/0_7_2/images/getting-started-editor.png

How do "professionals" make a GUI in java?

Thanks for your answers to my previous question about GUI in java. I now wonder what are the solutions chosen by professionals to get a nice GUI, for "real" applications. Do you use swing and JComponents and just change the "look and feel" ? Do you prefer awt or another library ?
Sorry if that question sounds weird, I'm a student and I don't really know how java is used in the real world...
In our company we use Swing, as that is supported by the JVM out of the box, but we do use color coded background colors for some panels and buttons.
If we'd use something different, like SWT or Jambi we'd also have to roll out those frameworks for all platforms, and test those frameworks for all OSses and (supported) java versions. Not nice at all.
It is however fairly tricky to create a nice responsive application with Swing; so you really need to use SwingWorker and the like. With a bit of experience however you can create a nice application that way.
And even if it isn't the fastest framework to develop in, development time is really small compared to defining the functional requirements of the user interface, and testing and support when the version is released.
That said, our target is desktops. If you target mobile devices or also need a web frontend your choices may vary.
I don't believe anyone prefers AWT anymore. Swing supplanted it entirely eleven years ago, building on top of it to correct flaws in the AWT 1.0 design.
Swing isn't the only way that professionals make Java UIs. That works for desktops, but there's also JavaFX now. For the web, UIs are built using HTML, CSS, JavaScript, and JSPs.
My experience is that most organizations that want to create rich GUIs still use Swing, and manually go through all the annoyances of layout managers, etc.
The use of SWT is fairly limited to organizations that are using the Eclipse RCP as their platform. I'm not sure why it hasn't caught on outside this platform.
It's sad to admit, but Java Swing GUIs don't generally look good unless you spend a lot of time creating a more native feel for them. Even then, they often lose out on aesthetics to equivalent programs written specifically for Windows and which use Window APIs like WinForms.
The most decent Apps I saw in the last years were build using Eclipse Rich Client Platform
Eclipse uses the Standard Widget Toolkit
and provides Graphical Editing Framework (GEF)
We typically use Swing becuse it's supported in standard JREs out of the box. Normally we do the initial form design and event hookup in Netbeans and then export it to whatever we wish, Eclipse, for example.
Netbeans spits out pure Java using standard libraries (plus a jar or two you have to include) so it's no big deal designing the form in Netbeans and later moving on to something else.
Some people suggested doing form layout by hand using a layout manager. I see that as an option only if you are doing something big and very well budgeted that has to be maintained ad infinitum. Otherwise it's just too time consuming to be worth it.
We rely on SWT for our Java GUIs. Yes, you have to include an external native library, but the look and feel is native, more responsive (although Swing has become much faster in the past few years) and seamless with other apps on the target platform.
Macintosh OS X creates their own Java runtime. They give Swing components the same look and feel as native applications.
I use strictly Swing. I distribute "real" desktop applications via Web Start for both Mac and Windows that interface with the user's smart card reader.
The NetBeans IDE gives you a WYSIWYG way to create your forms. I've tried it out, and it's pretty neat, but we still use Eclipse as our IDE and design the forms in code.

Netbeans/Eclipse extracting GUI code

Is there a plugin that would allow me to design the GUI in eclipse or netbeans and then extract the source code to be used in another environment?
I am much more comfortable using emacs for my development but gui design is much easier with a WYSIWYG environment. What i am looking for is design the frame in eclipse/netbeans and then extract just gui code so i can import it to my project?
Like JFrameBuilderdoes.
What's wrong with using both Netbeans/Eclipse and emacs on the same set of files?
Use Netbeans or Eclipse to design GUI.
Close Netbeans/Eclipse.
Open Emacs and code away.
Close Emacs.
Rinse and repeat.
Personally, what I have experienced is that GUI design in Swing is best done without a WYSIWYG. I came into Java after many years of developing applications with Delphi, and at that time there was no suitable GUI designer for Swing, which was a bit of a shock for me.
In order for a manual UI design/coding to be efficient a really good layout manager should be used. MigLayout is one of such layout managers. Since I've started using it I have never looked back at WYSIWIG tools -- a sheet of paper, a pencil, MigLayout and a full control over your code.

Categories