What I have is an Application that uses swing components (jpanel, jbutton, jlabel, etc), however I have to use an old PDF viewer (upgrade is not an option) that is based on java.awt.Applet (com.adobe.acrobat.Viewer). The problem comes when I am trying to display it, it draws properly however since this PDF viewer is inside a JScrollPane, it draws over all of the swing components (over the scroll bars and the menu).
Does anyone know how to make the PDF viewer act nicely and not to draw over other components.
Any suggestions are appriciated
You might look at Mixing heavy and light components, which describes some new support for this. I understand "upgrade is not an option", but the discussion may yield some insight.
Related
A while ago I wrote an application in Java using Swing for the GUI development. As I want to learn more about JavaFX I'm trying to convert it but I get stuck on one piece of my application I can't seem to find the right equivalent for in JavaFX. In Swing I was able to make a JPanel, create an image, and then rescale the image based on the size of the JPanel using the component events on the panel. Then I'd draw stuff on the image and draw that on the graphics of the JPanel. Also I'd use mouse events on the JPanel to implement zooming and panning on the underlying image.
I'm not sure whether this was good practise in the first place, but it enabled me to draw anything, from pixels to lines to circles to images, on the JPanel, essentially creating sort of a rendered viewport for my application.
What would be the best way to go about this in JavaFX? I've looked at tons of tutorials and youtube videos, but they all seem to focus just on normal GUI controls like buttons, and when I look at game dev for example they make a lot of use of standard JavaFX Nodes to quickly generate moving entities in their scene. I just need sort of a canvas to render stuff on as I please, but if I add something like a default Canvas or Region in the Scene Builder for my FXML file I don't know how to start drawing on that. I'm completely lost in the jungle of tutorials and documentation on the internet.
Does anyone know of any good resource for this kind of application cause I just don't know where to start.
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.
I want to make an application which will have the following:
a jframe (or frame, or whatever) with some java style menus (Jmenu) on the side, and on the other side of the jframe, a OpenGL canvas (which only occupies part of the jframe) and let them integrate together.
meaning, for example, I want to change a slide, and it will change the view of the opengl.
Is it even possible to embed an OpenGL inside a Jframe?
Also, a recomandation for an opengl library that would support such thing. I played a bit with JOGL, but also saw that there are other open-source, and also LWGL and stuff
EDIT:
Added an image from a project made with JOGL which is exactly what I'm after.
A canvas of JOGL inside a Java GUI
for hight Graphics performance is required to use AWT Component exclusively,
I'd suggesting not mixing AWT with Swing
maybe JOGL could be right way, maybe not
We have a very large Java Swing desktop application comprising of a great deal of views. Developers have done a pretty good job over the years in choosing appropriate class locations which reflect the general structure of our UI for these views. Most of this time this is very helpful in tracking down specific components that have bugs which need tending to. However, there are cases where finding a panel, dialog, etc is quite painful. It usually involves searching our properties files for unique string sequences that appear in the UI.
Does anyone know of a third-party tool that allows a developer to hook into a Swing application and click on a region of the UI to reveal that name/package/hierarchy of the component that was clicked?
SwingExplorer is the perfect tool for that. It does what you are describing, and even more (step-by-step drawing of Java2D, EDT violations, AWT events).
Does anyone know of a third-party tool that allows a developer to hook into a Swing application and click on a region of the UI to reveal that name/package/hierarchy of the component that was clicked
Darryl's Component Tree Model should provide you with this basic information. The demo shows how you would use the root pane as the container for viewing all the components. You would need to add a MouseListener to your application to get the Container that was clicked so you could display the component tree.
There's something doing exactly what you're looking for in the SwingX Demo. The JXTreeTable demo contains a tree of the components hierarchy, when the mouse rolls over a particular component, it is selected in the table.
You can have a look here
Couldn't believe it myself, but it could be really as easy as:
SwingUtilities.getRoot(...).list()
The list method exists since 1.0. lol.
I have project, already developed using canvas and lib used is LCDUI.
It's for nokia keyboard supported devices.
Now I want to incorporate same application for touch devices.
I have used touch methods like pointerpressed, etc.
For normal functionality that worked pretty well.
But it creates problem in commands.
My application is in fullscreen mode. Commands I have created using user defined menu list.
Probles is that I can not directly identify that which command has been clicked.
Setting coordinates for every command is not thr feasible solution for me.
I come across the new lib LWUIT, but i found out that it supports only forms(Can't we use on canvas?).
and integrating LCDUI and LWUIT is also not possible(please give suggestion that can we use both in same application?).
Is it possible to create form under canvas itself?
Any other lib support available?
thank you.
If you want to use LWUIT, then it has a Painter mechanism for custom background painting. I assume you can have a Form with its background painted as you like using Painter.
Some help can be found here:
Using Styles, Themes and Painters with LWUIT
LWUIT is made to override every component. You also have a basic painter class to draw lines and basic geomotry in all sorts of colors you desire. So if you combine those two, you can do some very nice stuff.
So if you override your component with an actionlistener it should generate events, which you can then catch in a parent component who has an actionperformed function.
hope this helps.