473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

set 4 positions in BoxLayout

19
Hi! I hope someone could help:
I defined a BoxLayout JPanel because I need to show in this order:
a checkbox
a textfield
another checkbox
another texfield

and this works fine:

JPanel jPanelBoEx = new JPanel();
jPanelVars.add(jPanelBoEx, BorderLayout.LINE_START);
jPanelBoEx.setLayout(new BoxLayout(jPanelBoEx, BoxLayout.PAGE_AXIS));

jPanelBoEx.add(jchkbox1);
jPanelBoEx.add(jTextField1);
jPanelBoEx.add(jchkbox2);
jPanelBoEx.add(jTextField2);

But I need not to show them in the center, they must be shifted some position to the right so I use this:

jPanelBoEx.setBorder(BorderFactory.createEmptyBord er(0, 160, 0, 0));
To shift the four of them to the right, but I need the two textfields to be more to the right than the 2 checkboxes..

But I can't find how to "move" the textfields to a different position than the checkboxes.. I can only position the 4 of them toguether, is there a way?

Thanks in advance.
Jan 27 '08 #1
2 1868
JosAH
11,448 Expert 8TB
jPanelBoEx.add(jchkbox1);
jPanelBoEx.add(jTextField1);
jPanelBoEx.add(jchkbox2);
jPanelBoEx.add(jTextField2);

jPanelBoEx.setBorder(BorderFactory.createEmptyBord er(0, 160, 0, 0));
To shift the four of them to the right, but I need the two textfields to be more to the right than the 2 checkboxes..

But I can't find how to "move" the textfields to a different position than the checkboxes.. I can only position the 4 of them toguether, is there a way?

Thanks in advance.
Put every object in its own JPanel, apply your border trick to each JPanel and
add those four panels to your jPanelBoxEx.

kind regards,

Jos
Jan 28 '08 #2
aleplgr
19
Put every object in its own JPanel, apply your border trick to each JPanel and
add those four panels to your jPanelBoxEx.

kind regards,

Jos

That will work! Thank you very much Jos
Jan 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Joseph | last post by:
I can't seem to determine why I receive this exceptio when executing the code below. I get a "BoxLayout can't be shared" exception whenever i execute. Any reasons and solutions is appreciated....
1
by: Colin Green | last post by:
OK here's is what I wish to do. I have an XML file that I want to read into an XmlDocument. I then want to be able to interrogate the XmlNodes to find both their start AND end character positions...
0
by: KK | last post by:
Dear All I have an MDI Application which needs to restore it's previously closed state on subsequent openings. While closing the application, I am storing the positions of all the Mdi child...
4
by: Anon | last post by:
Hello All! I have a long string that I need to make sense out of. I have the documentation about what info is between which characters, I just need to somehow parse each 94 character string into...
14
by: micklee74 | last post by:
hi say i have string like this astring = 'abcd efgd 1234 fsdf gfds abcde 1234' if i want to find which postion is 1234, how can i achieve this...? i want to use index() but it only give me the...
0
by: Jeff | last post by:
MORE THAN A THOUSAND POSITIONS NATIONWIDE Go to www.sayhi.to/JeffAltman Jeff Altman, The Big Game Hunter, is looking for people with a variety of backgrounds for Technology jobs Accounting...
0
by: IT Jobs | last post by:
Hi We are from Ventures IT Solutions, A Young Organisation based in Delhi, and is started with a vision to provide, quality services to our esteemed clients and candidates, We have some...
2
by: thesti | last post by:
hi, is there anyway that we can set the gap between components in BoxLayout just like the hgap and vgap in gridlayout? thx
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.