Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Tableview custom button not responding

  1. #1
    Junior Member
    Join Date
    Oct 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Tableview custom button not responding

    so i havebuilt my interface which is made up of a TableView which is populated from Mysql database. the database has fields as ItemID(int), ItemName(varchar)and Fil(BLOB). my tableView has an additional column called 'action' which has a download button such that when clicked, the file should be downloaded and saved in the user's prefered location. Here's the code
     FileDownloadButton.setOnAction(e -> {
     
                                            Item chosenItem = getTableView().getItems().get(getIndex());
                                            File file = new File(chosenItem.getPaperName());
                                            try {
                                                String filequery = "Select File from items Where" + "itemID" + " = " + chosenItem.getId();
                                                PreparedStatement pst = connection.prepareStatement(filequery);
                                                ResultSet rs = pst.executeQuery();
     
                                                FileOutputStream fileout = new FileOutputStream(file);
                                                while (rs.next()) {
                                                    InputStream fileinput = rs.getBinaryStream("file");
                                                    byte[] buffer = new byte[1024];
                                                    while (fileinput.read(buffer) > 0) {
                                                        fileout.write(buffer);
     
                                                    }
                                                }
    the problem is when i click the download button, nothing happens.
    kindly help.
    thank you

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Tableview custom button not responding

    Please make a small, complete version of the program that compiles and executes to test the problem.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: September 16th, 2014, 01:36 PM
  2. [SOLVED] Getting a calculate button to work, and clear button to reset everything.
    By Ancharius in forum AWT / Java Swing
    Replies: 3
    Last Post: April 3rd, 2014, 05:20 PM
  3. Custom jsp tag does not compile
    By skiabox in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: March 18th, 2012, 12:22 PM
  4. Custom GUI Background help
    By Chillers in forum Object Oriented Programming
    Replies: 0
    Last Post: March 16th, 2012, 11:58 PM
  5. Image not responding to keyboard?
    By uhKenKaniff in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 11th, 2011, 10:54 PM

Tags for this Thread