Can show pdf in some columns in jtable as link to download? - java

Can I show a PDF in a column of a JTable as link to download!? Is that possible
cause I've searched on Google but can't find anything,
Actually I have table in database named projet(id,nomprojet,date,cout,rapportpdf,pdf). Some projet have a rapport some else no, so i have the project ligne in JTable
Can i have column as link to save rapportpdf on Desktop,

Maybe one approach would be to have the column containing the link to be rendered as a button. See Table Button Column. Then when the user clicks on the button you can display the pdf.
If you want the column to look like a regular hyperlink, then you would need to create a custom renderer so it display like a link and a custom editor to invoke the action when you click on it. MadProgrammer has given you the link to the tutorial which explains renderers and editors in more detail.

Related

How to query jTable from jComboBox?

I have some data in a jTable and want to query a category (Chairs, Desks, etc.) with a drop down box and a search button. I want to have the user select a category, such as Desks, and click the jButton Available Furniture, and be shown a message like: "There are 5 desks. They are Small Office Desk, Large Office Desk, etc." How can I do this?
Here is a picture of the program with the data so you can see what I mean:
jTable with some information and furniture categories
Maybe the easiest way to do this is to just "filter" the table when you do your search by the keyword.
Read the section from the Swing tutorial on Sorting and Filtering for a working example.
You will just need to modify the code to get the search keyword from a combo box instead of a text field.

Show SQLite data in a WebView HTML table

I'm writing an Android app (4.2 and above) to return the details of an item from a location on a warehouse shelf.
The locations are fixed as an id for each cell of a HTML table. For example, the centre location has id="0,0". The HTML table is called from a WebView and will act as the GUI for the app. As such, I have three questions:
How can I get the HTML table to dynamically show the item for the corresponding record from the SQLite database?
How can I show the items on different shelves?
How would I make the cells selectable so that I can see further information about an item?
After a lot of searching, I've found posts on how to do this in Python, PHP and C, but nothing much in the way of doing it using Java/JavaScript.
As this is my first question, please let me know if you require any additional information. Cheers!

How to add button to row of JTable?

I have a Swing based application containing a JTable. Now I would like to allow each row to be updated or deleted, using a unique row ID. So I want to add an update and delete button to each row, which have the capability to support an ActionListener. However, I have no idea how to do this using NetBeans.
To display a button in a column you need to create:
a custom renderer to display the JButton
a custom editor to respond to the mouse click
Read the section from the Swing tutorial on How to Use Tables. The section on:
Using Custom Renders will explain the basics of using a renderer
Using Other Editors will explain the basics of using an editor
Working example are provided in the tutorial that you can download.
You can check out Table Button Column for one approach.
The code uses a single class to implement the custom renderer and editor that you will need for the column to display your text as a button.

Java Swing - PDF Thumbnail Viewer

I'm kinda new in programming and I'm trying to learn everything by myself.
Currently I'm working on a project to sort all my bills and other stuff.
I managed it to updload the bills as PDF files onto a FTP Server.
I'm displaying all outgoing money in a JTable and now I'd like to see a Thumbnail of the PDF
in the right part of my swing GUI after i selected a table row.
Here is what I was thinking of:
Get the selected row via a clickListener, read the bill number, which is the same number the file is called on the FTP (e.g. Number: "20130012" / File: "20130012.pdf").
Download the file from the FTP and save it somewhere temporary?!
and now I need to display the pdf in my grid layout but how =) ? If
it is a picture I could use the Image Icon right? But how do I get
the effect with a pdf?
As soon as I click on the thumbnail, I'd like to open up a pdf reader to see the actual file.
Sorry if this is to less information... just let me know if you need further information.
I'd really appreciate a few answers =)
Thanks
Use a ListSelectionListener to determine which JTable row was clicked and fetch its PDF file. If fetch latency is a problem, use SwingWorker. Once you create a thumbnail image of each page in the selected row's PDF, you can display them in a JList as shown here. Display the selected page at full size in your implementation of ListSelectionListener.

Drop down content in JTable

I want to show all the categories in the database in each line of a JTable i have done that. Now when i click on the each row of JTable i need to show the list of products under it (considered as child of the category) as a drop down not as a drop down list which closes automatically when focus is lost, but it should stay there until i click on minimize icon in the same row. It is just like expanding content. so i can expand all categories individually. The working is similar to JTree but i need it in JTable so that i can show more information on each row in a proper format. Any ideas ?
You need TreeTable functionality. I bet this article will help you.
You will need to have the table model add/remove the subcategory rows when the button on the category is clicked.
You should look at NetBeans Outline. Here's an example that shows how it looks.

Categories

Resources