Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

center the text with this setup inside the button

Posted on 2004-04-27
4
Medium Priority
?
217 Views
Last Modified: 2011-10-03
How could I center the text with this setup inside the button would it be:

 b.setHorizontalTextPosition(SwingConstants.CENTER);

JButton b = new JColoredButton("", Color.green, Color.black);
          b.setPreferredSize( new Dimension( 40, 20 ) );
          b.setHorizontalTextPosition(SwingConstants.LEFT);
          buttons.put("b"+(i+1), b);
          b.addActionListener(this);
          gridPanel.add(b);
         }
     JButton b1 = (JButton) buttons.get("b1");             // this is where I would place them
     b1.setText("Axe Kick");
0
Comment
Question by:Drop_of_Rain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 300 total points
ID: 10934213
b.setHorizontalAlignment(SwingConstants.CENTER);
0
 

Author Comment

by:Drop_of_Rain
ID: 10934265
That is what I though it would be. I am going to close this question.

I want to ask you a couple of questions so I will post them soon.

Thanks for the help
Christopher

P.S.
I am learning so much from you. What I am learning, I think is very important. I am learning to think in less code to do the same job. I have been very impressed with your style of code writing, you have doon just that, less code for the same job. Thanks for being my teacher.
0
 
LVL 92

Expert Comment

by:objects
ID: 10934282
stop it your embarassing me :)
0
 

Author Comment

by:Drop_of_Rain
ID: 10934315
Thanks,
Christopher
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

610 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