Java Hdd graphical representation - java

Hi I'm working on a hard drive simulation in java and I want to be able to represent fragmentation in any given drive(represented as a series of Objects Hashmaps,Arrays etc) Something like the bars in xp's old fragmentation tool XP toolbar. I was thinking of a bar or pie chart from google i have gleamed that swing may be my best option? Could anyone give any pointers how I might go about this.

I would check out JFreeChart for a potentially huge number of possible renderings. Here's a page with a large number of samples, including code.

JFreeChart is usually the best choice for charting in Swing applications. There are some other open-source libraries as well. See the last question on this page.
However, if you need some custom features, you may need to do some custom rendering in Graphics2D.

JFreeChart might be a solution for bar or piecharts, but If you just need a simple stacked bar, I would indeed recommend overwriting a JLabel from the swing library. That will be very easy.
If you need some more graphs and plots and stuff anyway, definitely have a look at JFreeChart, it's great.

Related

The use of image processing to extract data from a diagram

I have a data flow diagram (a diagram that looks like a flow chart). It has a set of specific geometrical components like rectangles, circles, ellipses and arrows.
What I'm trying to achieve is to detect these shapes and be able to know which component is connected to which component (through the lines) and finally read the text inside each one to extract data from the diagram and do further processing. It is also notable to mention that the diagram will not be drawn by hand but computer generated so we don't have to worry about angles and ratios being inaccurate.
I'm currently working in Java and I was wondering if this is going to be possible since Java is not the best language when it comes to image processing (correct me if I'm wrong). And if it's possible I'd you guys to point out where I should start looking.
I think Java is fine, and it has many libraries to process images. ImageJ is just one example. Personally, I like to use Python, so I write scripts in this language using Java API of the DMelt platform. Look at the documentation of this projecst, wiki. Here is a link to a few examples.
Doing this in Java wasn't a great idea because mainly the lack of online resources. After a good amount of research, I found that the best and the easiest approach was the use of C# and Emgu CV which is a cross platform .Net wrapper to the OpenCV image processing library.
This example helped me to get started with detecting basic geometrical shapes like Lines, Rectangles and Triangles.

Histogram drawing - Image processing tools

I've an issue with drawing an image histogram. I would like to create simple image histogram with basic adjustments. The problem is if there are simple libraries/sdk that could help achieve this. The technology does not matter. I've found that matlab has a lot of image/graph processing tools but it is still kid of "inaccessible" due to the tools. Java/Javascript/python/c# would be great so that I've tagged this question.
AFAIK we can take as eg. RGB components to draw histograms and there would be great if those library would allow to adjust them and in response process the image. I think what I'm looking for is often used in every tool working with graphics.
thx
For python you have matplotlib (http://matplotlib.org/index.html) , it's quite easy and very similar to matlab

JFreeChart on Web

First, I am a final year student. We are creating a KPI and we saw JFree chart can be used to display charts. Now we have a problem about deciding whether the software is web based or not (Major votes came for a Desktop application. Only 1 is there for web based solution. ).
However, this what we have to do;
Display data using Charts
Colors of the areas of the chart MUST change during run time (eg: if < 90% attendance 'RED', if > 90% attendance 'GREEN')
When the user clicks on the particular area of the chart, display all the relevant data as a 'Tool Tip Text Box' or something. When mouse over, display some summary.
There will be 6 KPI's in the dashboard.
KPI's are belong to 2 categories, HR and PROJECTS.
Now my question is, what is the easy way of doing it? Web Based or Desktop? Will JFreeChart support these functions when it is in web? Please help!
First the long answer, then the short one. If you are using JFreeChart on the web, you have two options:
Display the charts in an applet, which will allow you to do basically all the stuff that JFreeChart supports, including the ones you mentioned above.
Use JFreeChart on the server side to generate images that will be served by the server. In this case, #2 will be difficult because you will have to refresh pages, #3 will be very hard or even almost impossible
Given the above, the short answer is: I suggest you build a desktop application, it will be easier to deal with charting.
From my experience is better use a Javascript Library to generate a gantt chart and later integrate with any framework Java Web. You could use some libraries for example:
Twproject Gantt
JQuery Gantt
JSGantt Improved
JQuery.Gantt
Finally There is an option with cost: Daylot Gantt
If you want to use JFreechart It can be used to render an image and post it on the page, you also could use some form of jquery based chart ploting. Either way you would have to take control of refreshing the data. In standalone app it might be somewhat easier.
you can use these JFreeCharts the requirements you have specified.
JFree charts will display the charts as images. But there are some methods which will display the tooltips and the summary, You have to implement those methods based on your requirements.

Guidelines to implement a minimal shape drawing tool desktop application using Java

We need to implement a Java desktop application that allows us (initially) to create / edit / resize / polygons on (initially) images. Then these polygons would be mapped to objects in our domain model.
So we basically need a toolbar with the options describe above and the possibility for the example to create a polygon on the an image and then scale it, or resize it, just that.
Do you know some library that could facilitate our work?
We've analyzed GEF, Picollo, NetBeans Visual API, Plain Swing or SWT/JFace, but none of them seems to help us to achieve our goal, which is, implement a really basic image editing tool.
I would like to mention that I'm not saying that what I want to do is not possible with the analyzed libraries, of course it can be done, but I'd like to learn from your experiences which is the correct path to take for this problem.
Any suggestion will be welcomed.
You could try to use GEF and the eclipse plataform.
this article could help you.
saluti
You might look at GraphPanel, a simple object drawing program. The control components are arranged in a JPanel, but JToolBar is a more flexible alternative.
Have you looked at imagine.dev.java.net? It is a NetBeans Platform application, which, though unfinished, might provide you with an interesting starting point.

Turn photoshop design into Java GUI

I can't seem to find anybody who has done or posted something like this; Essentially I want to design my own UI in photoshop and then slice down the images to use it in a Java application. Essentially coding in the PSD file as the GUI. Is this possible? If so, can anybody lead me in the right direction?
I'm not sure what editor to use for this sort of stuff. I am using the Eclipse IDE and I know there is a Visual Editor but, I already have the actual design for every component in a PSD file. All I want to do is to start incorporating this into the application. Thanks.
It depends on how far your design goes. If you simply want to have normal Swing components on top of your image this is easy. Convert your PSD into (for example) PNG, create a custom JPanel subclass that loads the image and overwrite the paintComponent() method to draw the image instead of the normal background. All child components can then be set to be transparent with setOpaque(false). This puts your image into the background and puts the components float on top of it.
If you want to change how individual components look, its a lot more work. You basically need to implement a new Look&Feel for Swing. I wouldn't recommend going that route, unless you really have to, we are talking about weeks of work here, and it requires a lot of testing to really make it work properly on all platforms.
Alternately, there are already tons of custom Look&Feels available, I suggest you take a look at some freely available ones (just google "java look and feel"). Many of them can be customized to some degree (how much depends on the actual implementation, so take a close look at the source/documentation for each of them).
You might want to take a look at NetBeans which has a Swing GUI Builder. You would have to redraw your components there, and then write all the code to process the events. It is sometimes good to start with that, though often times it is less frustrating to lay them out with code by hand as it can difficult to make changes in code and have the builder keep up. There is nothing I know that will let you start from a photoshop image and proceed to building a GUI. Sounds like a good project to make someone rich. :-)

Categories

Resources