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 22 of 22

Thread: Display in a text area

  1. #1
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Display in a text area

    Hi all, I am new in this forum and this is my first post: I am a Java beginner and I hope to have some help from you.

    I my main class (SplitJFrame) I have a GUI with a text area: in another class (FileImport) I have a method to read a txt file, put it in an array and print the array.

    public void importToArray(){
            int rows = 0;
            bin = new String[numberOfLines()][6];
            try {
                 FileReader fr = new FileReader(fileToImport);
                 BufferedReader br = new BufferedReader(fr);
                 String line = null;
     
            while((line = br.readLine())!= null){
                     StringTokenizer stk = new StringTokenizer(line, ",");
                     while(stk.hasMoreTokens()){
                         for (int cls = 0;cls<6; cls++){
                             bin[rows][cls]= stk.nextToken();
                         }
                         rows++;
                     }//end inner while loop
                 }//end outer while loop
                 br.close();
            }//end try
            catch(Exception e){
                System.out.println(e);
            }
        }

    public void printArray(){
            for(int i =0;i<bin.length; i++){
                System.out.printf("%s ", i);
                for(int j =0;j<bin[i].length; j++){
                    System.out.printf("%s ", bin[i][j]);
                }
                System.out.println("");
            }//end for loop
        }

    Plus another simple method that return the array

    public String[][] getArray(){
            return bin;
        }

    I would like to display in text area first 3 and last 3 rows of txt file stored in array named bin.

    How can I do this?

    Thanks!

    Susanna


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    Hey Susanna, welcome to the forums

    Can you please show me an example .txt file for the import?
    It may also be worth posting all of your code so I can compile it. Thanks
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Display in a text area

    Hi JavaPF, thanks for your kind reply!

    This is an example of text file

    20100401,6189.38,6238.57,6186.59,6235.56,29546500
    20100405,6235.56,6235.56,6235.56,6235.56,0
    20100406,6250.01,6265.32,6214.18,6252.21,29445700
    20100407,6248.37,6256.4,6208.52,6222.41,28689600
    20100408,6199.94,6207.14,6138.02,6171.83,30684300
    20100409,6226.26,6254.49,6216.6,6249.7,30543800
    20100412,6283.81,6285.03,6223.78,6250.69,24311600
    20100413,6236.28,6251.46,6199.71,6230.83,28970000
    This is my main class

    package mySplitProva;
     
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    import java.io.File;
    import javax.swing.JFileChooser;
    import javax.swing.filechooser.FileFilter;
    import java.io.*;
     
     
    public class SplitJFrame extends javax.swing.JFrame {
     
       /** Creates new form SplitJFrame */
        public SplitJFrame() {
     
            initComponents();
            jSplitPane1.setOneTouchExpandable(true);
        }
     
     @SuppressWarnings("unchecked")
    private void jFileReaderActionPerformed(java.awt.event.ActionEvent evt) {                                            
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setFileFilter(new TxtFileFilter());
        int returnVal = fileChooser.showOpenDialog(this);
        if(returnVal == JFileChooser.APPROVE_OPTION){
     
            File myFile = fileChooser.getSelectedFile();
            FileImport obj1 = new FileImport(myFile);
            jTotalRowsTextField.setText(String.valueOf(obj1.numberOfLines()));
            System.out.println(obj1.checkIsFile());
            System.out.println(obj1.numberOfLines());
     
          obj1.importToArray();
          obj1.printArray();
     
          System.out.println("--------------------------------------");
     
          obj1.buildDataArray(obj1.getArray());
          obj1.printDataArray();
     }                                           
        }
    private class TxtFileFilter extends FileFilter{
            public boolean accept(File file){
                if(file.isDirectory()) return true;
                String fname = file.getName();
                return fname.endsWith("txt");
            }
            public String getDescription(){
            return "txt file";
        }
        }
     
            public static void main(String args[]) {
            try{
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            }
            catch(UnsupportedLookAndFeelException e){
                //handle exception
            }
            catch(ClassNotFoundException e){
                //handle exception
            }
            catch(InstantiationException e){
                //handle exception
            }
            catch(IllegalAccessException e){
                //handle exception
            }
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new SplitJFrame().setVisible(true);
                }
            });
        }
     
        // Variables declaration - do not modify                     
        private javax.swing.JRadioButton jBarsRadioButton;
        private javax.swing.JRadioButton jCandlestickRadioButton;
        private javax.swing.JLabel jCheckLabel;
        private javax.swing.JComboBox jClose;
        private javax.swing.JPanel jColumnDelimiter;
        private javax.swing.ButtonGroup jColumnsDelimButtonGroup;
        private javax.swing.JComboBox jComboDateFormat;
        private javax.swing.JRadioButton jCommaRadioButton;
        private javax.swing.JPanel jCycleAnalysisPanel;
        private javax.swing.JPanel jDataFormat;
        private javax.swing.JCheckBox jDataInterpCheckBox;
        private javax.swing.JPanel jDataManager;
        private javax.swing.JPanel jDataOutputPanel;
        private javax.swing.JPanel jDataPreview;
        private javax.swing.JTextArea jDataPreviewTextArea;
        private javax.swing.JPanel jDataRangePanel;
        private javax.swing.JComboBox jDate;
        private javax.swing.JPanel jDateFormat;
        private javax.swing.JLabel jDateLabel;
        private javax.swing.JMenu jEdit;
        private javax.swing.JTextField jEndRowField;
        private javax.swing.JLabel jEndRowLabel;
        private javax.swing.JMenu jFile;
        private javax.swing.JButton jFileReader;
        private javax.swing.JPanel jGraphPlot;
        private javax.swing.JRadioButton jHeikinRadioButton;
        private javax.swing.JComboBox jHigh;
        private javax.swing.JRadioButton jLineRadioButton;
        private javax.swing.JComboBox jLow;
        private javax.swing.JSeparator jLowerDataManSeparator;
        private javax.swing.JMenuBar jMainMenuBar;
        private javax.swing.JSeparator jMiddleDataManSeparator;
        private javax.swing.JComboBox jOpen;
        private javax.swing.JComboBox jOther;
        private javax.swing.ButtonGroup jPlotButtonGroup;
        private javax.swing.JButton jPlotDataButton;
        private javax.swing.JPanel jPlotPanel;
        private javax.swing.JComboBox jPlotSelectComboBox;
        private javax.swing.JTextField jRowsBackField;
        private javax.swing.JLabel jRowsBackLabel;
        private javax.swing.JScrollPane jScrollDataPreview;
        private javax.swing.JScrollPane jScrollWarnings;
        private javax.swing.JRadioButton jSemiColonRadioButton;
        private javax.swing.JSeparator jSeparator3;
        private javax.swing.JRadioButton jSpaceRadioButton;
        private javax.swing.JSplitPane jSplitPane1;
        private javax.swing.JTextField jStartRowField;
        private javax.swing.JLabel jStartRowLabel;
        private javax.swing.JRadioButton jTabRadioButton;
        private javax.swing.JToolBar jToolBar;
        private javax.swing.JSeparator jTopSeparator;
        private javax.swing.JLabel jTotalRowsLabel;
        private javax.swing.JTextField jTotalRowsTextField;
        private javax.swing.JButton jVerify;
        private javax.swing.JComboBox jVolume;
        private javax.swing.JPanel jWarningsPanel;
        private javax.swing.JTextArea jWarningsTextArea;
        // End of variables declaration                   
     
    }

    And this is the class with methods

    package mySplitProva;
     
    import java.io.*;
    //import java.util.StringTokenizer;
    import java.util.*;
    import java.text.SimpleDateFormat;
     
    public class FileImport {
     
        private File fileToImport;
        private Date[] dateArray;
        private double[][] dataArray;
     
     
        public FileImport(File myFile) {
           fileToImport = myFile;
           dateArray = new Date[numberOfLines()];//Array for date(calendar)
           dataArray = new double[numberOfLines()][6];//Array for double data
    }//constructor for fileToImport field
     
        int lines = 0;
        String[][]bin;
     
        public boolean checkIsFile(){
            return fileToImport.isFile();
        }
     
        public int numberOfLines(){
            lines = 0;
            if(checkIsFile()){
                try{
                    FileReader fr = new FileReader(fileToImport);
                    BufferedReader br = new BufferedReader(fr);
                    while((br.readLine()!=null)){
                        lines++;
                    }//end while loop
                    br.close();
            }catch(Exception e){
                    System.out.println(e);
                }
            }
              else{
                   System.out.println("There is no file to import");
                    }
            return lines;
            }//returns number of lines in a txt file
     
        public void importToArray(){
            int rows = 0;
            bin = new String[numberOfLines()][6];
            try {
                 FileReader fr = new FileReader(fileToImport);
                 BufferedReader br = new BufferedReader(fr);
                 String line = null;
     
            while((line = br.readLine())!= null){
                     StringTokenizer stk = new StringTokenizer(line, ",");
                     while(stk.hasMoreTokens()){
                         for (int cls = 0;cls<6; cls++){
                             bin[rows][cls]= stk.nextToken();
                         }
                         rows++;
                     }//end inner while loop
                 }//end outer while loop
                 br.close();
            }//end try
            catch(Exception e){
                System.out.println(e);
            }
        }//import data to bin array
     
        public void printArray(){
            for(int i =0;i<bin.length; i++){
                System.out.printf("%s ", i);
                for(int j =0;j<bin[i].length; j++){
                    System.out.printf("%s ", bin[i][j]);
                }
                System.out.println("");
            }//end for loop
        }//print contents of bin array
     
        public String[][] getArray(){
            return bin;
        }//return bin array
     
     
     
        public void buildDateArray(String[][]d) {
     
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");//set date format here;
     
           for(int i=0;i<d.length; i++){
               for(int j = 0;j<d[i].length; j++){
                   if(j==0){
                       try{
                           Date newDate = (Date)sdf.parse(d[i][0]);//parse first column to Date
                           dateArray[i] = newDate;
     
                       }//end try
                   catch(Exception e){
                           System.out.println(e);
                       }//end catch
               }
           }
       }//end for loops
        }
     
        public void buildDataArray(String[][]d){
           for(int i=0;i<d.length;i++){
               for(int j=0;j<d[i].length; j++){
                   switch(j){
                       case 0:
                           dataArray[i][j]=0;
                           break;
                      case 1:
                           dataArray[i][j]=new Double(d[i][j]);
                           break;
                      case 2:
                           dataArray[i][j]=new Double(d[i][j]);
                           break;
                      case 3:
                           dataArray[i][j]=new Double(d[i][j]);
                           break;
                      case 4:
                           dataArray[i][j]=new Double(d[i][j]);
                           break;
                      case 5:
                           dataArray[i][j]=new Double(d[i][j]);
                           break;
                     }//end switch
               }
           }//end for loops
       }
     
         public void printDataArray(){
           for(int i=0;i<dataArray.length;i++){
               for(int j=0;j<dataArray[i].length;j++){
                   System.out.printf("%s ", dataArray[i][j]);
               }
               System.out.println("");
           }
       }
     
         public void printDateArray(){
           for(int i=0;i<dateArray.length;i++){
               System.out.println(dateArray[i]);
           }
       }
    }

    Thank you very much!

    Susanna

    PS txt file length may have different rows number

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    Thanks for the updated information.

    So currently, what doesn't work about the code? Is it just storing the information in an array and then printing it?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  5. #5
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Display in a text area

    Quote Originally Posted by JavaPF View Post
    Thanks for the updated information.

    So currently, what doesn't work about the code? Is it just storing the information in an array and then printing it?
    Yes correct. Now these methods let me store txt file in an array I called bin and print it.

    I would like to have first 3 and last 3 rows of this array displayed in a text area in main class, with a System.out.print ("----------") in between.

    Thanks!

    Susanna

  6. #6
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    I'm unable to compile the code correctly.

    I'm having issues with initComponents(); and Date newDate = sdf.parse(d[i][0]);

    Even with these commented out, It still won't compile correctly.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  7. #7
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Display in a text area

    Maybe it is because I didn't copy greyed generated code area.

    Here is the full code with expanded GUI generated code

    package mySplitProva;
     
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    import java.io.File;
    import javax.swing.JFileChooser;
    import javax.swing.filechooser.FileFilter;
    import java.io.*;
     
     
    public class SplitJFrame extends javax.swing.JFrame {
     
       /** Creates new form SplitJFrame */
        public SplitJFrame() {
     
            initComponents();
            jSplitPane1.setOneTouchExpandable(true);
        }
     
     @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
     
            jColumnsDelimButtonGroup = new javax.swing.ButtonGroup();
            jPlotButtonGroup = new javax.swing.ButtonGroup();
            jSplitPane1 = new javax.swing.JSplitPane();
            jDataManager = new javax.swing.JPanel();
            jDataFormat = new javax.swing.JPanel();
            jDate = new javax.swing.JComboBox();
            jOpen = new javax.swing.JComboBox();
            jHigh = new javax.swing.JComboBox();
            jLow = new javax.swing.JComboBox();
            jClose = new javax.swing.JComboBox();
            jVolume = new javax.swing.JComboBox();
            jOther = new javax.swing.JComboBox();
            jColumnDelimiter = new javax.swing.JPanel();
            jCommaRadioButton = new javax.swing.JRadioButton();
            jSemiColonRadioButton = new javax.swing.JRadioButton();
            jTabRadioButton = new javax.swing.JRadioButton();
            jSpaceRadioButton = new javax.swing.JRadioButton();
            jDateFormat = new javax.swing.JPanel();
            jComboDateFormat = new javax.swing.JComboBox();
            jDateLabel = new javax.swing.JLabel();
            jDataPreview = new javax.swing.JPanel();
            jScrollDataPreview = new javax.swing.JScrollPane();
            jDataPreviewTextArea = new javax.swing.JTextArea();
            jFileReader = new javax.swing.JButton();
            jVerify = new javax.swing.JButton();
            jWarningsPanel = new javax.swing.JPanel();
            jScrollWarnings = new javax.swing.JScrollPane();
            jWarningsTextArea = new javax.swing.JTextArea();
            jCheckLabel = new javax.swing.JLabel();
            jDataInterpCheckBox = new javax.swing.JCheckBox();
            jMiddleDataManSeparator = new javax.swing.JSeparator();
            jDataOutputPanel = new javax.swing.JPanel();
            jDataRangePanel = new javax.swing.JPanel();
            jEndRowField = new javax.swing.JTextField();
            jRowsBackField = new javax.swing.JTextField();
            jStartRowField = new javax.swing.JTextField();
            jStartRowLabel = new javax.swing.JLabel();
            jEndRowLabel = new javax.swing.JLabel();
            jRowsBackLabel = new javax.swing.JLabel();
            jTotalRowsTextField = new javax.swing.JTextField();
            jTotalRowsLabel = new javax.swing.JLabel();
            jPlotPanel = new javax.swing.JPanel();
            jHeikinRadioButton = new javax.swing.JRadioButton();
            jLineRadioButton = new javax.swing.JRadioButton();
            jBarsRadioButton = new javax.swing.JRadioButton();
            jCandlestickRadioButton = new javax.swing.JRadioButton();
            jPlotSelectComboBox = new javax.swing.JComboBox();
            jPlotDataButton = new javax.swing.JButton();
            jCycleAnalysisPanel = new javax.swing.JPanel();
            jLowerDataManSeparator = new javax.swing.JSeparator();
            jGraphPlot = new javax.swing.JPanel();
            jTopSeparator = new javax.swing.JSeparator();
            jToolBar = new javax.swing.JToolBar();
            jSeparator3 = new javax.swing.JSeparator();
            jMainMenuBar = new javax.swing.JMenuBar();
            jFile = new javax.swing.JMenu();
            jEdit = new javax.swing.JMenu();
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setBounds(new java.awt.Rectangle(1200, 850, 0, 0));
            setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
     
            jSplitPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
            jSplitPane1.setDividerLocation(550);
            jSplitPane1.setDividerSize(6);
            jSplitPane1.setToolTipText("Click the left-right arrows to collapse or full screen magnify left pane");
            jSplitPane1.setLastDividerLocation(545);
            jSplitPane1.setPreferredSize(new java.awt.Dimension(1300, 850));
     
            jDataManager.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Data Manager", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
            jDataManager.setPreferredSize(new java.awt.Dimension(545, 846));
     
            jDataFormat.setBorder(javax.swing.BorderFactory.createTitledBorder("Set Data Format"));
            jDataFormat.setToolTipText("Set proper file data format: select skip will ignore current column");
            jDataFormat.setPreferredSize(new java.awt.Dimension(530, 61));
     
            jDate.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Date", "Open", "High", "Low", "Close", "Volume", "Open Int", "Skip" }));
     
            jOpen.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Open", "High", "Low", "Close", "Volume", "Open Int", "Skip", "Date" }));
     
            jHigh.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "High", "Low", "Close", "Volume", "Open Int", "Skip", "Date", "Open" }));
     
            jLow.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Low", "Close", "Volume", "Open Int", "Skip", "Date", "Open", "High" }));
     
            jClose.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Close", "Volume", "Open Int", "Skip", "Date", "Open", "High", "Low" }));
     
            jVolume.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Volume", "Open Int", "Skip", "Date", "Open", "High", "Low", "Close" }));
     
            jOther.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Skip", "Open Int", "Date", "Open", "High", "Low", "Close", "Volume" }));
     
            javax.swing.GroupLayout jDataFormatLayout = new javax.swing.GroupLayout(jDataFormat);
            jDataFormat.setLayout(jDataFormatLayout);
            jDataFormatLayout.setHorizontalGroup(
                jDataFormatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDataFormatLayout.createSequentialGroup()
                    .addComponent(jDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jOpen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jHigh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jClose, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jVolume, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jOther, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
            jDataFormatLayout.setVerticalGroup(
                jDataFormatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDataFormatLayout.createSequentialGroup()
                    .addGroup(jDataFormatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jOpen, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jHigh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jClose, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jVolume, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jOther, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
     
            jDataFormatLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jClose, jDate, jHigh, jLow, jOther, jVolume});
     
            jColumnDelimiter.setBorder(javax.swing.BorderFactory.createTitledBorder("Columns Delimiter"));
            jColumnDelimiter.setToolTipText("Select file columns delimiter");
     
            jColumnsDelimButtonGroup.add(jCommaRadioButton);
            jCommaRadioButton.setText("Comma");
     
            jColumnsDelimButtonGroup.add(jSemiColonRadioButton);
            jSemiColonRadioButton.setText("Semi Colon");
     
            jColumnsDelimButtonGroup.add(jTabRadioButton);
            jTabRadioButton.setText("Tab");
     
            jColumnsDelimButtonGroup.add(jSpaceRadioButton);
            jSpaceRadioButton.setText("Space");
     
            javax.swing.GroupLayout jColumnDelimiterLayout = new javax.swing.GroupLayout(jColumnDelimiter);
            jColumnDelimiter.setLayout(jColumnDelimiterLayout);
            jColumnDelimiterLayout.setHorizontalGroup(
                jColumnDelimiterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jColumnDelimiterLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jCommaRadioButton)
                    .addGap(18, 18, 18)
                    .addComponent(jSemiColonRadioButton)
                    .addGap(18, 18, 18)
                    .addComponent(jTabRadioButton)
                    .addGap(18, 18, 18)
                    .addComponent(jSpaceRadioButton)
                    .addContainerGap(14, Short.MAX_VALUE))
            );
            jColumnDelimiterLayout.setVerticalGroup(
                jColumnDelimiterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jColumnDelimiterLayout.createSequentialGroup()
                    .addGroup(jColumnDelimiterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jCommaRadioButton)
                        .addComponent(jSemiColonRadioButton)
                        .addComponent(jTabRadioButton)
                        .addComponent(jSpaceRadioButton))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
     
            jDateFormat.setBorder(javax.swing.BorderFactory.createTitledBorder("Date Format"));
            jDateFormat.setToolTipText("Select file date format");
     
            jComboDateFormat.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "yyyyMMdd", "yyyyMM", "MMyyyy", "ddMMyyyy" }));
     
            jDateLabel.setText("Date");
     
            javax.swing.GroupLayout jDateFormatLayout = new javax.swing.GroupLayout(jDateFormat);
            jDateFormat.setLayout(jDateFormatLayout);
            jDateFormatLayout.setHorizontalGroup(
                jDateFormatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDateFormatLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jDateLabel)
                    .addGap(18, 18, 18)
                    .addComponent(jComboDateFormat, 0, 117, Short.MAX_VALUE)
                    .addContainerGap())
            );
            jDateFormatLayout.setVerticalGroup(
                jDateFormatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDateFormatLayout.createSequentialGroup()
                    .addGroup(jDateFormatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jComboDateFormat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jDateLabel))
                    .addContainerGap(10, Short.MAX_VALUE))
            );
     
            jDataPreview.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Preview"));
            jDataPreview.setPreferredSize(new java.awt.Dimension(280, 110));
     
            jDataPreviewTextArea.setColumns(20);
            jDataPreviewTextArea.setRows(5);
            jDataPreviewTextArea.setToolTipText("Display first and last rows in file");
            jScrollDataPreview.setViewportView(jDataPreviewTextArea);
     
            javax.swing.GroupLayout jDataPreviewLayout = new javax.swing.GroupLayout(jDataPreview);
            jDataPreview.setLayout(jDataPreviewLayout);
            jDataPreviewLayout.setHorizontalGroup(
                jDataPreviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollDataPreview, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
            );
            jDataPreviewLayout.setVerticalGroup(
                jDataPreviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDataPreviewLayout.createSequentialGroup()
                    .addComponent(jScrollDataPreview, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
     
            jFileReader.setText("File Import");
            jFileReader.setToolTipText("Click to select file to import");
            jFileReader.setPreferredSize(new java.awt.Dimension(83, 20));
            jFileReader.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jFileReaderActionPerformed(evt);
                }
            });
     
            jVerify.setText("Verify");
            jVerify.setToolTipText("Verify if file contains invalid or missing data");
     
            jWarningsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Warnings"));
            jWarningsPanel.setPreferredSize(new java.awt.Dimension(280, 110));
     
            jWarningsTextArea.setColumns(20);
            jWarningsTextArea.setRows(5);
            jWarningsTextArea.setToolTipText("Display warnings for missing or invalid data if found");
            jScrollWarnings.setViewportView(jWarningsTextArea);
     
            javax.swing.GroupLayout jWarningsPanelLayout = new javax.swing.GroupLayout(jWarningsPanel);
            jWarningsPanel.setLayout(jWarningsPanelLayout);
            jWarningsPanelLayout.setHorizontalGroup(
                jWarningsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollWarnings, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
            );
            jWarningsPanelLayout.setVerticalGroup(
                jWarningsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollWarnings, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
            );
     
            jCheckLabel.setText("Check for invalid or missing data");
     
            jDataInterpCheckBox.setText("Data Interpolation");
            jDataInterpCheckBox.setToolTipText("Flag to interpolate file for missing data");
     
            jDataOutputPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Data Output", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
     
            jDataRangePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Range"));
     
            jEndRowField.setToolTipText("Type last data (row) to plot");
     
            jRowsBackField.setToolTipText("Type how many data to plot counting \nbackward from last data in file");
     
            jStartRowField.setToolTipText("Type first data (row) to plot");
     
            jStartRowLabel.setText("Start Row");
     
            jEndRowLabel.setText("End Row");
     
            jRowsBackLabel.setText("Rows Back");
     
            jTotalRowsTextField.setToolTipText("Display total number of data (rows) in file");
            jTotalRowsTextField.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jTotalRowsTextFieldActionPerformed(evt);
                }
            });
     
            jTotalRowsLabel.setText("Total Rows");
     
            javax.swing.GroupLayout jDataRangePanelLayout = new javax.swing.GroupLayout(jDataRangePanel);
            jDataRangePanel.setLayout(jDataRangePanelLayout);
            jDataRangePanelLayout.setHorizontalGroup(
                jDataRangePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDataRangePanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jDataRangePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jStartRowLabel)
                        .addComponent(jTotalRowsLabel)
                        .addComponent(jEndRowLabel)
                        .addComponent(jRowsBackLabel))
                    .addGap(18, 18, 18)
                    .addGroup(jDataRangePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jStartRowField, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
                        .addComponent(jTotalRowsTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
                        .addComponent(jEndRowField, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
                        .addComponent(jRowsBackField, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE))
                    .addContainerGap())
            );
            jDataRangePanelLayout.setVerticalGroup(
                jDataRangePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jDataRangePanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jDataRangePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTotalRowsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTotalRowsLabel))
                    .addGap(8, 8, 8)
                    .addGroup(jDataRangePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jStartRowField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jStartRowLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jDataRangePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jEndRowField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jEndRowLabel))
                    .addGap(8, 8, 8)
                    .addGroup(jDataRangePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jRowsBackField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jRowsBackLabel))
                    .addGap(19, 19, 19))
            );
     
            jPlotPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Plot"));
     
            jPlotButtonGroup.add(jHeikinRadioButton);
            jHeikinRadioButton.setText("Heikin-Ashi");
     
            jPlotButtonGroup.add(jLineRadioButton);
            jLineRadioButton.setText("Line on");
     
            jPlotButtonGroup.add(jBarsRadioButton);
            jBarsRadioButton.setText("Bars");
     
            jPlotButtonGroup.add(jCandlestickRadioButton);
            jCandlestickRadioButton.setText("Candlestick");
     
            jPlotSelectComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Close", "Open", "High", "Low", "(High+Low)/2", "(Open+Close)/2", "(High+Low+Close)/3" }));
     
            jPlotDataButton.setText("Plot Data");
     
            javax.swing.GroupLayout jPlotPanelLayout = new javax.swing.GroupLayout(jPlotPanel);
            jPlotPanel.setLayout(jPlotPanelLayout);
            jPlotPanelLayout.setHorizontalGroup(
                jPlotPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPlotPanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPlotPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jBarsRadioButton)
                        .addGroup(jPlotPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(jPlotPanelLayout.createSequentialGroup()
                                .addGroup(jPlotPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jCandlestickRadioButton)
                                    .addComponent(jHeikinRadioButton))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jPlotDataButton, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPlotPanelLayout.createSequentialGroup()
                                .addComponent(jLineRadioButton)
                                .addGap(43, 43, 43)
                                .addComponent(jPlotSelectComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap(63, Short.MAX_VALUE))
            );
            jPlotPanelLayout.setVerticalGroup(
                jPlotPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPlotPanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPlotPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLineRadioButton)
                        .addComponent(jPlotSelectComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPlotPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPlotPanelLayout.createSequentialGroup()
                            .addComponent(jBarsRadioButton)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jCandlestickRadioButton)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jHeikinRadioButton))
                        .addComponent(jPlotDataButton, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(22, Short.MAX_VALUE))
            );
     
            javax.swing.GroupLayout jDataOutputPanelLayout = new javax.swing.GroupLayout(jDataOutputPanel);
            jDataOutputPanel.setLayout(jDataOutputPanelLayout);
            jDataOutputPanelLayout.setHorizontalGroup(
                jDataOutputPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDataOutputPanelLayout.createSequentialGroup()
                    .addComponent(jDataRangePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(32, 32, 32)
                    .addComponent(jPlotPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap())
            );
            jDataOutputPanelLayout.setVerticalGroup(
                jDataOutputPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDataOutputPanelLayout.createSequentialGroup()
                    .addGroup(jDataOutputPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jPlotPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jDataRangePanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE))
                    .addContainerGap(21, Short.MAX_VALUE))
            );
     
            jCycleAnalysisPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Cycle Analysis ", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
     
            javax.swing.GroupLayout jCycleAnalysisPanelLayout = new javax.swing.GroupLayout(jCycleAnalysisPanel);
            jCycleAnalysisPanel.setLayout(jCycleAnalysisPanelLayout);
            jCycleAnalysisPanelLayout.setHorizontalGroup(
                jCycleAnalysisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 514, Short.MAX_VALUE)
            );
            jCycleAnalysisPanelLayout.setVerticalGroup(
                jCycleAnalysisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 213, Short.MAX_VALUE)
            );
     
            javax.swing.GroupLayout jDataManagerLayout = new javax.swing.GroupLayout(jDataManager);
            jDataManager.setLayout(jDataManagerLayout);
            jDataManagerLayout.setHorizontalGroup(
                jDataManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jDataManagerLayout.createSequentialGroup()
                    .addGroup(jDataManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jCycleAnalysisPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLowerDataManSeparator, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE)
                        .addComponent(jDataOutputPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jMiddleDataManSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jDataManagerLayout.createSequentialGroup()
                            .addComponent(jFileReader, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jCheckLabel)
                            .addGap(18, 18, 18)
                            .addComponent(jVerify, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 55, Short.MAX_VALUE)
                            .addComponent(jDataInterpCheckBox))
                        .addComponent(jDataFormat, javax.swing.GroupLayout.Alignment.LEADING, 0, 530, Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jDataManagerLayout.createSequentialGroup()
                            .addComponent(jDateFormat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jColumnDelimiter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jDataManagerLayout.createSequentialGroup()
                            .addComponent(jDataPreview, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jWarningsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap())
            );
            jDataManagerLayout.setVerticalGroup(
                jDataManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDataManagerLayout.createSequentialGroup()
                    .addComponent(jDataFormat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jDataManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jDateFormat, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jColumnDelimiter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jDataManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jFileReader, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jVerify, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jDataInterpCheckBox)
                        .addComponent(jCheckLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jDataManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jDataPreview, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jWarningsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jMiddleDataManSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 1, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jDataOutputPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jLowerDataManSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jCycleAnalysisPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(20, 20, 20))
            );
     
            jSplitPane1.setLeftComponent(jDataManager);
     
            jGraphPlot.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
     
            javax.swing.GroupLayout jGraphPlotLayout = new javax.swing.GroupLayout(jGraphPlot);
            jGraphPlot.setLayout(jGraphPlotLayout);
            jGraphPlotLayout.setHorizontalGroup(
                jGraphPlotLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 758, Short.MAX_VALUE)
            );
            jGraphPlotLayout.setVerticalGroup(
                jGraphPlotLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 825, Short.MAX_VALUE)
            );
     
            jSplitPane1.setRightComponent(jGraphPlot);
     
            jToolBar.setRollover(true);
     
            jFile.setText("File");
            jMainMenuBar.add(jFile);
     
            jEdit.setText("Edit");
            jMainMenuBar.add(jEdit);
     
            setJMenuBar(jMainMenuBar);
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jTopSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 1340, Short.MAX_VALUE)
                .addComponent(jToolBar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1340, Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1322, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(8, 8, 8))
                .addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 1340, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addComponent(jToolBar, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jTopSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 835, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(49, 49, 49))
            );
     
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-1348)/2, (screenSize.height-994)/2, 1348, 994);
        }// </editor-fold>                        
     
     private void jFileReaderActionPerformed(java.awt.event.ActionEvent evt) {                                            
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setFileFilter(new TxtFileFilter());
        int returnVal = fileChooser.showOpenDialog(this);
        if(returnVal == JFileChooser.APPROVE_OPTION){
     
            File myFile = fileChooser.getSelectedFile();
            FileImport obj1 = new FileImport(myFile);
            jTotalRowsTextField.setText(String.valueOf(obj1.numberOfLines()));
            System.out.println(obj1.checkIsFile());
            System.out.println(obj1.numberOfLines());
     
          obj1.importToArray();
          obj1.printArray();
     
          System.out.println("--------------------------------------");
     
          obj1.buildDataArray(obj1.getArray());
          obj1.printDataArray();
     }                                           
        }
        private void jTotalRowsTextFieldActionPerformed(java.awt.event.ActionEvent evt) {                                                    
     
        }                                                   
     
        private class TxtFileFilter extends FileFilter{
            public boolean accept(File file){
                if(file.isDirectory()) return true;
                String fname = file.getName();
                return fname.endsWith("txt");
            }
            public String getDescription(){
            return "txt file";
        }
        }
     
            public static void main(String args[]) {
            try{
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            }
            catch(UnsupportedLookAndFeelException e){
                //handle exception
            }
            catch(ClassNotFoundException e){
                //handle exception
            }
            catch(InstantiationException e){
                //handle exception
            }
            catch(IllegalAccessException e){
                //handle exception
            }
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new SplitJFrame().setVisible(true);
                }
            });
        }
     
        // Variables declaration - do not modify                     
        private javax.swing.JRadioButton jBarsRadioButton;
        private javax.swing.JRadioButton jCandlestickRadioButton;
        private javax.swing.JLabel jCheckLabel;
        private javax.swing.JComboBox jClose;
        private javax.swing.JPanel jColumnDelimiter;
        private javax.swing.ButtonGroup jColumnsDelimButtonGroup;
        private javax.swing.JComboBox jComboDateFormat;
        private javax.swing.JRadioButton jCommaRadioButton;
        private javax.swing.JPanel jCycleAnalysisPanel;
        private javax.swing.JPanel jDataFormat;
        private javax.swing.JCheckBox jDataInterpCheckBox;
        private javax.swing.JPanel jDataManager;
        private javax.swing.JPanel jDataOutputPanel;
        private javax.swing.JPanel jDataPreview;
        private javax.swing.JTextArea jDataPreviewTextArea;
        private javax.swing.JPanel jDataRangePanel;
        private javax.swing.JComboBox jDate;
        private javax.swing.JPanel jDateFormat;
        private javax.swing.JLabel jDateLabel;
        private javax.swing.JMenu jEdit;
        private javax.swing.JTextField jEndRowField;
        private javax.swing.JLabel jEndRowLabel;
        private javax.swing.JMenu jFile;
        private javax.swing.JButton jFileReader;
        private javax.swing.JPanel jGraphPlot;
        private javax.swing.JRadioButton jHeikinRadioButton;
        private javax.swing.JComboBox jHigh;
        private javax.swing.JRadioButton jLineRadioButton;
        private javax.swing.JComboBox jLow;
        private javax.swing.JSeparator jLowerDataManSeparator;
        private javax.swing.JMenuBar jMainMenuBar;
        private javax.swing.JSeparator jMiddleDataManSeparator;
        private javax.swing.JComboBox jOpen;
        private javax.swing.JComboBox jOther;
        private javax.swing.ButtonGroup jPlotButtonGroup;
        private javax.swing.JButton jPlotDataButton;
        private javax.swing.JPanel jPlotPanel;
        private javax.swing.JComboBox jPlotSelectComboBox;
        private javax.swing.JTextField jRowsBackField;
        private javax.swing.JLabel jRowsBackLabel;
        private javax.swing.JScrollPane jScrollDataPreview;
        private javax.swing.JScrollPane jScrollWarnings;
        private javax.swing.JRadioButton jSemiColonRadioButton;
        private javax.swing.JSeparator jSeparator3;
        private javax.swing.JRadioButton jSpaceRadioButton;
        private javax.swing.JSplitPane jSplitPane1;
        private javax.swing.JTextField jStartRowField;
        private javax.swing.JLabel jStartRowLabel;
        private javax.swing.JRadioButton jTabRadioButton;
        private javax.swing.JToolBar jToolBar;
        private javax.swing.JSeparator jTopSeparator;
        private javax.swing.JLabel jTotalRowsLabel;
        private javax.swing.JTextField jTotalRowsTextField;
        private javax.swing.JButton jVerify;
        private javax.swing.JComboBox jVolume;
        private javax.swing.JPanel jWarningsPanel;
        private javax.swing.JTextArea jWarningsTextArea;
        // End of variables declaration                   
     
    }

    Susanna

  8. #8
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    The updated SplitJFrame class has stoped the initComponents(); issue. Thanks for that.

    I'm now looking into the problem with Date newDate = sdf.parse(d[i][0]);
    The current problem is - Type mismatch: cannot convert from java.util.Date to Date
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  9. #9
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    OK well I've commented out:

                           Date newDate = sdf.parse(d[i][0]);//parse first column to Date
                           dateArray[i] = newDate;

    The GUI runs fine and I have imported an example file.
    When the file is imported, it displays this in the console:


    true
    8
    0 20100401 6189.38 6238.57 6186.59 6235.56 29546500
    1 20100405 6235.56 6235.56 6235.56 6235.56 0
    2 20100406 6250.01 6265.32 6214.18 6252.21 29445700
    3 20100407 6248.37 6256.4 6208.52 6222.41 28689600
    4 20100408 6199.94 6207.14 6138.02 6171.83 30684300
    5 20100409 6226.26 6254.49 6216.6 6249.7 30543800
    6 20100412 6283.81 6285.03 6223.78 6250.69 24311600
    7 20100413 6236.28 6251.46 6199.71 6230.83 28970000
    --------------------------------------
    0.0 6189.38 6238.57 6186.59 6235.56 2.95465E7
    0.0 6235.56 6235.56 6235.56 6235.56 0.0
    0.0 6250.01 6265.32 6214.18 6252.21 2.94457E7
    0.0 6248.37 6256.4 6208.52 6222.41 2.86896E7
    0.0 6199.94 6207.14 6138.02 6171.83 3.06843E7
    0.0 6226.26 6254.49 6216.6 6249.7 3.05438E7
    0.0 6283.81 6285.03 6223.78 6250.69 2.43116E7
    0.0 6236.28 6251.46 6199.71 6230.83 2.897E7


    Is this correct?
    Do you wish to display the first 3 and last 3 rows of this output in jDataPreviewTextArea?

    So...


    0 20100401 6189.38 6238.57 6186.59 6235.56 29546500
    1 20100405 6235.56 6235.56 6235.56 6235.56 0
    2 20100406 6250.01 6265.32 6214.18 6252.21 29445700

    0.0 6226.26 6254.49 6216.6 6249.7 3.05438E7
    0.0 6283.81 6285.03 6223.78 6250.69 2.43116E7
    0.0 6236.28 6251.46 6199.71 6230.83 2.897E7


    ??
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  10. #10
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Display in a text area

    Well I'm glad it all runs fine.

    What I would like to display is something like this

    0 20100401 6189.38 6238.57 6186.59 6235.56 29546500
    1 20100405 6235.56 6235.56 6235.56 6235.56 0
    2 20100406 6250.01 6265.32 6214.18 6252.21 29445700
    ------------------------------------------------------
    5 20100409 6226.26 6254.49 6216.6 6249.7 30543800
    6 20100412 6283.81 6285.03 6223.78 6250.69 24311600
    7 20100413 6236.28 6251.46 6199.71 6230.83 28970000

    So to see first and last rows of txt file; rows displayed are only from bin array

    Susanna

  11. #11
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    In your SplitJFrame class, find the jFileReaderActionPerformed(java.awt.event.ActionEv ent evt) method, and add this under obj1.printArray();

          //TEST CODE      
     
          for(int i =0;i<3; i++){  
        	  jDataPreviewTextArea.setText(jDataPreviewTextArea.getText().trim() + i + ")");
        	  for(int j =0;j<obj1.bin[i].length; j++){
        		  jDataPreviewTextArea.setText(jDataPreviewTextArea.getText() + " " + String.valueOf(obj1.bin[i][j]));
        	  }
        	  		jDataPreviewTextArea.setText(jDataPreviewTextArea.getText() + "\n");    	  
          }      
          //END TEST CODE

    In theory this should work.

    I will continue this as soon as possible
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  12. #12
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Display in a text area

    Thank you very much!

    It works fine, it plots first 3 rows in a text area; would it be an alternative solution to create a new array in which to copy first 3 and last three rows from array bin?

    Susanna

  13. #13
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    Good I'm glad that worked. Tomorrow I will help you display the last 3 rows.
    Yes you could possibly create a new array for those values but I don't see the point unless you need to call them again.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  14. #14
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    I must be going mad
    I'm not sure why this is not adding the new lines in correctly.

    The code I am working on is:

          /// TEST CODE FIRST 3 ROWS ///      
     
          for(int i =0;i<3; i++){    	  		
        	  jDataPreviewTextArea.setText(jDataPreviewTextArea.getText() + "\n");
        	  jDataPreviewTextArea.setText(jDataPreviewTextArea.getText().trim() + i + ")");    	  		
        	  	for(int j =0;j<obj1.bin[i].length; j++){    		  
        	  		jDataPreviewTextArea.setText(jDataPreviewTextArea.getText() + " " + String.valueOf(obj1.bin[i][j]));
        	  }
        	  		jDataPreviewTextArea.setText(jDataPreviewTextArea.getText() + "\n");    	  
          }      
          /// END TEST CODE FIRST 3 ROWS ///
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  15. #15
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Display in a text area

    it's not appending the newline because every time through the loop you're re-trimming the text. The net result is only the very last newline is left when you exit the loop. Also, for better performance use a StringBuilder.

    Try this:

    StringBuilder temp = new StringBuilder(jDataPreviewTextArea.getText());
    			final int NUM_LINES = 3;
    			for(int i =0;i<NUM_LINES; i++){
    				temp.append(i);
    				temp.append(")");    	  		
    				for(int j =0;j<obj1.bin[i].length; j++){
    					temp.append(" ");
    					temp.append(String.valueOf(obj1.bin[i][j]));
    				}
    				if (i < NUM_LINES - 1)
    				{
    					temp.append("\n");
    				}
    			}
    			jDataPreviewTextArea.setText(temp.toString());

  16. #16
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    You're a legend helloworld922. Can't believe I overlooked this. Thanks for your reply!
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  17. #17
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Display in a text area

    Thank you very much to you all!

    Now it print perfectly first 3 rows in txt area, is there a method to set font size?

    Susanna

  18. #18
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  19. #19
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Display in a text area

    Thanks, I forgot I can set font size and color directly from palette - properties in NetBeans

    This is how it looks now

    A00087.png

    Susanna
    Last edited by susieferrari; March 18th, 2011 at 11:27 AM.

  20. #20
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    OK here is the updated code. I have implemented helloworld922's solution.

    This will show the first 3 and last 3 lines of the input file.

    Place this code just after obj1.printArray(); in the SplitJFrame class:

      	//JPF TEST CODE - FIRST 3 & LAST 3 LINES //      
          	String line = "--------------------------------------";
     
          	StringBuilder firstThree = new StringBuilder(jDataPreviewTextArea.getText());
    		final int NUM_LINES = 3;
     
    		for(int i = 0;i<NUM_LINES; i++){
    			firstThree.append(i);
    			firstThree.append(")");    	  		
    			for(int j = 0;j<obj1.bin[i].length; j++){
    				firstThree.append(" ");
    				firstThree.append(String.valueOf(obj1.bin[i][j]));
    			}
    			if (i < NUM_LINES - 1)
    			{
    				firstThree.append("\n");
    			}			
    		}		
    		jDataPreviewTextArea.setText(firstThree.toString());
    		jDataPreviewTextArea.setText(jDataPreviewTextArea.getText() + "\n" + line + "\n");
     
    		final int totalNumberOfLines = obj1.numberOfLines();
    		final int minusThree = (totalNumberOfLines - 3);		
     
    		StringBuilder lastThree = new StringBuilder(jDataPreviewTextArea.getText());
    		for(int k = minusThree; k < totalNumberOfLines; k++){
    			lastThree.append(k);
    			lastThree.append(")");
    			for(int j = 0;j<obj1.bin[k].length; j++){
    				lastThree.append(" ");
    				lastThree.append(String.valueOf(obj1.bin[k][j]));
    			}
    			if (k < totalNumberOfLines - 1)
    			{
    				lastThree.append("\n");
    			}
    		}
    		jDataPreviewTextArea.setText(lastThree.toString());
    		//END JPF TEST CODE - FIRST 3 & LAST 3 LINES //
    Attached Images Attached Images
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  21. #21
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Display in a text area

    When the details are displayed in the TextArea, the scroll bars move with it and scroll to the end of the data.

    For easy readability and to stop this from happening, I suggest you add:

    jDataPreviewTextArea.setCaretPosition(0);

    Just under:

    jDataPreviewTextArea.setText(lastThree.toString());

    The updated code now looks like this:

          	//JPF TEST CODE - FIRST 3 & LAST 3 LINES //      
          	String line = "--------------------------------------";
     
          	StringBuilder firstThree = new StringBuilder(jDataPreviewTextArea.getText());
    		final int NUM_LINES = 3;
     
    		for(int i = 0;i<NUM_LINES; i++){
    			firstThree.append(i);
    			firstThree.append(")");    	  		
    			for(int j = 0;j<obj1.bin[i].length; j++){
    				firstThree.append(" ");
    				firstThree.append(String.valueOf(obj1.bin[i][j]));
    			}
    			if (i < NUM_LINES - 1)
    			{
    				firstThree.append("\n");
    			}			
    		}		
    		jDataPreviewTextArea.setText(firstThree.toString());
    		jDataPreviewTextArea.setText(jDataPreviewTextArea.getText() + "\n" + line + "\n");
     
    		final int totalNumberOfLines = obj1.numberOfLines();
    		final int minusThree = (totalNumberOfLines - 3);		
     
    		StringBuilder lastThree = new StringBuilder(jDataPreviewTextArea.getText());
    		for(int k = minusThree; k < totalNumberOfLines; k++){
    			lastThree.append(k);
    			lastThree.append(")");
    			for(int j = 0;j<obj1.bin[k].length; j++){
    				lastThree.append(" ");
    				lastThree.append(String.valueOf(obj1.bin[k][j]));
    			}
    			if (k < totalNumberOfLines - 1)
    			{
    				lastThree.append("\n");
    			}
    		}
    		jDataPreviewTextArea.setText(lastThree.toString());		
    		jDataPreviewTextArea.setCaretPosition(0);
    		//END JPF TEST CODE - FIRST 3 & LAST 3 LINES //
    Attached Images Attached Images
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  22. The Following User Says Thank You to JavaPF For This Useful Post:

    susieferrari (March 22nd, 2011)

  23. #22
    Junior Member susieferrari's Avatar
    Join Date
    Mar 2011
    Location
    Parma Italy
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Display in a text area

    Thank you very much guys, you are great!

    Susie

Similar Threads

  1. Jigloo help to produce a text area which only scrolls down
    By rtumatt in forum AWT / Java Swing
    Replies: 0
    Last Post: February 2nd, 2010, 06:09 PM
  2. Replies: 3
    Last Post: April 20th, 2009, 08:35 AM
  3. Problem in implementing mortgage calculator
    By American Raptor in forum AWT / Java Swing
    Replies: 1
    Last Post: April 1st, 2009, 02:09 PM
  4. How to read character from image area(jpg image)?
    By sundarjothi in forum Java Theory & Questions
    Replies: 5
    Last Post: August 6th, 2008, 02:08 AM