?
Solved

Panel and JLabel distance

Posted on 2003-03-14
5
Medium Priority
?
309 Views
Last Modified: 2012-08-13
I hava an JPanel with a JLabel in it. Is there a possibility to make the distance from the left and right sight bigger??

Now I find my text almost in the JPanel. And I do not want to make a extra space in my text
0
Comment
Question by:RdeLange
[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
5 Comments
 
LVL 8

Accepted Solution

by:
Exceter earned 200 total points
ID: 8141468
Could you post your code?
What layout manager are you using in the JLabel?
If you have not specified one the default is FlowLayout with left justification. Try this,

panel1.setLayout( new FlowLayout( FlowLayout.CENTER ) );

This will center your label inside the panel, along with any other components inside the panel.

Exceter
0
 

Expert Comment

by:CleanupPing
ID: 9474538
RdeLange:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 8

Expert Comment

by:Exceter
ID: 9477408
Sidenote: "What layout manager are you using in the JLabel?" should have read: What layout manager are you using in the JPanel?

Due to the lack of feedback I think I should get the points.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

801 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