• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

changing the view of information from jtextarea to Jtable

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends

i'm looking a way to translate or changing the view of information from jtextarea to Jtable
here is my code

any help i will preshers

 
Rancher
Posts: 517
15
Notepad Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(1) Can you tell what kind of data is there in the following variables:
Nbre_Textes
Nbre_Mots_Vecteur_Global
Vecteur
Vecteur_Global_Mots


(2) Can you show an example output/result you are looking for?
 
Hicham Amine
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
int Nbre_Textes
int Nbre_Mots_Vecteur_Global;
float Vecteur[][]= new float [50][500];
String Vecteur_Global_Mots[]= new String[500];
the out is decument term matrix (for words)


 
Prasad Saya
Rancher
Posts: 517
15
Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, post the Java code you had written so far for the JTable.
 
Prasad Saya
Rancher
Posts: 517
15
Notepad Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

int Nbre_Textes;
int Nbre_Mots_Vecteur_Global;



What are values of these two variables?
 
Hicham Amine
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
int Nbre_Textes is just int value to get number text inserted by user becuase firstly i need to import folder containe a text files

int Nbre_Mots_Vecteur_Global;   the globale of word number in a vector
 
Prasad Saya
Rancher
Posts: 517
15
Notepad Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know if this accurate, but see the following is what you are looking for:


 
Hicham Amine
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you ..........yes  this is what i want but i still work on it
because i need to show my data not (taxt(i).......text1 ,text2.................) in row
can i contact you sir
 
Prasad Saya
Rancher
Posts: 517
15
Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hicham Amine wrote:thank you ...



You are welcome  
 
Hicham Amine
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry about that but i still have problem how to show data??
 
Prasad Saya
Rancher
Posts: 517
15
Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please explain the problem with details.
 
Hicham Amine
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the code it can generate jaust the first row

i do some change what im worng with it ???




in this image the table not fill as well look !!!
 
Prasad Saya
Rancher
Posts: 517
15
Notepad Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this and tell me what is the result.


 
Prasad Saya
Rancher
Posts: 517
15
Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
textStrings [i] =  String.format("%15s\t", Vecteur_Global_Mots[i]);
data [i] [j] = String.format("%3d:%.02f\t", j, Vecteur[i][j]);


Also, in the above statements remove the <tab> ("\t") in the formatting:

textStrings [i] =  String.format("%15s", Vecteur_Global_Mots[i]);
data [i] [j] = String.format("%3d:%.02f", j, Vecteur[i][j]);
 
Prasad Saya
Rancher
Posts: 517
15
Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more change:

Change this:
data [i] [j] = String.format("%3d:%.02f", j, Vecteur[i][j]);

To this:
data [i] [j] = String.format("%3d:%.02f", j, Vecteur[j][i]);
 
Hicham Amine
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
im sorry brother the result still the same and there is out of renge in array !!!



i can't get a real data in jtextarea to jtable
like 1 columns
and the last columns not appear  !!!
 
Prasad Saya
Rancher
Posts: 517
15
Notepad Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

im sorry brother the result still the same and there is out of renge in array !!!
i can't get a real data in jtextarea to jtable




Examine (read the code and see if it is understanding to you) the above code. There are two comments on lines 7 and 20; this you need to verify and see if its accurate.  Also, the data stored in the arrays Vecteur and Vecteur_Global_Mots.

Here are the links to the JTable API documentation and the Oracle's Java Tutorials:
- Documentation: https://docs.oracle.com/javase/7/docs/api/javax/swing/JTable.html
- Tutorial: https://docs.oracle.com/javase/tutorial/uiswing/components/table.html

Try to use this documentation and apply these in the application to get the data into the table as you want it. The documentation and tutorials are exhaustive with all details needed to create tables for a wide variety of data, including the data in your application.

In case you find it difficult to use the JTable for this application, try with simpler examples first, and then work with this application. You can post back what you have tried with specific queries. Don't forget to include entire code and the outputs.

 
Hicham Amine
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you very match for your help brother.......i think it works now i try more test to confirm that
I am grateful to you
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic