Would it be appropriate to use JDesktopPane and JInternalFrame in this instance? - java

I'm writing a program that currently switches back and forth between different JPanels placed on a JFrame that also has a JMenuBar. (We're required to use Swing.)
I need to write a tutorial and right now I have it giving step-by-step instructions from a popup window. However, it doesn't seem to resonate well with test users and quite frankly it's annoying to switch back and forth between screens.
After checking out JDesktopPane and JInternalFrame it seems to make sense to place my entire program in a desktop pane and then create the tutorial using an internal frame. I'm worried that this will force me to place my different screens each in an internal frame which is NOT what I want to do. I just want the tutorial to be an internal popup(?) that can be minimized and moved around if necessary.
Am I going about this the correct way or is there a more efficient/practical way to implement the same tutorial popup feature?

I'm not 100% clear on your problem -- is it that your tutorial keeps popping up new windows for each step? I would assume that you wish both the main program and the tutorial to both be in view while the tutorial is running, and if this is so, perhaps the tutorial should reside in a non-modal JDialog, and then you swap tutorial screens via a CardLayout. ... unless I'm mis-reading your requirements and problem.

Related

Is there a way to embed TightVNC Java Viewer without all those buttons?

I am playing with the TightVNC viewer for Java and can't find the way to embed the VNC screen (Viewer) into my JFrame window. I do not want a separate window. In fact I do not want any of those (useful, but sometimes not required) buttons.
Simply put, I want to have a JFrame with VNC viewer taking the whole window, and all other stuff from the TightVNC viewer hidden.
Any ideas how to achieve this will be greatly appreciated.
TigerVNC and TightVNC are almost the same (1st depends on the 2nd), but TigerVNC is organized a bit different. Because I don't think it would add up explaining everything for TightVNC in detail I'd suggest using TigerVNC instead, if it is possible license-wise ... maybe your problem doesn't exist there. The steps are the same (trace through the code or something... to find the places where the viewport is assembled) for all Java GUI applications, just the classes have other names.

Java Window in another Window

Multi-window applications often have a main-window, and all other windows are kind of 'parented' to it. Minimizing such a sub-window will hide its content and show the title-bar at the bottom-left of the screen. Also, these windows do not have their own Icon in the Task-bar, only the main-window does.
How can I make a window being attached this way to another window?
If that is possible, is it also possible without a referenfe to the actual main window?
#2: I'm embedding Java into such an application and I would like to be able to use awt or swing additionally to the native dialogs, which have this behavior by default.
See How to Use Internal Frames.
have look at JInternalFrames for MDI application
read Oracle tutorial, try code example

MDI with JavaFX or Swing

Back in my, ahem, Visual Basic programming days, I remember it was very easy to create a multi-form program.
In the gui designer I could simply create as many forms as I wanted and then load them in my program where needed.
I'm having a very difficult time doing this in Java.
I started out using the Java FX Scene Builder but soon discovered there doesn't seem to be good MDI support. So, back to Swing. But, again, I don't see a simple way to design a multi form application.
I read somewhere that JDesktopPane was the way to go as it will allow you to have different internal frames, but there is no way, that I can see, to design multiple frames in the NetBeans gui designer.
You would think that you could hide an internal frame in the designer so you can layout another frame. While I can add multiple frames to my JDesktopPane, they all overlap each other making it impossible to design multiple frames.
Are there any tools available to do what I'm trying to do, or do I just need to bite the bullet and code the guis without the help of a designer?
In brief, I just want to create a simple application that displays three or four options on a home screen
Enter new customer
Search for existing customer
Quick estimate
And depending on which the user selects, opens the appropriate form. It would seem that this would be a basic requirement for almost any program and I don't understand why it seems like actually creating an application with multiple windows/forms was never thought of when developing the design/development tools. Thoughts? Suggestions?
If you're really keen on using the multi document interface (MDI) of the JDesktopPane, create each form in it's own class form. Don't drag them to the desktop. This will allow you to isolate them.
(You can double click a internal frame and it should enter "isolation" mode, basically making it the only thing you can see)
However, unless the windows are sharing information (ie you want to see the information in one window to change the information in another), I'd avoid it.
A better solution might be to use a CardLayout which will allow you to switch between each form as you need.
Again, I'd start by building your forms from something like a JPanel, individually, and when you're ready, add them to your main form.
I always encourage people who are coming into Swing anew to hand code their forms, it will give you a great appreciation for how to design forms and the power of the layout managers.

Adding animation/transitions to Java Swing containers

I just wanted to know if there are Java libraries that allow for smooth transitions between Java Swing Containers.
Suppose I have a Java GUI application with a single JFrame. Based upon user actions I would like to change the JPanel contained in my JFrame. Now, this I can do. However this change is instantaneous. What I would like to do is have a slow transition/animation so that it is not too hard on the users cognition.
Concrete Example:
Say the JFrame I have isframe having 2 buttons and I have two JPanel, panel1 and panel2. Depending on which button the user clicked, I would replace the frame with either panel1 or panel2. However I would like this change to be slow/animated (whatever you call it), a fade-in effect per se. So my question is
Is there some Java library that allows for such transitions?
If not, are there other desktop development language(s) that I can use for such transition. I already know of Javascript frameworks like JQuery that allow for this. But, I am looking for desktop development (if not Java then anything else is also fine).
Something like that?
I had the same need: smooth transitions and animations of components, panels and screens in my app, to create a fancy UI. Since I once made an animation engine (Universal Tween Engine) for java, I quickly setup a very small and easy-to-use library to create such animations in swing UIs, the SlidingLayout library.
If that's what you're looking for, there is a dedicated forum in case you need help to setup the lib in your project.
I can think of two animation libraries that would be capable of producing the effect you're after, but you'll have to do the work of getting the transition to actually work
TimingFramework
Trident
You should also check out:
http://weblogs.java.net/blog/kirillcool/archive/2007/04/who_doesnt_want.html
For a possible implementation
I'd also suggest checking out http://filthyrichclients.org/ for further insights

SWT for Windows Mobile: UI Architecture

I have a Windows Mobile application written in Java that uses AWT for the user interface. I am looking at porting the UI to SWT. I got a hold of the SWT libraries for windows mobile and I started looking at what work will be involved in actually porting it over. I think the first thing I have to decide is how to handle a large number of screens in the application.
In AWT the UI is basically a single java.awt.Frame with CardLayout. Each screen is then just an extension of java.awt.Panel, and is added to the Frame. Then whenever we need to change to a different screen we just set that panel to the top-most.
SWT doesn't have such a layout manager (and I'm not even sure if that is the best/most efficient way of doing it anyway, since the system resources associated with every screen in the application are always held). One way I thought of doing it was that each screen would be its own org.eclipse.swt.widgets.Shell. Switching from one screen to another would involve a display manager class creating the new screen (shell) and disposing of the old one (not sure of the performance hit here of creating the shell and all of the widgets every time the screen is shown?). I am not sure though if having multiple shells in one mobile application is a good idea??
Does anyone have any suggestions on the best way to handle multiple screens in a mobile application using SWT? Is there an equivalent to the method we are currently using in AWT, i.e. CardLayout? Or am I right in thinking that this is not really the best way of doing it, given the use of resources for every screen, even if they are not being displayed?
So the answer to my own question seems to be that there is in fact a StackLayout in SWT, which is pretty much identical to CardLayout in AWT. So I can use that and the job of porting from one to the other is pretty easy because they act in the same way.
Not sure how it would play out in Windows Mobile, but MigLayout is a great layout manager for SWT, which may support the kind of layout you describe.
Check out its demos.

Categories