Save/Load into Jtable

How can I load data and save data from Jtable in a comma delimited format?
And how can I execute a calculation by writing r1c3+r1c2 in a Jtextfield. R1 means row1 c3 means column3. What method or class can I use to locate the data on the JTable and do the calculation.
public class SpreadSheetEditor extends JFrame  implements ActionListener
     JFileChooser chooser = new JFileChooser();
      * This constructs the GUI.  It is not a public method to be called by other
      * classes.
     protected SpreadSheetEditor()
          // Set title bar text and close box functionality on the JFrame
          super("SpreadSheetEditor");
          // Add content pane to JFrame and set to Border Layout
          Container contentPane = this.getContentPane();
          contentPane.setLayout(new BorderLayout(20,20));
          // Add JScrollPane to center of ContentPane and set scroll bar policy
          JScrollPane myScrollPane = new JScrollPane();
          myScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
          myScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
          contentPane.add(myScrollPane, BorderLayout.CENTER);
          // Add JTable to ScrollPane
          JTable myTable = new JTable(20,10);
          TableColumn column = new TableColumn();
          myScrollPane.setViewportView(myTable);
          myTable.setRowHeight(20);
          column.setPreferredWidth(50);
          // Add JPanel to bottom (south) of content pane for buttons
          JPanel myPanel = new JPanel();
          myPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
          contentPane.add(myPanel, BorderLayout.SOUTH);
          // Add TextField
          JTextField textField = new JTextField(20);
          contentPane.add(textField, BorderLayout.SOUTH);
          // Create and add load and save and execute buttons to JPanel
          JButton loadButton = new JButton("Load");
          JButton saveButton = new JButton("Save");
          JButton executeButton = new JButton("Execute");
          myPanel.add(executeButton);
          myPanel.add(loadButton);
          myPanel.add(saveButton);
          // Crerate a JMenu
          JMenu menu = new JMenu("File");
          JMenuItem m;
          m= new JMenuItem("Clear SpreadSheet");
          m.addActionListener(this);
          menu.add(m);
          m= new JMenuItem("Exit Editor");
           m.addActionListener(this);
          menu.add(m);
          JMenuBar mBar = new JMenuBar();
          mBar.add(menu);
          setJMenuBar(mBar);
          // Add action listeners to buttons
          loadButton.addActionListener(this);
          saveButton.addActionListener(this);
           executeButton.addActionListener(this);
          // Set frame size and make visible
          super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          super.setSize(500,500);
          super.setVisible(true);
      * This method calls either loadFile or saveFile in reponse
      * to the buttons being pushed.
      * @param e the event from the button push
     public void actionPerformed(ActionEvent e)
          if (e.getActionCommand().equals("Load"))
               loadFile();
          else if (e.getActionCommand().equals("Save"))
               saveFile();
          else if(e.getActionCommand().equals("Exit Editor"))
               System.exit(1);
     //     else if(e.getActionCommand().equals("Clear SpreadSheet"))
     //          theText.setText("");
      * This pops the file chooser and then calls the loadFile(File) method.
     protected void loadFile()
          int returnVal = chooser.showOpenDialog(this);
          if(returnVal == JFileChooser.APPROVE_OPTION)
               loadFile(chooser.getSelectedFile());
      * This loads the file and displays it in the textArea.
      * @param fileToLoad the file to load in to the text area
     protected void loadFile(File fileToLoad)
          try
               FileReader freader = new FileReader(fileToLoad);
               BufferedReader breader = new BufferedReader(freader);
              String line;
              while ((line = breader.readLine()) != null)
              //     myJTable.append(line + "\n");
              breader.close();
          catch (IOException ioe)
               ioe.printStackTrace();
      * This takes what is in the JTable and saves it to a file.
      * Pops a JChooser to determine the file name.
     protected void saveFile()
          int returnVal = chooser.showSaveDialog(this);
          if(returnVal == JFileChooser.APPROVE_OPTION)
               try
                    FileWriter fwriter = new FileWriter(chooser.getSelectedFile());
                    BufferedWriter bwriter = new BufferedWriter(fwriter);
               //     bwriter.write(myJTable.getText());
                    bwriter.close();
               catch (IOException ioe)
                    ioe.printStackTrace();
      * The main method creates an instance of SpreadSheetEditor.
     public static void main(String[] args)
          SpreadSheetEditor myEditor = new SpreadSheetEditor();
}

