I have to display data on a jbutton which is retrieved from a database(mysql) but due to different length of the strings involved the presentation looks bad and disordered. Is there a way to get the alignment.This is my code to set the data on the jbutton 'j' is the jbutton array
j[check].setText(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3)+" "+rs.getString(4)+" "+ws+rs.getString(5)+" "+rs.getString(6)+" "+rs.getString(7));
I have given some spaces for some particular set of data but in most cases it goes bad.
Here are 2 cases in which the lengths are different
CSE201 Programming Fundamentals 3 Saritha V. SJT-401 A1 59
CSE201 Programming Fundamentals 3 Yokesh Babu SJT-402 A1 58
Now after the 3rd string(i.e after "CSE201 Programming Fundamentals 3") the lengths differ and formatting goes bad.