[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Label text allignment

Posted on 2004-10-23
3
Medium Priority
?
201 Views
Last Modified: 2010-03-31
Hi Experts!!
Here is a piece of code i am using to postion the text in my label in center, but it not working. Could u please tell me what is wrong?

================Code=========================
aDie = new JLabel( String.valueOf(top)  );
      aDie.setLayout(null);
       aDie.setAlignmentX(CENTER_ALIGNMENT);
      aDie.setBounds(10, 10, 10, 10);
      aDie.setPreferredSize(new Dimension(90,90));
     aDie.setFont(new Font("Sansserif", Font.BOLD, 80));
   

     aDie.setOpaque(true);
     aDie.setBackground( Color.white );
   
0
Comment
Question by:komlaaa
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 12389058
JLabel aDie = new JLabel(String.valueOf(top), SwingConstants.CENTER);
0
 

Author Comment

by:komlaaa
ID: 12389116
Thanks CEHJ, the answer was quick!!
thanks again.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12389130
8-)
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question