Can you use JSF/Primefaces to update a JARs JFrame content? - java

I'm designing an executable Java program that is going to behave similarly to a webpage, but there won't be internet. Everything will just be in a JFrame and the contents are going to be updated for simulate going to a new page on the site. Would it be possible to use JSF and Primefaces for this? I've only ever done JSF with a webpage and am not sure if I could use it for a JFrame type program. I realize I can't recompile, I'm just wondering if I can use xml style and JavaBeans with JSF in a JFrame rather than the internet and how to go about that.

Related

GWT example app and the GWT Designer: what you see is not what you get

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.

Reading Text File Data and writing to TextArea

So I have a few basic questions that are probably going to be very simple for you guys. Keep in mind, I am not a programmer. I'm just a low-level IT support person who took a few programming courses in high school.
I've got an Announcements program I'm trying to build in Java. The program will launch in a Java applet, and I want it to accept input from an "announcements.txt" file (which will be what we edit with new announcements) and then display it in the applet. I am using the latest version of NetBeans to stumble my way through this.
The program will be added to a group policy in Active Directory to launch at login for all employees.
My questions are:
Can I just use FileOutputStream to write the "announcements.txt" to a TextArea? I've only ever dealt with console applications.
I added a ScrollPane to the applet design, and just placed a TextArea over top of it. Is this how it is meant to be done? Will it automatically insert scroll bars when it goes outside the window or am I supposed to output the text directly to the ScrollPane?
Sorry if this all seems kind of basic. I'm an aspiring programmer, but I've got a LOT of work ahead of me before I become even semi-proficient. ANY INPUT IS APPRECIATED!!!
No.
A JTextArea can accept an input stream to read from.
An applet must access 'application' resources by URL.
With the Swing equivalents, yes. With the AWT equivalents, the ScrollPane is not needed, since a TextArea has inbuilt scrollable ability.

How should I efficiently update a Swing GUI?

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

Reloading an iFrame which was running an Applet

I have a web page which is divided into several iFrames.
In each frame is a different solution, like JavaScript in one, flash in another, applet in another.
When a user interacts with the Applet, I am trying to provide a solution where if a certain event happens in the Applet, that the Applet will die and the same iFrame gets loaded with another solution (with an href like solution). I want to be able to load another Applet, or a raw HTML solution, or whatever.
I suspect I need to wrap these solutions in something else like JavaScript, but wondering what would this solution look like.
Thanks in advance.
See Applet.getAppletContext().showDocument(url, target).
Note that it is not guaranteed to be implemented in the JRE/browser combo. the applet is loaded in, let alone work. That is where the JavaScript comes in. ;)

Is there a way to find out the class of form using eclipse?

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.

Categories