• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trying to Center the contents of a Label  RSS feed

 
Mark McG
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

The label lblreceipe1 contains the String keyIngrediants. The problem I have is that the String automatically goes to the left. How can I centre this in the label?

Thanks,
Mark McG



Label lblreceipe1 = new Label();

Font chosenFont = new Font("Serif",Font.BOLD,27);

String keyIngrediants = "No Salt";

lblreceipe1.setText(keyIngerdiants);
lblreceipe1.setFont(chosenFont);
 
Rob Spoor
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out setAlignment.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!