I saw the following nice looking tool tips, created using JavaScript JQuery Toolkit.
I was planning to implement a similar look in my Java standalone application.
I was wondering what is the techniques needed to create such effect?
http://sites.google.com/site/yanchengcheok/Home/Tooltip.PNG?attredirects=0
The things come out from my head are :
Transparency - java.awt.AlphaComposite
Gradient Background - java.awt.GradientPaint
Background Shadow - ???
White Line Around The Black Box - LineBorder ?
What is the keyword I shall look for, for the technology marked with ???
Thanks.
Or more preferable, some ready-made library, that can be displayed along JXLayer.
Filthy Rich Clients is a good book for learning how to use Java to create graphical components/effect like the tooltip you want.
Related
I have a table with the following structure:
[relation, variable1, variable2]
I would like to visualize those relation over a triangular matrix, something like this but with any number of variables and not only 4. Is there any free java library to do so? any ideas on how to visualize it by my own?
I don't have any code yet, Just thinking about the idea and process of how doing it.
much appreciation to all :)
I suggest you use a Swing framework that is natively provided by Java so you don't have to import any external library for this task.
I think painting this matrix (as in your link) is not difficult using Swing.
I find this discussion very useful for your case How to draw grid using swing class Java and detect mouse position when click and drag
Because it provides an example of painting a matrix.
I'm working on a project with lwjgl and I've gone pretty far in what concerns progress. Now I need to create an editor so my mapper can start making maps and to make my debugging life easier.
To do a decent editor I need a user interface and at least one viewport.
If you search for Unreal Editor (tm) in google, you'll know what I'm talking about. The problem is I have no idea of how to achieve something like that.
Edit: It's a top down 3d game. The only thing I need to know is how to make opengl (lwjgl) render to a specific region of the window instead of using the whole window.
So ye, I only need to know how to tell OpenGL to render to a specific region of the window, I know how to do the rest.
Try glScissor you can find it in org.lwjgl.opengl.GL11 it will allow you to render content in a specified area and anything outside it will be cut off, it's great for scrolling areas!
You also need to enable GL_SCISSOR_TEST before using it and then disable after using glEnable(GL_SCISSOR_TEST) and glDisable(GL_SCISSOR_TEST)
I'm trying to develop a Java program that does the following:
uses a background picture of a network diagram of clients
positions an image of a bandwidth graph to respective client
refreshes the image of graph every 5 seconds which it fetches from another program that constantly produces snapshots of bandwidth
Now, I can set the background picture and I'm pretty confident that I will be able to refresh the images by using a timer. What I am trying to plan out is how I am going to position these images to the respective clients which is displayed in the background picture. I did some research and it appears that I have several options but I want to make sure I am choosing the right one before I run into problems further down the line.
It seems to me that using a GridBagLayout would be the choice for me, however I would like a second opinion for a more experienced population. If using a GridBagLayout is the correct choice, could you recommend any good tutorials that would help me understand this Layout Manager? Please keep in mind that I have limited experience with Java, especially with GUI oriented Java.
EDIT: If I am not explaining the concept well enough please let me know.
check this out-
http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
GridLayout is likely to meet your needs and it is easy to use - the assumption I make is that image of bandwidth graph is the same/fixed ...
Look for an example here
http://www.roseindia.net/tutorialsearch/?t=java+gridlayout+color
Try Google the keyword "GridLayout" - there are plenty of hits ...
If you want to do advanced layouts, you should take a look at MigLayout.
It's an extremely flexible layout manager that can pretty much act as a replacement for any/all of the existing Swing layout managers. It's worth using if you want to do difficult / complex layouts.
It feels more like a HTML table layout tool, enabling multi-column spans etc. and arbitrary scaling rules.
The "Quick Start Guide" is very good with lots of examples - I'd suggest taking a look at that if you want to evaluate MigLayout for your project.
If the 'bandwidth graph' image(s) is on top of the BG image, look to OverlayLayout
A layout manager to arrange components over the top of each other. ..
OTOH I would not use a layout strategy for this, instead..
Create a BufferedImage the size of the BG.
Paint the BG to the image.
Display the image in a label.
When it comes time to paint the graphs, get a Graphics instance for the image in the label, and paint them to that. If the graphs are always the same size and shape and do not have transparency, you can simply paint them. Otherwise, draw the BG first.
I'm writing a small application which aims to display a catalogue on screen. The window is splitted in three main blocks:
On the left I have the articles' list, on the right a panel for image rendering and under this last component I have some labels for the information.
Now when I select an article I paint the image on the panel and fill the information's into the labels. When I have more than one image associated with the selected article I start a swing timer and I swap the images Evey 5 seconds...
How can I make the photo change more pretty introducing some fancy animations on image change? Do you know any library that could me help?
If you do that directly by code an example and a little explanation would be great.
Thanks in advance
Marco
You can do some basic animation pretty easily with basic Java2D features, but it will take some more effort to add something actually interesting.
You can check out my own library demo (source included) for the ImageTransitionPanel example - it allows to perform a transition between two different Swing components with some interesting animations:
Web Look and Feel demo
There is also a full source of the ImageTransitionPanel included in the demo and sources. That class basically creates all of the transition effects and performs the transition.
You can have endless fun with the getSubImage() method of BufferedImage, illustrated here, and AlphaComposite, illustrated here. See also the Java 2D API.
I'm doing a project to implement virtual chemistry laboratory system. I tried to do this by using java2D. I have come across a big issue here. that is how to show some kind of filling effect to a beaker or to a flask (beaker is an image). I tried out this with setPixel() method in WritableRaster(java.awt.image) class. but it is not much useful.
I need a help to show something filling to a beaker and to show color change when mixing two chemicals. please remember that beaker is an image. thanks in advance if anyone can give me a solution with sample code.
Conveniently, many classes implement the Shape interface. Implementing classes work well with fill(), as shown here. To display color transitions, consider AlphaComposite, shown here.
I'd advise using a dynamic SVG canvas using Batik, and then you can use advanced high-level features like masks and blending and such. It's not the most efficient solution, but who cares? It's flexible for the future. Also, it'd take a lot of optimisation to work out what parts of the image have actually changed and pass that through for efficiency. I expect Batik does that as standard. Also, you'll have something that looks really very nice.
Anyway, then you just need to use Inkscape to create the SVG, and then modify the DOM (Document Object Model) accordingly. It's just like messing with HTML. Here is some SVG beaker clipart.