JTextArea.getText(); Stops to read att first space

20 Views Asked by At

Does anyone know how to get JTextArea.getText(); to read all the text? It stops in the first space of the line... Here is the part of my code:

  choose.addActionListener(new ActionListener(){
      @Override
      public void actionPerformed(ActionEvent e){
          
FileDialog dialog = new FileDialog((Frame)null, "Select File to Open");
dialog.setMode(FileDialog.LOAD);
dialog.setVisible(true);

String file = dialog.getDirectory()+dialog.getFile();
text.setText(file);
System.out.println(file);
      }
  
  });

 
  
  
  
  
         Send.addActionListener(new ActionListener(){
      @Override
      public void actionPerformed(ActionEvent e){
          
          try {
            String file = text.getText();
                      
         Runtime.getRuntime().exec("cmd /k start cmd.exe /K \"cd C:\\Program Files (x86)\\CAREL\\Sparkly && Sparkly.exe configurations apply --connection Serial,COM8,192008N2,199 --src "+file);
       

          }
        catch (IOException ex) {
              
          }
      }
  
  });
  

         

I need it to either remove the spaces or take all the text WITH spaces. Google did not help me :/

0

There are 0 best solutions below