can we generate clickable jfree charts with tooltip using jsp and servlet? - java

I am able to generate stacked bar charts (whatever charts i want) in my application using jsp and servlet.
I need to add tooltips when i hover over the bars and make it clickable so that it calls some mouse click event.
I have gone through chart panels and mouseclick events but want to make sure whether it works in jsp and servlet first.
yeah i know in code we write as saveaspng so it shows the output as image only, can anyone please tell me whether is it possible have clickable output on jsp page using servlet output ??
i know this is possible in swing i have another application which can do this.
note:same is possible in google charts (it uses javascript so no relation between my question and google charts but just for knowledge sake i am mentioning here),but stacked bar considers the whole bar as same no clickable event separatley(this is another issue).

Related

Equivalent/Alternative of HTML <abbr> tag in Android (Java)

If I put the <abbr> tag in an HTML webpage like so in the snippet below, there will be a text WHO, which upon hovering will show its full form World Health Organization in a small box beside it.
<abbr title="World Health Organization">WHO</abbr>
How to replicate the same thing in Android? (I am using Java btw) You may not be able to hover on a mobile device, but can this functionality be replicated on click? If so, how?
For example, I have a paragraph in a TextView like so
HTML is not a programming lang...
I want it so that when the user clicks on the specific word "HTML" its full form should show beside it (In some sort of "floating" box)
Maybe make a small box, position it accordingly and then toggle its visibility on click? I don't know where to start.

customize google maps with popups

Is there an platform that you know of that I can use google maps and make it completely customized to look like this:
michigan_map_idea
Also it is important that we would be able to add a hover popup as well as a selection popup from the location dots. I just want to know whether it is possible to do this. The end goal is to upload the map to wordpress. We are open to coding with javascript, html and css.
This might help in regards to styling your map the way you want: https://mapstyle.withgoogle.com/
For the yellow dot as marker, I would make custom markers, more info here: https://developers.google.com/maps/documentation/javascript/custom-markers
For hover events you can follow the marker click event guide by google, but instead of click - you guessed it - use hover (if this does not work mouseenter and mouseleave):
https://developers.google.com/maps/documentation/javascript/examples/event-simple

Swing: content of multiple frames appear in each other

I'm making a Java Swing application, which loads data from a MySQL database and puts it in a Gantt Chart (I'm using the swiftgantt 4.0 library for this).
I have a start window from where you can instantiate multiple JFrame objects which contains a Gantt chart, you can select from the start window what data you want to retrieve from the database.
The program opens the frames with the charts correctly generated, but the problem is, that at certain action e.g.:resizing the window, or scrolling, or clicking on the chart, the content of the last frame appears in the other frame.
If I use the refreshing function of the Gantt chart, the content switches back, to the original content, but I think it's not a good solution to put the refreshing function
to all events where this anomalies happen.
Does anyone have a clue what's happening here?
I'm thinking of some event handling of the frames, might mix up the charts of the windows, but I'm not sure what causes this.

HTML gallery page in Swing with drag-drop functionality

I was asked to write a JDialog separated into left and right panel. The left panel shows a demo HTML template gallery (small sized), and right panel shows series or list of images. I want to make it such that I can drag image on the list and place it on the gallery (or maybe drag out some image from the gallery). The problem is I don't know where to start with this, can anybody give me some idea?
An HTML gallery typically uses JS to do the 'heavy lifting' (I'm guessing it will require a slideshow as well). While Swing components support HTML (to an extent) they do not support JS.
I recommend not trying to render the HTML/JS in the GUI, instead, provide a JList in the GUI of the image+name objects chosen by the user (using JFileChooser). When each image is selected, you can show the 'preferred name' in a JTextField that allows the user to edit it.
Image order can be shown by the order in the list. To change the order, implement Drag'n'Drop. See the Drag and Drop and Data Transfer lesson for more details.
You will probably need a JLabel in the CENTER of the GUI to display the (full size) selected image, and show the order & timing of the slideshow.
Once the user is happy with the image selections, the order, the names & timing. Offer them a button to write all the details to a single directory including the HTML, script & images (easier). Once the HTML is written, invoke Desktop.open(File) to display the finished product to the user.
As to how you do all that, it is really beyond the scope of an answer on SO. You would need to do the tutorial on each part, and come back with more specific questions.

Adding a Basic Java Program into Website

Firstly I am no longer a student and doing this for other purposes, so don't hold back on the help ;)
I want to incorporate a simple program into my webpage. I want 4 buttons labelled right arm, left arm, activate voice and walk forward. There will be a box above these buttons showing an image of a robot and as the buttons are pressed by the user I want a different image to be loaded in the box.
So if the right arm button is pressed the image with the robot raising its right arm will need to be displayed.
So basically all I want the buttons to do is to load the image that belongs to each one. I am assuming java is the best choice? I have the open source Java package, would I need any other software when it comes to embedding it into a webpage? My webpage is done on dreamweaver and I am pretty good with html. Would appreciate it if someone could point me to the right direction.....Thanks
Don't use Java for this. Use JavaScript. Something like this:
HTML:
<img src="one.jpg" id="firstImage" />
<img src="two.jpg" id="secondImage" />
​<button id="doSomething">Do Something</button>
<button id="doSomethingElse">​Do Something Else</button>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
CSS:
​img {
display: none;
}​
JavaScript:
var hideImages = function() {
$('#firstImage').hide();
$('#secondImage').hide();
};
$('#doSomething').click(function() {
hideImages();
$('#firstImage').show();
});
$('#doSomething').click(function() {
hideImages();
$('#secondImage').show();
});​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
What this essentially does is initially display no images, just buttons. Then as each button is clicked, the corresponding image is displayed. (And all other images are first hidden, since previous button clicks would have displayed previous images.)
This is an overly simple proof of concept, of course. At the very least you'll want to use better variable names :) This just demonstrates the idea of how you'd show/hide images in JavaScript in response to button clicks. (This also assumes the use of jQuery, which is a safe assumption these days. The easiest way to use that is to refer to a CDN link in your page, using a standard HTML script tag.) You can see this code in action here (though the images are broken, of course.)
If there are a lot of buttons and a lot of images, you may be able to re-factor the code to be less repetitive as well. Maybe store the images in an array and have a single button click handler which can associate the sending button with the correct array element, etc. That's up to you.
There are many technologies that could help you: javascript is one of them and it would be much simpler than using Java for such simple thing. You can use Java applet if you really want to use Java for that project.

Categories

Resources