Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-03-2008, 06:03 PM
Member
 
Join Date: Jan 2008
Posts: 1
vargihate is on a distinguished road
Working with Labels on Panels.
Hi, I’m new here and I have 2 questions.

1) I have added some labels into a panel and by default they all align in the center of the screen. How do I align them all to the left?
I have tried using the following but nothing works:

label = new JLabel(“text”, SwingConstants.LEFT);
and
label.setVerticalTextPosition(JLabel.LEFT);
label.setHorizontalTextPosition(JLabel.LEFT);


2) I have one panel that contains 2 buttons and works like a main menu.
If the user clicks on a button a new panel must appear BELOW the panel of the main menu (I have lots of space below). However, the panel appears behind the main menu and therefore cannon be seen unless I set the visibility of the main menu to false.
Anyone knows how to show the panel below the first one? (so that I will always have the main menu visible)

Thanks,
Samantha!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-03-2008, 06:11 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 839
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
The API also makes a note of the WEST and EAST attributes, maybe this will be the answer to your first question?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-04-2008, 05:09 AM
rpwtdj's Avatar
Member
 
Join Date: Dec 2007
Posts: 15
rpwtdj is on a distinguished road
Send a message via MSN to rpwtdj
1. You need to add a layout manager to your panel first.
Code:
setLayout(new BorderLayout());
and then
Code:
add(yourLabel,BorderLayout.WEST);
I think this can apply.

2. You can use 'javax.swing.JSplitPane' to implement your app.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
images, panels and applets jamesfrize Java Applets 3 03-20-2008 05:35 PM
Buttons to show new panels Lehane_9 AWT / Swing 1 03-06-2008 05:22 PM
Aligning Labels Java Tip Java Tips 0 01-02-2008 07:26 PM
JMenu calling another Forms/Panels plodos New To Java 2 12-10-2007 09:02 AM
Need a tutorial for Studying about Panels ramachandran New To Java 1 10-25-2007 10:05 AM


All times are GMT +3. The time now is 09:28 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org