First a suggestion, break up your GUI into a couple of classes. It would be perferable if in your constructor you had something more like
super("SpreadSheet Editor");
setJMenuBar(new myOwnMenuBar());
getContentPane.add(new mySpreadsheetPanel());and then the SpreadsheetPanel would be broken up into the JTable, and maybe a panel with some buttons on it if you need them. Just a suggestion, it tends to make the code much easier to debugg and change/add functionality to later.
As for loading a file, you should know the format of the data. I would store it something like
rowcol, data, rowcol, data, rowcol, data
then just read it in and fill it into the table where needed.
You should create your own TableModel which should be a subclass of AbstractTableModel. This will make your life easier. The TabelModel is where the JTable gets/stores all its data, and it is what is used to update the JTable.
As for the calculations here is a class I wrote for doing a similar project. There are a couple of classes used but they are mostly small classes and if you need more explenation on them just let me know.
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
  *@author
  *@version 1.0 3/5/03
  *the ExpressionTree class is used to evaluate and hold a mathmatical expression
public class ExpressionTree{
     SimpleStack numberstack, opstack, cellrefs;
     String originalexpression;
     Token root;
     Graph graph;
       *creates an Expression tree
       *@param expression the expression to be evaluated
       *@param graph a reference to the Graph where cells are stored
       *@throws MalformedCellException thrown if the expression is invalid
     ExpressionTree(String expression, Graph graph)throws MalformedCellException{
          originalexpression      = expression;
          this.graph              = graph;
          StringTokenizer extoken = new StringTokenizer(expression, OperatorToken.OPERATORS, true);
          String[] tokens         = new String[extoken.countTokens()];
          for(int i=0;i<tokens.length;i++){
               tokens=extoken.nextToken();
          buildTree(tokens);
     //creates the tree from the array of tokens each token is a portion of the expression
     private void buildTree(String[] tokens)throws MalformedCellException{
          boolean checkunaryminus = true;
          boolean unaryminus = false;
          numberstack = new SimpleStack(13);
          opstack = new SimpleStack(13);
          cellrefs = new SimpleStack(13);
          for(int i=0;i<tokens.length;i++){
               if(LiteralToken.isLiteral(tokens[i])){
                    if(unaryminus){
                         numberstack.push(new LiteralToken(-1*Double.parseDouble(tokens[i])));
                         opstack.pop();
                         unaryminus = false;
                    }else{
                         numberstack.push(new LiteralToken(Double.parseDouble(tokens[i])));
                    checkunaryminus = false;
               }else if(CellToken.isCell(tokens[i])){
                    Cell tempcell = getCell(tokens[i]);
                    cellrefs.push(tempcell);
                    Token temp = new CellToken(tempcell);
                    if(unaryminus){
                         temp = buildSubTree(new LiteralToken(0), (OperatorToken)opstack.pop(), temp);
                         unaryminus = false;
                    numberstack.push(temp);
                    checkunaryminus = false;
               }else if(OperatorToken.isOperator(tokens[i])){
                    if(unaryminus) throw new MalformedCellException("illegal expression operator after minus");
                    char op = tokens[i].charAt(0);
                    if(checkunaryminus){
                         if(op=='-'){
                              opstack.push(new OperatorToken(op));
                              checkunaryminus = false;
                              unaryminus = true;
                         }else{
                              opstack.push(new OperatorToken(op));
                    }else{
                         if(op=='('){
                              opstack.push(new OperatorToken(op));
                         }else if(op==')'){
                              OperatorToken temp = (OperatorToken)opstack.pop();
                              while(temp.instancePriority() != OperatorToken.getPriority('(')){
                                   if(numberstack.numObjects()<2){
                                        throw new MalformedCellException("Incefficient Numbers");
                                   Token r = (Token)numberstack.pop();
                                   Token l = (Token)numberstack.pop();
                                   numberstack.push(buildSubTree(l, temp, r));
                                   temp = (OperatorToken)opstack.pop();
                         }else{
                              if(!opstack.isEmpty()){
                                   OperatorToken ot = (OperatorToken)opstack.peek();
                                   if(OperatorToken.getPriority(op)<ot.instancePriority()){
                                        if(numberstack.numObjects()<2){
                                             throw new MalformedCellException("Incefficient Numbers");
                                        Token r = (Token)numberstack.pop();
                                        Token l = (Token)numberstack.pop();
                                        numberstack.push(buildSubTree(l, (OperatorToken)opstack.pop(), r));
                              opstack.push(new OperatorToken(op));
                         checkunaryminus = true;
               }else{
                    throw new MalformedCellException("illegal expression Failed all tests");
          while(!opstack.isEmpty()){
               if(numberstack.numObjects()<2){
                    throw new MalformedCellException("Incefficient Numbers");
               Token r = (Token)numberstack.pop();
               Token l = (Token)numberstack.pop();
               numberstack.push(buildSubTree(l, (OperatorToken)opstack.pop(), r));
          root = (Token)numberstack.peek();
     *gets the value of this expression
     *@return String returns the value of this expression in a String
     public String getValue(){
          double temp = root.getValue();
          return String.valueOf(temp);
     *gets the original expression that was parsed
     *@return String the original expression
     public String getEquation(){
          return originalexpression;
     *get the cells that are reference in this expression
     *@return Cell[] array of cells this expression holds
     public Cell[] getReferences(){
          Cell[] returncells = new Cell[cellrefs.numObjects()];
          int index = 0;
          while(!cellrefs.isEmpty()){
               returncells[index++]=(Cell)cellrefs.pop();
          return returncells;
     //builds one three node subtree
     private Token buildSubTree(Token l, OperatorToken ot, Token r){
          ot.setLeftChild(l);
          ot.setRightChild(r);
          return ot;
     //uses buildSubTree to create a tree until more of the expression needs to be parsed
     private Token buildSubTrees(char op)throws MalformedCellException{
          if(op==')'){
               OperatorToken ot = (OperatorToken)opstack.peek();
               while(ot.instancePriority()!=0){
                    if(numberstack.numObjects()<2){
                         throw new MalformedCellException("Incefficient Numbers");
                    Token r = (Token)numberstack.pop();
                    Token l = (Token)numberstack.pop();
                    numberstack.push(buildSubTree(l, (OperatorToken)opstack.pop(), r));
          }else{
               OperatorToken ot = (OperatorToken)opstack.peek();
               while(OperatorToken.getPriority(op)<ot.instancePriority()){
                    if(numberstack.numObjects()<2){
                         throw new MalformedCellException("Incefficient Numbers");
                    Token r = (Token)numberstack.pop();
                    Token l = (Token)numberstack.pop();
                    numberstack.push(buildSubTree(l, (OperatorToken)opstack.pop(), r));
          return (Token)numberstack.peek();
     //gets or creates cell that is referenced in expression
     private Cell getCell(String cellname)throws MalformedCellException{
          int row = 0;
          int col = 0;
          Pattern colpatt = Pattern.compile("[a-zA-Z]+");
          Pattern rowpatt = Pattern.compile("\\d+");
          Matcher m = colpatt.matcher(cellname);
          m.find();
          String columnstring = m.group().toUpperCase();
          m = rowpatt.matcher(cellname);
          m.find();
          String rowstring = m.group();
          row = Integer.parseInt(rowstring);
          row--;
          char[] colchar = columnstring.toCharArray();
          for(int j=colchar.length-1;j>=0;j--){
               col+=colchar[j]-'A'*Math.pow(26, j);
          if(row<0||col<0){
               throw new MalformedCellException("illegal expression");
          Vertex v = graph.doesCellExist(col, row);
          if(v!=null){
               return v.getCell();
          return new Cell(col, row, "0", graph);

Similar Messages

  • Load a redrawn image into a JLabel and save it into a BufferedImage?

    Hello, I'm doing a small application to rotate an image, it works, but I'd like to show it into a JLabel that I added, and also store the converted image into a BufferedImage to save it into a database, this is what I have so far:
    public void getImage() {
    try{
    db_connection connect = new db_connection();
    Connection conn = connect.getConnection();
    Statement stmt = conn.createStatement();
    sql = "SELECT image " +
    "FROM image_upload " +
    "WHERE image_id = 1";
    rset = stmt.executeQuery(sql);
    if(rset.next()){
    img1 = rset.getBinaryStream(1);
    buffImage = ImageIO.read(img1);
    rset.close();
    } catch(Exception e){
    System.out.println(e);
    public void paint(Graphics g){
    super.paint(g);
    Graphics2D g2 = (Graphics2D) g;
    ImageIcon imgIcon = new ImageIcon(buffImage);
    AffineTransform tx = AffineTransform.getRotateInstance(rotacion, imgIcon.getIconWidth()/2, imgIcon.getIconHeight()/2);
    g2.drawImage(imgIcon.getImage(), tx, this);
    jLabel1.setIcon(imgIcon);
    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
    setRotacion(getRotacion() + 1.5707963249999999);
    repaint();
    I get the image from a db, then using the paint() method I rotate the image, it works, but the new image is outside of the JLabel and I don't know how to assign the new one into the JLabel (like overwritting the original) and also how to store the new image into a BufferedImage to upload it into the database converted, thanks in advanced, any help would be appreciated, thanks!!
    Edited by: saman0suke on 25-dic-2011 14:07
    Edited by: saman0suke on 25-dic-2011 15:08

    I was able already to fill the JLabel with the modified content, just by creating a new BufferedImage, then create this one into a Graphics2D object and the drawing the image into it, last part, inserting the modified image into the database, so far, so good, thanks!
    EDIT: Ok, basic functionality is ok, I can rotate the image using AffineTransform class, and I can save it to the database and being displayed into a JLabel, now, there's a problem, the image for this example is 200 width and 184 height, but when I rotate it the width can be 184 and the height 200 depending on the position, but the BufferedImage that I create always read from original saved image:
    bimage = new BufferedImage(buffImage.getWidth(), buffImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
    Is there a way that I can tell BufferedImage new width and height after rotate it? :( as far as I understand this cannot be done because before the image bein rotated the bufferedImage is already created and, even being able to do it how can I get width and height from rotated image? thanks!
    Edited by: saman0suke on 25-dic-2011 19:40

  • A script that captures the coordinates of the mouse clicks and saves them into a file

    Hello,
    I'm trying to create a cartoon taking a movie (I've chosen blade runner) as base. I've got the real movie and I've exported all the pictures using VirtualDUB. Now I have a lot of images to modify. I would like to modify the actors faces with the faces generated by Facegen modeller. I'm thinking how to make the whole process automatic because I have a lot of images to manage. I've chosen to use Automate BPA,because it seems the best for this matter. I'm a newbie,so this is my first attempt using Adobe Photoshop and Automate BPA. I wrote a little script. It takes a face generated with Facegen modeller and tries to put it above the original actors faces. But it doesn't work very good and I'm not really satisfied,because the process is not fully automated. To save some time I need to write a script that captures the coordinates of the mouse when I click over the faces and that saves them into a file,so that Automate BPA can read these coordinates from that file and can put the face generated with Facegen Modeller above the original face. I think that Automate BPA is not good for this matter. I think that two coordinates are enough,X and Y. They can be the coordinates of the nose,because it is always in the middle of every face. It is relevant to knows how big should be the layer of the new face,too. This is the Automate BPA code that I wrote :
    <AMVARIABLE NAME="nome_foto" TYPE="TEXT"></AMVARIABLE>
    <AMVARIABLE NAME="estensione_foto" TYPE="TEXT"></AMVARIABLE>
    <AMSET VARIABLENAME="nome_foto">br</AMSET>
    <AMSET VARIABLENAME="estensione_foto">.jpeg</AMSET>
    <AMVARIABLE NAME="numero_foto" TYPE="NUMBER"></AMVARIABLE>
    <AMVARIABLE NAME="coord_x" TYPE="NUMBER"></AMVARIABLE>
    <AMVARIABLE NAME="coord_y" TYPE="NUMBER"></AMVARIABLE>
    <AMWINDOWMINIMIZE WINDOWTITLE="Aggiungere_layer - AutoMate BPA Agent
    Task Builder" />
    <AMWINDOWMINIMIZE WINDOWTITLE="AutoMate BPA Server Management Console
    - localhost (Administrator)" AM_ONERROR="CONTINUE" />
    <AMENDPROCESS PROCESS="E:\Programmi_\Adobe Photoshop
    CS5\Photoshop.exe" AM_ONERROR="CONTINUE" />
    <AMRUN FILE="%&quot;E:\Programmi_\Adobe Photoshop CS5\Photoshop.exe&quot;%" />
    <AMPAUSE ACTION="waitfor" SCALAR="15" />
    <AMSENDKEY>{CTRL}o</AMSENDKEY>
    <AMPAUSE ACTION="waitfor" SCALAR="1" />
    <AMINPUTBOX RESULTVARIABLE="numero_foto">Inserire numero FOTO di
    partenza -1</AMINPUTBOX>
    <AMINCREMENTVARIABLE RESULTVARIABLE="numero_foto" />
    <AMPAUSE ACTION="waitfor" SCALAR="1" />
    <AMMOUSEMOVEOBJECT WINDOWTITLE="Apri" OBJECTNAME="%nome_foto &amp;
    numero_foto &amp; estensione_foto%" OBJECTCLASS="SysListView32"
    OBJECTTYPE="ListItem" CHECKOBJECTNAME="YES" CHECKOBJECTCLASS="YES"
    CHECKOBJECTTYPE="YES" />
    <AMMOUSECLICK CLICK="double" />
    <AMPAUSE ACTION="waitfor" SCALAR="10" />
    <AMSENDKEY>{CTRL}+</AMSENDKEY>
    <AMPAUSE ACTION="waitfor" SCALAR="20" />
    <AMSENDKEY>l</AMSENDKEY>
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSEMOVE MOVEX="429" MOVEY="281" RELATIVETO="screen" />
    <AMMOUSECLICK />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSEMOVE MOVEX="659" MOVEY="281" RELATIVETO="screen" />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSECLICK />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSEMOVE MOVEX="659" MOVEY="546" RELATIVETO="screen" />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSECLICK />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSEMOVE MOVEX="429" MOVEY="546" RELATIVETO="screen" />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSECLICK />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSEMOVE MOVEX="429" MOVEY="281" RELATIVETO="screen" />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSECLICK />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMSENDKEY>v</AMSENDKEY>
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSECLICK CLICK="hold_down" />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSEMOVE MOVEX="131" MOVEY="99" RELATIVETO="screen" />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSEMOVE MOVEX="99" MOVEY="162" RELATIVETO="screen" />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMMOUSECLICK CLICK="release" />
    <AMPAUSE ACTION="waitfor" SCALAR="2" />
    <AMINPUTBOX RESULTVARIABLE="coord_x">Inserire coordinata X</AMINPUTBOX>
    <AMINPUTBOX RESULTVARIABLE="coord_y">Inserire coordinata Y</AMINPUTBOX>
    <AMMOUSEMOVE MOVEX="200" MOVEY="200" RELATIVETO="screen" />
    <AMMOUSECLICK CLICK="hold_down" />
    <AMMOUSEMOVE MOVEX="%coord_x%" MOVEY="%coord_y%" RELATIVETO="position" />
    <AMMOUSECLICK />
    and this is a short video to explain better what I want to do :
    http://www.flickr.com/photos/26687972@N03/5331705934/
    In the last scene of the video you will see the script asking to input the X and the Y coordinates of the nose. This request is time consuming. For this reason I want to write a script that captures automatically the coordinates of the mouse clicks. The only thing to do should be click over the nose and the script should make the rest. As "c.pfaffenbichler" suggested here : http://forums.adobe.com/thread/775219, I could explore 3 ways :
    1) use the Color Sampler Tool’s input with a conventional Photoshop Script.
    2) use After Effects would provide a better solution.
    3) Photoshop’s Animation Panel might also offer some easier way as it might be possible to load two movies (or one movie and one image) and animate the one with the rendered head in relation to the other.
    Since I'm a totally newbie in graphic and animation,could you help me to explore these ways ? Thanks for your cooperation.

    These are the coordinates of the contours of the face that you see on the picture. Can you explain to me how they are calculated ? The coordinates of the first colums are intuitive,but I'm not able to understand how are calculated the coordinates of the second one.
    Thanks.
    1 COL     2 COL (how are calculated these values ?)
    307.5000 182.0000 m
    312.5000 192.0000 l
    321.5000 194.0000 l
    330.5000 193.0000 l
    335.0000 187.0000 l
    337.0000 180.5000 l
    340.0000 174.0000 l
    338.5000 165.5000 l
    336.0000 159.0000 l
    331.5000 153.0000 l
    324.5000 150.0000 l
    317.0000 154.0000 l
    312.5000 161.0000 l
    309.0000 173.0000 l
    307.5000 182.0000 l
    Message was edited by: LaoMar

  • Cant get data from text file to print into Jtable

    Instead of doing JDBC i am using text file as database. I cant get data from text file to print into JTable when i click find button. Goal is to find a record and print that record only, but for now i am trying to print all the records. Once i get that i will change my code to search desired record and print it. when i click the find button nothing happens. Can you please take a look at my code, dbTest() method. thanks.
    void dbTest() {
    DataInputStream dis = null;
    String dbRecord = null;
    String hold;
    try {
    File f = new File("customer.txt");
    FileInputStream fis = new FileInputStream(f);
    BufferedInputStream bis = new BufferedInputStream(fis);
    dis = new DataInputStream(bis);
    Vector dataVector = new Vector();
    Vector headVector = new Vector(2);
    Vector row = new Vector();
    // read the record of the text database
    while ( (dbRecord = dis.readLine()) != null) {
    StringTokenizer st = new StringTokenizer(dbRecord, ",");
    while (st.hasMoreTokens()) {
    row.addElement(st.nextToken());
    System.out.println("Inside nested loop: " + row);
    System.out.println("inside loop: " + row);
    dataVector.addElement(row);
    System.out.println("outside loop: " + row);
    headVector.addElement("Title");
    headVector.addElement("Type");
    dataTable = new JTable(dataVector, headVector);
    dataTableScrollPane.setViewportView(dataTable);
    } catch (IOException e) {
    // catch io errors from FileInputStream or readLine()
    System.out.println("Uh oh, got an IOException error!" + e.getMessage());
    } finally {
    // if the file opened okay, make sure we close it
    if (dis != null) {
    try {
    dis.close();
    } catch (IOException ioe) {
    } // end if
    } // end finally
    } // end dbTest

    Here's a thread that loads a text file into a JTable:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=315172
    And my reply in this thread shows how you can use a text file as a simple database:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=342380

  • Also problem read txt files into JTable

    hello,
    i used the following method to load a .txt file into JTable
    try{
                        FileInputStream fin = new FileInputStream(filename);
                        InputStreamReader isr = new InputStreamReader(fin);
                        BufferedReader br =  new BufferedReader(isr);
                        StringTokenizer st1 = new StringTokenizer(br.readLine(), "|");
                        while( st1.hasMoreTokens() )
                             columnNames.addElement(st1.nextToken());
                        while ((aLine = br.readLine()) != null)
                             StringTokenizer st2 = new StringTokenizer(aLine, "|");
                             Vector row = new Vector();
                             while(st2.hasMoreTokens())
                                  row.addElement(st2.nextToken());
                             data.addElement( row );
                        br.close();
                        }catch(Exception e){ e.printStackTrace(); }
                   //colNum = st1.countTokens();
                   model = new DefaultTableModel(data,columnNames);
                   table.setModel(model);but there is a problem : if cell A's location is (4,5),and its left neighbour,that is, cell(4,4) is blank (the value is ""), the the cell A's value will be displayed in cell(4,4).if cell(4,3) is also blank ,the cell A's value will be displayed in cell(4,3).that is,the non-blank value will be displayed in the first blank cell of the line.
    how can i solve it?Please give me some helps or links.
    Thank u very much!

    Or, use the String.split(..) method to tokenize the data
    Or, use my SimpleTokenizer class which you can find by using the search function.

  • Scanned Grayscale files not loading into iPhoto

    I have just purchased a new iMac, having not been a Mac User before. I have been importing photos from an external (Windows formatted) hard drive with apparent success. However, on attempting to import some scanned jpegs (Epson Perfection V700 Photo scanner) in 8 bit grayscale, I got the "unrecognised format message". No attempt at saving on the desktop and importing into iPhoto from there worked. I then loaded them into Photoshop Elements 4 on the Mac, and saved again as a standard jpeg, but with no luck. However, by chance I tried saving with the "Embed colour profile: Epson Gray - Gamma 1.8" option unchecked in PE4's "Save as" menu. This time the resulting jpeg file did load into iPhoto. Have you any ideas why the original image did not load and what is the significance of why the "non-embedded" image did. Is there a quick way to convert these images, if necessary, using this method - I have a lot of scanned images like this. Another feature which might confirm what is wrong here is that the in Photoshop Elements, the label at the top of the displayed image shows the jpeg name, then size as a %, and then (Gray/8*). The files which load correctly into iPhoto do not show this "*" in Photoshop.

    Download and run *+Embed sRGB Profile 2+* on the grayscale photos by dropping the image files onto the Automator workflow application. You can get it from Toad's Cellar.
    This will let you avoid having to rescan those files as RGB color.

  • Can user-defined styles load into new documents automatically?

    Greetings.
    I created a new style for a document. Is there any way to have that style automatically load into every new document I create by default? Or is the only option to import it every time I create a new document? I sure hope you can do the former!
    Thanks in advance,
    DPL

    David Letwin wrote:
    Greetings.
    I created a new style for a document. Is there any way to have that style automatically load into every new document I create by default? Or is the only option to import it every time I create a new document? I sure hope you can do the former!
    Create a new document from the template which you want to use as starting point.
    Import the style from your other doc into the newly created one.
    Save the new doc as a template.
    Use this new template to create your doicuments.
    Yvan KOENIG (VALLAURIS, France) samedi 2 avril 2011 18:15:09

  • Multiple clips load into iPhoto

    Shooting an event I need to stop occasionally; as a result I get multiple clips that have to be looked at individually.
    ) Is there a way of pausing a shoot so that I get one continuous strip?
    2)Since Vado loads into iPhoto rather than iMovie, whats the easiest way to get the clips into iMovie for editing and eventually burning a disc?
    TIA
    apbdmd

    Lots of luck, Creative does not let you burn to DVD.
    The only choices in their software after loading are upload to the internet.
    (maybe we don't want to upload just one clip)
    Maybe we want to save our vacation, etc. videos and DVD them to give to relati'ves.
    Forget aboutit!
    Because even if you can somehow figure out how to drag clips to another editing program. The finished
    video will NOT burn to DVD.

  • I cant transfer my songs from old iphone to new iphone wont load into library

    I cant transfer my songs from my iphone 3gs to my new 4s they wont load into the library ive tried everything and im stumped

    All your media should be in your library. If for some reason this is not the case you should be able to:
    Backup the device to the new installation
    Transfer your purchases into a newly authorized library
    Recover any other media using third party tools as suggested in this post from forum regular Zevoneer
    Restore the new device from the old backup
    This process should switch set up your new device with the data and settings in your apps, assuming that is waht you wanted to achieve.
    Might be prudent to attempt a backup to iCloud directly from the device before you start... Settings > iCloud > Storage & Backup > iCloud Backup > On. It won't save any media but it would preserve the general account settings and documents in case anything goes wrong while you are trying to extract your other data.
    When you get it all sorted, make a backup!
    tt2

  • BIA Index Loading into Mmeory (for SAP) ....

    Hello all,
    I went to www.sdn.sap.com and chose <b>Business Intelligence</b> from the left menu.
    In the <b>BI Knowledge Center</b> (Right side), I chose <b>BI Accelerator</b>, which is under <b>Key Topics</b> section.
    Then I opened a document "<b>SAP Business Intelligence Accelerator (PDF 154 KB)</b>".
    Go to the section "<b>SAP BI Accelerator at Work</b>", which is at page# 5. The third point says like this -
    BI accelerator indexes are loaded into memory where the query is processed. In memory, joins and aggregations are done at run time. Loading of indexes into memory happens automatically at first query request, or it can be set for <b>preloading</b> whenever new data is loaded.
    I had an understanding that it will be loaded into memory only when query was first executed. But this says it can be set for preloading as well wherever new data loaded.
    My question is that where this setting can be done for preloading?
    It says that preloading option is available whenever new data loaded so does that mean that it can only be set for rollup of BIA Index and for initial load, it will still load data into memory when the query is first executed.
    I would appreciate if somebody has knowledge of this as it is new technology.
    Others, who has a knowledge can also answer.
    Your help will be greatly appreciated.
    Thank you to everybody in advance.
    Sume

    Hi,
    I found it.
    It is an option on BIA Index Property button in the wizard. It appears only after the initial load is done. There is check box for to keep the BIA Index in main store. I thin it is only applicable to Roll-up.
    Thank you.
    Sume

  • .gif files will not load into site

    I posted a question earlier about pages not loading and the question was answered, but now my .gif files will not load. Below is the log:
    Started: 4/9/2012 2:41 PM
    imageshomepage\Announce35.gif - error occurred - An FTP error occurred - cannot put Announce35.gif.  Access denied.  The file may not exist, or there could be a permission problem.
    File activity incomplete. 1 file(s) or folder(s) were not completed.
    Files with errors: 1
    imageshomepage\Announce35.gif
    Finished: 4/9/2012 2:41 PM
    I have them loading into the images folder that is in the htdocs folder.
    I stated in my previous question that I am self taught via the adobe DW tutorial. I had a catastrophic computer crash and had to reload everything. I apparently did not tell DW which file to load into before and now that is fixed. Any help would be greatly appreciated.
    Thanks

    I was never a big fan of using DW to FTP. There are several FTP programs that you might find work better than DW. For example Filezilla, free and works pretty darn well.
    http://filezilla-project.org/
    For me, being able to graphically see my local site on one half my screen and the site as it sits on the server on the other half of the screen really helps me quickly spot problems if I upload something and it doesn't display.
    Anyway... DW is not the only option for loading files to your server.
    Best wishes,
    Adninjastrator

  • Hi am trying to save Data into a write to measurement file vi using a NI PXI 1042Q with a real time mode but it is not working but when i run it with uploading it into the PXI it save in to the file

    Hi am trying to save Data into a write to measurement file vi using a NI PXI 1042Q and DAQ NI PXI-6229 with a real time mode but it is not working but when i run it without uploading it into the PXI it save in to the file please find attached my vi
    Attachments:
    PWMs.vi ‏130 KB

     other problem is that the channel DAQmx only works at real time mode not on stand alone vi using Labview 8.2 and Real time 8.2

  • Qosmio F - Unable to load into Windows or anything

    Yesterday, while studying other day outside another student bumped the table I was studying on. I would say "tapped" as it was not that hard. The normal message appears where it says the laptop will move the harddrive to a safe location etc.
    Shortly after maybe 10-20mins, I get a message on the laptop screen asking me to "backup the laptop" as there was some major error or failure. I clicked on the "additional information" and it basically said all my drives C:, G: and whatever I had disk failure or something. Unable to backup the laptop as I did not have CD's present to back it up with I took it home to do i today.
    The laptop is refusing to even load into windows at the moment. Unable to back up or anything. Keeps loading into options about system repair, restore, memory diagnostics etc. nothing fixes it.
    I've only purchased the laptop since oct/nov of 2010. Didnt start using it till jan/feb of this year also. Should I attempt to open up the HDD as it might have loosen out at the back or? Should I send it back to manufacturer to look at? It's critical exam time for me and this is devastating! Also flying overseas late June after exams and wishing to take the laptop over there. Please help! Thanks advance for all advice and suggestions.

    Hi Kyo,
    Your posting is a little bit hard to understand and a screenshot of this error message would be useful but if you get an message about defective HDD and all partitions you should contact an authorized service provider in your country.
    Your notebook should be still under warranty so the guys can replace the HDD for free. If you need some important data you can ask if they can rescue some files and do a backup. Alternative you can try it yourself if you buy an external HDD case for example. Then you can connect the HDD via USB to another computer.

  • How can I reference the main timeline on a swf once it was loaded into another?

    I have an swf with some custon animation functions using actionscript 3. I'm refering to the main timeline with Movieclip(root) and it works just fine.
    However, this swf is going to be loaded inside another (a custom player), and when that happends, everything stops working.
    I think it's because the Movieclip(root) is now referencing to the loader swf and not the loaded anymore, but I just can't find any information on how to fix that.

    This is basically what I´m doing here:
    I'm placing this code on frame 1, and calling the function textAnimate() whenever I need to insert some text.
    // This is a variable I created for tracking the timeline
    var base:MovieClip = MovieClip(root);
    function textAnimate(movieName:String, espera:Number):void {
              //var espera:Number = 1; //Waiting time
              var objeto:MovieClip = base[movieName]; //Variable to select the object
              var posFinal:Number = objeto.x; // Object position
              var posEnter:String = "-160"; // Animation start (relative)
              var posExit:String = "+160"; // Animation end (relative)
              // enter animation
              TweenMax.from(objeto, 1, {x:posEnter, alpha:0, blurFilter:{blurX:40}, ease:Back.easeOut});
              //call exitAnimation() after X seconds
              TweenMax.delayedCall(espera,exitAnimation);
              //exit animation
              function exitAnimation() {
                        TweenMax.to(objeto, 1, {x:posExit, alpha:0, blurFilter:{blurX:40}, ease:Back.easeIn});
    The swf works fine, but once it´s loaded into the player, nothing works anymore. Unfortunately, I don't have the code for the player, and can't change anything about it... :/

  • How to download a file from the net and save it into .txt format in a datab

    Can some one show me a tutorial on how to download a file from the net and save it into .txt format in a database?
    Thank you,

    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

Maybe you are looking for

  • Error:  "Could not complete your request because of a program error" (photoshop CS2 9.0.2 on MAC OSX

    Today I started my program (photoshop CS2 9.0.2) and opened a JPG file. When I went to print the file the program crashed and closed. When I restarted the program and went to open the file I got this error message, "Could not complete your request be

  • How do I import collections and previous editing into a new copy of Lightroom 5?

    I've recently installed Lightroom 5 on a new computer.  I chose not to install my old Lightroom 3.6 on the new computer, but imported the catalog and photo folders from external drives into Lightroom.  My collections and editing did not appear to hav

  • TDS Certificate no not generated

    Hi gurus, I have created no. group in J1INCERT and put no group as 12 Then assign no range '02' to no group  '12'through J1INCTNO. Then go to maintain no range.Then i click at group and then intervals. But we have observed that when we run J1incert ,

  • Accruals  in account determination

    Hi everybody, My requirement is to have a Price Condition Type (CT) hit an accruals account. I checked the Accruals box in the CT config. Then I defined a new key and tried different combinations in account determination, pricing procedure (PP) and a

  • Trying to install Apex 4.1 so i found apex 3.2 working

    Dears, I have database 11.2 and apex 3.2 installed after running apexins.sqll to install apex 4.1 and follow the steps to install apex 4.1 then when I'm trying to start working with apex 4.1 i found apex 3.2 not apex 4.1, so I don't know what's wrong