Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
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 07-24-2007, 06:35 AM
Member
 
Join Date: Jul 2007
Posts: 40
lenny is on a distinguished road
Use the Layout in java
Hi, look at the code below

Code:
Pane = new JPanel(); Label1 = new JLabel("1"); Pane.add(Label1); Label2 = new JLabel("2"); Pane.add(Label2); Label3 = new JLabel("3"); Pane.add(Label3); Label4 = new JLabel("4"); Pane.add(Label4); Label5 = new JLabel("5"); Pane.add(Label5); Label6 = new JLabel("6"); Pane.add(Label6);
what if i want to add Label4, Label5, & Label6 to the next line?
so it would look like:
Code:
Label1 Label2 Label3 Label4 Label5 Label6
Thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-26-2007, 05:48 PM
Member
 
Join Date: Jul 2007
Posts: 4
xCLARAx is on a distinguished road
Code:
public class test extends JFrame { private JPanel Pane; private JLabel Label1,Label2,Label3,Label4,Label5,Label6; public test() { setSize(300,200); setLayout(new GridLayout(1,1)); Pane = new JPanel(); Pane.setLayout(new GridLayout(2,3)); Label1 = new JLabel("1"); Pane.add(Label1); Label2 = new JLabel("2"); Pane.add(Label2); Label3 = new JLabel("3"); Pane.add(Label3); Label4 = new JLabel("4"); Pane.add(Label4); Label5 = new JLabel("5"); Pane.add(Label5); Label6 = new JLabel("6"); Pane.add(Label6); add(Pane); } public static void main(String[] args) { test jrframe = new test(); jrframe.setVisible(true); } }

Last edited by levent : 07-26-2007 at 09:20 PM. Reason: Code is placed inside [code] tag.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-26-2007, 09:20 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
xCLARAx: Please use [code] tag when you post some code next time. It will make your code more readable.
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
how to get layout information from pdf using java aravind730 Java Tips 0 02-09-2008 08:59 PM
SWT Layout JavaForums Java Blogs 0 12-31-2007 06:53 PM
website java button layout abcdefg AWT / Swing 0 12-25-2007 06:44 PM
Help with JButton and layout adlb1300 AWT / Swing 1 12-25-2007 10:33 AM
JGraph Layout Pro 1.4.0.3 levent Java Announcements 0 07-31-2007 08:43 PM


All times are GMT +3. The time now is 02:28 PM.


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