band1 = new Label("Color of Band 1", Label.CENTER); text1 = new TextField(3); text1.setBackground(Color.black); text1.setHorizontalAlignment(TextField.CENTER);
pls look at my last sentence: "text1.setHorizontalAlignment(TextField.CENTER);"
why it doesn't seem to work? as in e texts are still not aligned to the cneter.. [ August 13, 2005: Message edited by: may tan ]
as you are using awt, you'll probably have to do it manually i.e. calculating the string length and adding a padding - remember to strip the padding when calling getText(). if not using a monospaced font, look up the FontMetrics class for calculation of the string length in pixels etc
hmm.. is there really no other coding such that when user type in something in the textfield, all the texts will appear in the center instead of by default(left side)?
I don't use awt components enough to be sure, but I doubt it.
I'm sure this question would have been asked previously, so you're probably better off searching for a definitive answer - try this forum, then the sun forum, then google.
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad: