Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

next line in swings

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
can any one please say me the equivalent for "\n" in Swings.
because i'm having the data in JTable like
For Example

Apple Mango orange

i need the output format like
Apple
mango
orange
please help me out..

-Thanks & Regards,
Hamsa
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had this problem with Jlabel the way I found around it was to use HTML as the text instead of plain text as follows.

<html><body>test<br>test<body></html>

the <br> tag creates a new line break.

just wrap up your label Strings in HTML and it will work
 
Hamsagayathri Palanisamy
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.But, what i meant is,
I have created JTable as follows.
String fields[] = {"column 1", "column 2","column 3"};
int i=0;

ResultSet rs = preparedStmt.executeQuery();

while(rs.next())
{
for(int j=0;j<3;j++)
{
data[i][j] = rs.getString(j+1);
i++;
}
}

In data[n][1] where 'n' may be any value ..
i'm having value as "Apple Orange Mango" but i want as
Apple
Orange
Mango
JTable jt = new JTable( data, fields );
where 'fields' represents columns.
please help me out.

-Thanks & Regards,
Hamsa
 
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Hamsagayathri Palanisamy:
In data[n][1] where 'n' may be any value ..
i'm having value as "Apple Orange Mango" but i want as
Apple
Orange
Mango
JTable jt = new JTable( data, fields );
where 'fields' represents columns.
please help me out.

-Thanks & Regards,
Hamsa



Do I understand you correctly, if I say, currently you are getting this:


whereas what you want to achieve is this:


where x and y are some other values?
 
Hamsagayathri Palanisamy
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Maneesh Godbole:


Do I understand you correctly, if I say, currently you are getting this:


whereas what you want to achieve is this:


where x and y are some other values?






No Maneesh,i didnt mean that way. As for my code,I'm getting as follows


But what i want is



Hope now you got it.please help me out.

-Thanks & Regards,
Hamsa
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be better if you could post your executable code. You will get more response
 
Hamsagayathri Palanisamy
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


for data[n][1] i'm getting values from resultset as "value1 value2 value3" in horizontal. i need to format that to vertical as

value1
value2
value3

for data[n][1] where 'n' may be any value.

-Thanks & Regards,
Hamsa
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this

 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Hamsagayathri Palanisamy:
[CODE]... i need to format that to vertical as



The solution provided by Stuart Smith will exactly do what you want. Did you even try it out?
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!