How do I extend a simple InputDialog in an eclipse plugin to put additional checkboxes, radio buttons, etc?
You need to create your own dialog box. You do that by using SWT, the Eclipse UI framework. If you are a good Java coder, the best thing you can (IMHO) do is look at the SWT code snippets.
Another option, perhaps better one, is using JFace. It is a framework built on top of SWT. JFace makes it easier to build the UI and it works with SWT without hiding it. You can find many code examples of doing dialog boxes with JFace here.
Related
Is possible use JTree in Eclipse plugin development instead of standard JFace tree?
I'm developing it in Kepler, wan't work with custom icons etc. like in JTree.
You can use JTree and other Swing controls using SWT_AWT bridge. However, this is far from trivial, as Swing will have its own event loop, you'll have to figure out which UI thread different code should run on, translate between different types of events (e.g. when resizing) etc. Generally it's better to figure out how to achieve your purposes in the SWT/JFace/RCP way.
I'm a .net developer and I am studying Swing for Java and I have a question.
Is there any way to build the form controls by dragging and drop like a simple .net windows application project or WPF project?
I am using eclipse and it seems that everybody works with controls by adding positioning and width, height by code, I find that a pain in the a**.
Yes! Take a look at Window Builder for Eclipse (install it from the update site). Netbeans has also a built-in editor, if you prefer that IDE.
You need to install a plugin to do that.
In Eclipse you can try WindowBuilder.
In Netbeans this ability comes within the standard package.
Java's Swing framework tries to address a broad set of platforms, and it does this by separating out look-and-feel concerns, layout concerns, etc. The most painful part of setting up a form is the layout, and that is driven by the LayoutManagers.
There are various LayoutManager implementations built to be used in conjunction with form designer tooling. I've personally had good results with IntelliJ's designer. See some screen shots and feature listings here.
I would personally not recommend using any Drag and Drop builders. In some IDEs the generated code is not editable. Some IDEs allow you to edit the code, but the bottom line is no matter what IDE you use the generated code is very difficult to maintain. After a while you will find it difficult to work with it yourself.
Instead, since you are just starting out, I would recommend using a good layout manager right away. While we are on that, give the jdk's layout managers a wide berth. They are horrible and that's what causes most people to go in for the drag and drop solution. Instead try the Jgoodies Form Layout. Its very easy to understand and use. The link is here:
http://www.jgoodies.com/freeware/formsdemo/index.html
After you have understood that, try to give this builder I wrote a shot. It makes life even more simple:
http://code.google.com/p/swingobjects/source/browse/SwingObjects/src/org/aesthete/swingobjects/view/SwingObjFormBuilder.java
Till now, I was using VB for developing applications. Now I have to use Java for developing the front-end. I am quite confused with the Components. Need help.. A book reference or site reference would also do the job.
Basically, I will be using MenuBar, ToolBar, a Frame with JEditorPane. Now if I want to use a small window which will be a child form, to write some notes, of the master frame, which Component should I use?
I guess you're looking for a JDialog or a JPanel. Follow the Swing tutorial. It has detailed guidelines for every component, and has a visual index of all the components.
You can use a JInternalFrame for this. Follow this link for a demo
Components are quite easy to understand. A detailed tutorial is given here. But to tell you the gist Components are nothing but containers. For example JPanel is a component which can hold another component for example a JButton. Since JButton is again a container, you can add one more component, a JPanel to it.
The order and placement of the components that you add are determined by layouts. You have different layouts viz Borederlayout, BoxLayout, Flowlayout, GridLayout, GridBaglayout each having its own pros and cons and behaviors on how it reacts when window is resized.
For an IDE, I would recommend using Netbeans as you can drag and drop components as well as take a look at the generated Java source code to get a better understanding.
You want to the develop desktop applications using java right?
You need:
-Installed JDK(Java development Kit)
-You will need an IDE. My favourite is Eclipse.
There are many out there, but maybe the most intuitive for beginners in java might be Netbeans.
-When creating applications that use the components you mentioned, you will be using the libraries in the pagcage javax.swing(See the documentation in the link)
-And finally, just one more suggestion(Optional), is to get also a most powerfull IDE, just for graphics, so you can speed up your programming.I suppose you would like to speed up your development. In that case i highly recommend you this tool: JFormDesigner
Watch the videos and in matter of a couple of hours you will be developing interfaces fast as light :)
I hope this is useful
I cannot find one online and I am surprised there isn't one... but is there an online Java GUI Layoutmanager at least?
WindowBuilder for Eclipse is phenomenal. One of the things that awesome about it is that you can hand modify its' generated code and it will pick that up without a problem.
What do you mean by an online GUI builder? If you want one that's a webapp, it's not likely you're going to find one.
If you're looking for a GUI to build a GUI, I would recommend the Netbeans IDE. I forget where it is exactly in the IDE, but you can basically just do file->new->java-gui (or something of the sort) and you will get a very nice interface for constructing swing gui's.
I'm creating a plugin project that will have a menu and toolbar item, that when clicked, will open a dialog for user interaction (input, searching, etc.). Should I create the dialog using SWT or Swing?
One advantage of doing it in Swing is that you don't have to supply any other libraries, because Swing is part of JRE. With SWT you have to do it and you have to have separate dlls for specific platforms.
UPDATE:
Since you mentioned that you have to create Eclipse plugin, I think you have a clear choice here - SWT. It is what Eclipse is based on.
SWT.
Debate over the merits of Swing and SWT is irrelevant. Your plug-in will integrate with a platform built on SWT. Using the same user-interface toolkit will simplify your development and testing, and produce better results.
There are cases where it's useful to use Swing within Eclipse, such as when you have an existing codebase that would be impractical to port. There is an SWT/AWT bridge; I have not used it.
Like #eugener, I prefer Swing to SWT, but both are rich, well-maintained frameworks that will serve the purpose. NetBeans and Eclipse are widely used exemplars. SWT binaries for popular platforms aren't too hard to integrate. The SWT FAQ may offer some perspective.
You'll need some other criteria to decide.
Since you're integrating Code Barrel into Eclipse, and SWT is part of the Eclipse project...
Actually, you should be looking at the Eclipse Plug-in Architecture and see how it works.