Home Answers Viewqa Java-Beginners Linking excel file with a application tool using swing

 
 


Abhinav Mishra
Linking excel file with a application tool using swing
2 Answer(s)      a year and 10 months ago
Posted in : Java Beginners

I have to link an excel file with my application software using java swing.As soon as i click on the link button a window should open for selecting the excel file(just like when we search for file to upload)and i should be able to select the excel file and link it with the tool.The excel file will contain some questions for survey.After linking the tool must be able to take those questions and generate a template containing the questions.please help me with the code!

View Answers

July 27, 2011 at 5:10 PM


import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.filechooser.*;

public class SelectFile extends JFrame{
public static void main(String[]args){
                JFrame frame = new JFrame();
                frame.setLayout(null);

                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setSize(400, 100);
                Container container = frame.getContentPane();
                container.setLayout(new GridBagLayout());

                final JTextField text=new JTextField(20);
                JButton b=new JButton("Select");
                text.setBounds(20,20,120,20);
                b.setBounds(150,20,80,20);

                b.setText("<html><font color='blue'><u>Select File</u></font></html>");
                b.setHorizontalAlignment(SwingConstants.LEFT);
                b.setBorderPainted(false);
                b.setOpaque(false);
                b.setBackground(Color.lightGray);
                b.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e){
                            JFileChooser fc = new JFileChooser();
                            fc.addChoosableFileFilter(new OnlyExt());

                            int returnval = fc.showOpenDialog(null);
                            if (returnval == JFileChooser.APPROVE_OPTION) {
                            File file = fc.getSelectedFile();
                            text.setText(file.getPath());
                            } 
                        }
                });
                container.add(text);
                container.add(b);
                frame.setVisible(true);
        }
}
    class OnlyExt extends javax.swing.filechooser.FileFilter{
        public boolean accept(File file) {
    if (file.isDirectory()) return false;
    String name = file.getName().toLowerCase();
    return (name.endsWith(".xls"));
    }
    public String getDescription() { return "Excel ( *.xls)"; }
    }

July 27, 2011 at 5:41 PM


Thanks for the code.But this code is only able to open a Jpanel to select the file.After I select the file nothing is happening.I wanted to be able to generate a template based on the questions that are in the excel file(linking the file).could you please help me with this?









