Is it possible to drag and drop some table from a web page and get the same table structure on a JTable?
You'll want to implement a DropTargetListener on the swing component you want to drag the HTML into. Then get the HTML from the drag using a text/html DataFlavor, and parse the HTML, converting it into a TableModel. Set this TableModel on your JTable.
I rode it is possible to Drag n Drop from desktop to browser, but not the other way around.
So, i don't know the answer to your question, but i would mention a little idea came to mind, maybe you find interesting:
Not directly dragging the table to the swing app. Instead drag that table from the browser, to some textArea or image on the page. It could then automatically transform the tabellar data to XML start some stream that sends that data to your swing application(Maybe some webservice could do pass it to the desktop app).
I don't know if that can help you giving you some tips, other thing comes to my mind is the dropbox API for java, check it out, maybe you have some interesting features that can help you.
Related
As a means to display information on a website developed mainly with GWT and EXT-GWT, i am using a HTMLLayoutContainer. So far, the information it is displayed correctly, but it is too harsh or rough to display this way, meaning rough, not nice to see.
So the question is : Is there any other and nicer way to display (print, draw) information with GWT?.
If so, how?
You need to work on CSS
GWT CSS Ref
I'm looking for a solution to this and I have searched the web for an answer with nothing. I need a scrolling message on my webpage that can be updated by the same website but on a different page. (e.g www.webpage.com <-- has the scrolling message on it, www.webpage.com/settings <-- has a form in which you can change/update the scrolling message)
I'm pretty sure this is achievable with Java, but my knowledge on Java is slim and all my efforts have come to a fail. I have managed to get a scrolling message on my webpage and I'm sure if I could read a text file (with the message in) then assign that to a 'var', I could make that scroll but I don't know how to do that.
If you know a completely different method of doing this I am happy to change mine.
Thanks in advance,
Tom.
I would recommend javascript instead of java, since java is not really conventional anymore and looks ugly too (and requires a special plugin).
It depends on how fast you want to update the scrolling text how you want to do this. I would say save the text to a .txt or database from settings, and then have your page get it.
You can then use php to read the value from the .txt file or database to display it on your website.
If you want it to be extremely up to date you can let javasript call a little .php file that reads the file and gives you the content.
To make your text scroll you don't really need anything other than html, like so:
<marquee behavior="scroll" direction="left">Your scrolling text goes here</marquee>
You can read more about that here: http://www.quackit.com/html/codes/scrolling_text.cfm
Hello im making a program and using TableModel. I have 6 column filed with string's. I want the sixth column string make it look like URL. When i mean look like URL , i mean turn it into blue and be underlined. Is it possible to do that?
You need to write custom TableCellRenderer for your jtable. See this link.This may be helpful for you.
Sun had a very good tutorial (http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#modelchange) on cerating jtable. just go through it before you start. hope this tutorial will help you.
But below is my suggestion.
("<html><b><u>link</u></html>");
<html><b>bold</b></html>
a similar kind of thing
However, I wouldn't recommend altering the data in your model just to effect display. Instead I would create a custom cell renderer which accomplishes this effect and set it on the table. You could either wrap your text in the HTML or manually set font color and style properties on the renderer to mimic html.
Now even if you were to include the url in the html you still can't click on it. There is no component in the table. You don't really want to go into edit mode when clicking on a url. You just want to open that link. To accomplish this you would add a mouse listener to the table itself. When you receive a click event, you would then programatically determine which cell it was over, go back to your model and get the url, and finally use other Java API calls to open that url.
I'm pretty sure you can simply create a string containing
<html>...</html>
and it will work. Just code your link inside the html tags as you would in html. You'll just have to add extra code if you want it to appear blue. I think:
<font color='blue'>
would do it
I know this question has been asked before on S.O. and other websites but I haven't found a definite answer -- most of them say its not easily done but I wanted to make sure that was the final verdict.
Here's my situation:
I'm testing a website that is using Highcharts (http://www.highcharts.com) using Selenium WebDriver (Java).
I basically want to grab the information that is displayed in a small tooltip pop-up that appears when you hover your mouse over each datapoint on the Highchart's line graph.
Looking at the web page's HTML code, I noticed there is <g class="highcharts-tooltip".... I also noticed that, as you move your mouse, the (X,Y) values in ...transform="translate(X,Y)"> change, which then changes the information displayed in the tool tip.
Knowing this, my approach would be to somehow grab all the (X,Y) values and plug them into the transform fields and grab the tooltip data. But I don't know how to programmatically grab all the (X,Y) values through Selenium.
Has anyone tackles this issue in the past or has a better way to grab the necessary information?
I started creating a library to work with HighCharts, what I currently have is available here:
https://github.com/Ardesco/Powder-Monkey/tree/master/src/main/java/com/lazerycode/selenium/graphs
It's quite hard to provide a generic library that deals with HighCharts as the customisation options on the individual charts can modify the SVG markup quite a bit. Hopefully the above will help to a degree.
As I do more it will be updated.
The Line Charts have to have a background to work. If the chart is created with .setBackgroundColour(null), then the "rect" is not added to the html.
I was able to to add the background colour back in set to the body background colour. However I'll try and figure out a way of doing it without the "rect".
Hey i want to create a thumbnail viewer, for my app, i want something similar to this.
I was wondering if there is a pre-existing component that can display thumbnails (FREE), or i was considering to use a JTable, with a custom cell renderer.
What do you think, what would be the best way.
It will be used to display images, keep in mind that i must be able to select individual and multiple files to perform actions on them.
thx in advance.
A JList would probably be better than a JTable. You can use a "horizontal wrap" style. You can always create a custom renderer for the list as well.