Java Window in another Window - java

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

Related

Capture Keyboard and mouse event thorugh java library on any tools

I want to capture the keyboard and mouse click event on my window everywhere suppose I have opened browser or opened notepad or some other tools, it should not be effected. I know to do one way this with the batch file but I am trying to do this thruogh java libraries. I tried with AWT and swing but they can only capture within their frame.
Please suggest me approach for captuering keyboard and mouse event through java. Any help will be appriciated.
This is problematic the moment you want to run it on different platforms. For Windows, you would need to use Java Native Interface directly to access dll's, or use ready libraries such as this.
These listeners in general are not trivial to implement, but there are some good examples in test sections of linked gitpage.

In Java, how to implement something like File Explorer?

I'm looking for a really simple widget: tree view on the left pane, folder contents on the right, switchable between icons, thumbnails, or detail view. Basically a functional (not pixel for pixel) emulation of Windows File Explorer, but within the Java app. How to do this using only built-in Java libraries? Or a very lightweight framework?
NOT A DUPLICATE
My question is different from the above and I now realize it's a little harder to explain than I initially expected. Two clarifications:
My question is not about a File Chooser. I'm asking about a File Explorer type of dialog. The difference is that a File Chooser is really focused on one task, choosing a file. A File Explorer is a little less focused, and lets the user browse around without a clear objective.
My question is not about native operating system UI / L&F emulation. At all. I'm asking about the basic capability to display the contents of the filesystem using icons and thumbnails. The style and borders etc are not part of my question.
EDIT
I'm looking for something like this
Notice how it's different from this (JFileChooser)
JFileChooser will do that if you are wanting something built in to Java.
https://docs.oracle.com/javase/7/docs/api/javax/swing/JFileChooser.html
If you are not using Swing but SWT (like Eclipse) you can use SWT FileDialog
You could use the AWT library to customly render the entirety of Explorer. Whilst the only hard part about this is correctly using layout managers to get components exactly where you want them and adding event listeners for each button, using AWT wouldn't make it look like Explorer on different operating systems because AWT uses the native system components.
You could check if the OS is not Windows and then use Swing if it isn't. In that case, you'd have to retexture every single used component such that its look and feel is the same as your targeted Windows version. Even if you did that, you'd still have to somehow change the JFrame's look and feel, which is possible using dark magic, but quite obscur. You can do this in a very quirky way, just setUndecorated(true) and manipulate the JFrame's boundaries until it lets you draw outside the JFrame, so that you can draw the Windows' decoration around it without resizing the Window. On top of that, you'd also have to check if it's maximised, as maximized windows don't quite look the same in Windows.
To cut things short, just use JFileChooser if you just want to allow the user to select one or multiple files. There isn't really any point in recreating Explorer, but if that's what you want to do, I'm not stopping you.

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

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.

Window operation notification in Java

I want my Java program to know when a particular program has its window maximized or minimized or may be is running in exclusive full screen mode(most importantly when not). How to go about it?
If its not possible than only if i know that if any program is running in full screen exclusive mode or not!
Write a WindowListener - this will show you how.
i know its a little late to answer this but have a look at this
In Java Swing how do you get a Win32 window handle (hwnd) reference to a window?
once you have the window handle/reference you can perform operations on the window. Its definitely possible to do this since Spy++ that comes along with Visual Studio does this.

Equivalent to Android's Toast or Mac OSX Growl in Java Swing?

Looking for a means of displaying transient, non-modal dialogs in a Swing application. In other words, I'd like to pop up a semi-transparent box with some text in it that can be immediately dismissed, or will fade away in a set amount of time. Is there a library to do this? I don't want to reinvent the wheel if it already exists.
Growl screenshot:
Android Toast screenshot:
(source: devx.com)
This link provides information about "translucent shaped Windows" using Swing, though it does not provide the full sourcecode (but slides explaining what has to be done in order to achieve this). He basically uses JNA to avoid problems with repainting translucent windows and makes use of two libraries to easily add fade etc. support.

Categories