center the text with this setup inside the button

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


JButton b = new JColoredButton("", Color.green, Color.black);
          b.setPreferredSize( new Dimension( 40, 20 ) );
          buttons.put("b"+(i+1), b);
     JButton b1 = (JButton) buttons.get("b1");             // this is where I would place them
     b1.setText("Axe Kick");
Question by:Drop_of_Rain
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
LVL 92

Accepted Solution

objects earned 300 total points
ID: 10934213

Author Comment

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

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.
LVL 92

Expert Comment

ID: 10934282
stop it your embarassing me :)

Author Comment

ID: 10934315

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 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