I created a program with a Swing GUI in NetBeans a while back using the Graphical Editor. I now needed a web version but since I use eclipse now I copied + pasted the code into a new Web Applet project. I found some problems I didn't spot before and updated the code in the web applet.
I want to add some buttons to the GUI, but one problem is its an annoyance to find the part of the code where NetBeans put all the variable declarations, then find another part of the code where all the fields are initialised, then find the other part of the code where the layout needs to be defined, then find the other part of the code where all the action listeners are added, etc... Another problem is that the Swing layouts are complex and also an annoyance to hard code... it is difficult to judge what the exact outcome will look like when you have to edit GroupLayouts with other swing components already layed out in them.
Also, I can't edit this in NetBeans because the Generator is very fussy and if I copy+paste code in there it wont read it as a Java Form nor generate an XML file which I think it uses to manage your layout.
Are there any free GUI designers out there that take a bunch of java swing code and allow you to graphically edit it? How do professionals manage their graphical layouts?
So I should have implemented the Model-View approach from the start.
Here is a nice tutorial on the subject:
http://people.csail.mit.edu/phw/OnToJava/ONTOJAVA755.HTML
Related
I'm new to the world of C# automation so apologies if this is obvious. My colleagues and I work frequently within an app written in Java, and I'm looking to automate some of the tasks. However, I can't seem to identify any of the elements (various menus, textboxes, etc.) within the Java windows using the tools I'm aware of (Inspect and Spy++). Nothing within the main "window" of the app shows up in Inspect (just the title bar and its' children).
I've gotten the automation working by using P/Invoke SendInput commands to click on the various parts of the window I need to click on (based on x/y coordinates) and enter text as if it's coming from the keyboard. However, this seems a bit ... fiddly. I'd feel better using this if I could formalize element names instead of just sending mouseclick instructions via code, is there a way to do this? For example with something like the Windows.Automation library when I don't have the element IDs?
TestStack.White framework written in C# should help you. It's based on UI Automation API and should see any lightweight controls like WPF ones.
I am new to GWT. Followed the GWT docs to set up the Google plugin and the GWT designer in Eclipse "Juno" (V4.2). Created a Web application with the example code. It runs and displays nicely in Firefox:
Then I open the Java class that implements EntryPoint using the WindowBuilder, and the canvas shows something different. The input field label "Please enter your name:" is not visible, and the "Send" button is under the input field, rather than to its right. Screenshot below:
Since the whole point in using the GWT designer is to get the layout right visually, it is kind of disconcerting to see it not working in a WYSIWYG manner with the example code.
Question A: Is there a way of fixing this discrepancy? Are there some config files or HTML or CSS that perhaps need to be edited so that the designer's view matches what the browser would display when the example app is running?
Question B: Is the GWT designer working "as advertised" in your everyday practice? Can I trust this tool? If not, what alternatives would you recommend?
I found the GWT designer a pita tool on eclipse platform which takes memory hogging to whole new level even in comparison to GWT Hosted mode!!!!!
List of GWT Articles from Dev Guide on google.
Preferre Option at enterprise workplace
HTML/CSS/UIBinder for rich look and feel
Handcoded GWT Layouting and Widgets for complex gui behaviour/performance.
Edit - *GWT Designer is hardly updated/maintained* - I have seen only 10 odd checkins in a year. I wish i am wrong ( does google team not update the public svn !!! ) - https://code.google.com/p/gwt-designer/source/list
It becouse in the example project, Gwt inject widgets to existed html. So, you have one part of style in html, and second part in rendered gwt widgets. And it is looks ugly.
If you will use only gwt style approch (without any html styles, e.t.c), designer will be predictable and totaly wysiwyg.
I want to add a java editing area to my Eclipse RCP application where the user can create some java code. I have found a good tutorial here where I can open a java editor without a file so the user can implement some code, but instead of opening the java editor I would like it to be embedded on my Part.
Much like you would attach a Text area to the Part using Text textArea = new Text(parent, SWT.BORDER) is it possible to do the same with an instance of an editor? There doesn't seem to be any API to set the parent of it.
Your problem isn't really easy to be solved. JDT is really complicated and cannot be so easy ported to a ViewPart. There are many Parts, that are dependent with the IEditorPart. There is a similar question on Stackoverflow here.
UPDATE:
I just saw in PlanetEclipse, that Tom Schindl is playing with the creation of a FX java editor. You might give it a try and integrate it in your View. It seems to be possible to integrate Java FX components in SWT. Please give a feedback, if that's possible ;)
I am working on a large undocumented application written in swing/awt. I have to make changes to it and i need to find out what class a form belongs to when i open it. Is there a way to do this via eclipse?
For example: I open the application and to do something with the app such that some frame opens. How do i find out the class of that form? Can this be done through eclipse?
I know i can comb trough the logic but this is a very laborious and largely ineffective process, chunks of the logic are either in jar files or obfuscated.
Thanks.
For figuring out how a given Swing frame is put together, I have found Swing Explorer to be VERY helpful.
https://swingexplorer.dev.java.net/
After installing the Eclipse plugin, note that you need to "Run as ->" to invoke Swing Explorer properly.
I don't know if this is what you need, but maybe you should try searching(MainMenu-->Search) your entire Project for the specific Window title (String) that comes up with this particular window.
I love BooguNote very much (it's a Sharp tool for collecting and organizing information scraps) But what a pity it just run under windows currently.
I tried to build a Java version for BooguNote so I can run it under linux (first step: I want to just make a simple BooguViewer ) since I'm not very familiar with so huge Java libraries, so I ask for help who know the suitable Java tree component in this case.
My requirement is this:
it's not an usual tree component, as you can check from the BooguNote's screenshot as below:
http://boogu.me/en.jpg
Usual tree is used as an outline, but in BooguNote, tree node was used as a content container at the same time - you can even save a huge text in it! (I heard the author said in the forum before he used "Windowless Richedit Control" technology).
Any advices are welcome, Thanks in advance.
This Oracle tutorial tells you how to create graphical user interfaces (GUIs) for applications and applets, using the Java Swing components.
Start with the Using Swing Components tutorial. Go through the following top-level lessons:
Using Top-Level Containers
The JComponent Class
Using Text Components
Go through the following component lessons:
How to Make Frames (Main Windows)
How to Use Panels
How to Use Trees
The Swing components that you want to use to make a viewer are JFrame, JPanel, and JTree.