Related Pages:
Linking excel file with a application tool using swing
Linking excel file with a application tool using swing  I have to link an excel file with my application software using java swing.As soon as i click on the link button a window should open for selecting the excel file(just like
Linking an Excel File with the Application tool
Linking an Excel File with the Application tool  I have to link an excel file with a application software which I am developing.I have this code... on the questions that are in the excel file like extracting the questions from the excel file
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am developing.The excel file will contain questionnaire for surveys.I have this code which
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am developing.The excel file will contain questionnaire for surveys.I have this code which
How to link an excel file with the application software using java swing
How to link an excel file with the application software using java swing  I have to link an excel file with a application software which I am developing.The excel file will contain questionnaire for surveys.I have this code which
swing application to import a object in a excel
swing application to import a object in a excel  Hi sir, I want to make a swing application where I can import a object in a cell of a excel... 'create from file' window>browse (this browse path I want to give inside the swing
Import object in Excel using java swing
Import object in Excel using java swing  Hi sir, I want to make a swing application where I can import a object by clicking a button. I am using.... The details of the excel operation which i want to do by one click: in excel its
excel file using JDBC java.?
excel file using JDBC java.?  hey, i am a telecomm. engineer , and i am try to develop a tool which reads from a excel file and then appends the same... used JDBC ODBC to read from excel file. i am not able to append it using
java to excel connectivity - Swing AWT
Excel Driver(*.xls) 5. Select work book or excel file and Create the DSN name (e.g...java to excel connectivity  give me source code to stored the value... database on the excel.  Hi Friend, Follow these steps: 1. Open Data
importing excel file
importing excel file  Hi All I am developing a java application whre we upload a excel file in to database and all excel value should import in to the database column. I am using below logic for inserting value. it shwoing some
connection of java file to excel file and put data from excel file into oracle db
connection of java file to excel file and put data from excel file into oracle db  how to create button on excel sheet using java swing and how we give action to that button excel sheet? how we connect excel file to java file
appfuse tool - Ant
appfuse tool   I have using appfuse frame work tool and developing... develope coding using appfuse tool but i didn't understand UI jsp and mysql... application war file to me. With explaination coding details sir.i have
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
Reading And Writing Excel File
reading and writing excel file   ... the excel sheet  using java . The package we need to import is : java.io.... org.apache.poi.poif.filesystem.POIFileSystem class is used to buffer the excel file into an object. In other
Excel file wriring using java
Excel file wriring using java  i have one predefined bill format in excel i want to append values in it using java apche POI or Jexcel i tried it but it overwrites file and lost previous contents what can i do
Swing Application
Swing Application  hello, i am making swing application in java i am unable to run prog......when my rite clikcing on my project name and clicking... file it is running plzzz reply....   Hi Friend, Post your code
how to use Excel Templet to write excel file using java.
how to use Excel Templet to write excel file using java.  how to use Excel Templet to write excel file using java
Create and Save Excel File in JSP
and saving Excel file from JSP application. In this example we are going to create a new  excel sheet using JSP. Our application consists of two JSP files... Create and Save Excel File in JSP  
how to use Excel Template to write excel file using java
how to use Excel Template to write excel file using java  How to use Excel template to write data in that file using java
how to create an excel file using java
how to create an excel file using java  how to create an excel file using java
Selecting Excel Sheet File
selecting excel sheet file       In this program we are going to select the excel sheet...;%@ page contentType="application/vnd.ms-excel" %> <
Jar file creation - Swing AWT
Jar file creation  i have developed a swing application using Net beans IDE..i am also using 3 rd party JAR files... my application is a serail port.....this wrks fine using IDE 1.Now i want to give the application as a jar file
Reading .doc file using swing
Reading .doc file using swing  Sir, Could U Please Tell me the Way To Read .doc file in java using swing,with code
How to Create New Excel Sheet Using JSP
How to create new excel sheet using jsp  ... a new  excel sheet using java .You can create any number of  new excel sheets in a excel file.  To create a excel sheet we can use third party APIs
Java swing: Export excel sheet data to JTable
Java swing: Export excel sheet data to JTable In this tutorial, you will learn how to read data from excel file and export it to JTable. In swing applications, sometimes, it is required to display the excel file data into the jtable
Insert data in Excel File from Database using JSP
Insert data in Excel File from Database  using JSP ... developed a application to insert data  in excel file from database in JSP. We... the data from database, create an excel file and data insert into newly
connect jdbc to an Excel spreadsheet
to an Excel spreadsheet file using jdbc?   Hello Friend, Follow... Excel Driver(*.xls) Select work book or excel file and Create the DSN name (e.g... of the selected excel file in the query. Thanks
downloading excel file using Java and springs
downloading excel file using Java and springs  I need to find out how to download an excel file using the spring framework in java. Please help me out as I am new to springs and its urgent
Excel - JSP-Servlet
Excel  How to export data from jsp to excel sheet. I am using struts1.2 in my application.  Hi friend, Code to data from Jsp to excel...: "success.jsp" For more information on excel sheet Using JSP visit
Access Excel file through JDBC
Access Excel file through JDBC In this section, you will learn how to access excel file through Jdbc and display records in JTable. As you know Excel comes... and the excel file. Here the name of the worksheet is equivalent to any database
Excel file Handling in Java
that reads the excel file using Apache POI api. import java.io.*; import...Excel file Handling in Java  Hello Sir, I am new to Java, I have Started Java Core by myself. I want to make a project which include 3-4 Excel file
Browse Excel File Problem - Development process
Browse Excel File Problem  I am using a web application,in which i have to browse an excel file columns. It is working in my system. But if i access... the tablenames am using next file. GetxlsFileTable.jsp
generate columns in file using tab delimeter - Swing AWT
generate columns in file using tab delimeter   Hi, I have problem ........i have imported all the files in a directory using JFIleChooser..now the problem is the content in file can be viewed as excel sheet and also can
How to generate reports dynamically using ireports tool in a web application?
How to generate reports dynamically using ireports tool in a web application?  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application?
How to generate reports dynamically using ireports tool in a web application?  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application?
How to generate reports dynamically using ireports tool in a web application?  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application?
How to generate reports dynamically using ireports tool in a web application?  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine
How to generate reports dynamically using ireports tool in a web application
How to generate reports dynamically using ireports tool in a web application  Hi all, As part of my web application , i need to generate reports dynamically using ireport tool.. i have installed the tool and its working fine

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.