• 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

next line in swings

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this

 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Evacuate the building! Here, take this tiny ad with you:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic