Align the column in a ListTag(s): AWT
The trick is to use a FIXED width character set like "Courier".
ml = new List();
my.setFont(new Font("Courier", Font.BOLD, 10));
insertItem(ml, "ARCHIVE", "STATUS", "PORT");
public void insertItem(List lbx,
String col1, String col2, String col3) {
String spaces2 = " ";
String spaces10 = " ";
String spaces20 = spaces10 + spaces10;
lbx.addItem(col1 +
spaces20.substring(0,20-col1.length()) +
spaces2 +
col2 +
spaces10.substring(0,10-col2.length()) +
col3);
}
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com