>> * Please produce an SSCCE[1] or stop wasting our bandwidth.
>
> please say what you want next time instead of expecting me to read your mind as to what you wanted.
> You requested short code, not short stand-alone, compilable code.

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
It's Like "Hee Haw" With Lasers
> >>> I've found there is no point to the JTextArea constructor that takes row
> >>> and column values for the size.
[quoted text clipped - 9 lines]
>
> - *you* stopped posting,
actually I didn't. I posted my code and a screenshot with a few more comments about 58 minutes after your request. I checked
Google and they don't seem to have the post but I see it on my server so why it didn't get replicated is hard to say.
> - I was waiting for a response[1], and
> - nobody else had offered you a single comment or suggestion.
no one else did, you are right, and i responded to yoru request, but somehow it got lost in the mail. But anyway....
> You ever heard the saying 'God helps those that help themselves'?
> [2] If you had any misunderstandings about what I meant, you
> might have *asked*.
Actually i only thought of one thing when i read your request and that was to give you the few lines of code that involved the
text boxes , a screenshot, and nothing else so from my point of view I thought I knew exactly what you were looking for without a
doubt.
> ..In any case, now that I see actual code (nice example - BTW),
thank you, I just ripped out all the unneeded crap from the main progrm and created an example out of it.
> try this example and see if it works more logically for you.
> [ If not, please describe what you are actually expecting to see. ]
[quoted text clipped - 4 lines]
> // How wide is your screen?
> int colWidth = 15;
I just had an arbitrary number in there. The column count wasn't being obeyed either so the last thing I did to test to see if the
program was actually working right was to just put a number in there that should have made a big visual difference but for me it
did not and i just never bothered to change the value.
> window.getContentPane().add(textBoxesPanel);
> // you generally do not need to set the size, just..
> //window.setSize(800,500);
> // pack it
> window.pack();
I've tried to use pack() but I've never looked to see what class it comes from so when I do actually think to try it I must be
using the wrong class and so it isn't available through the inherited list of methods.
I did in fact compile and run this and the problem is that the 2nd text box is the only one defined to have 4 rows but the top box
has 4 rows as well (I accidentally removed those constructor lines from the code you put in this mesg so I can't respond right
below them for easier reference). The first box was defined to have 2 rows and it has 4 so what gives? Isn't the row count
supposed to be the number of visible rows and linecount (which I haven't even tried to use) keeps track of how many total rows of
text there are?
What I'm expecting to see is one textarea with 2 visible rows of text and another below it with 4 rows of text and to not have the
boxes get resized just because I press Enter enough that the carriage returns exceed the row count. Do i have the wrong
expectations? For all the talk about the rows I must say that the columns aren't being obeyed either but again, maybe I'm just
missing something here.
thanks
<the rest can be ignored>
just for your reference, I put the old text from the mesg you never saw here at the end (minus the original screenshot):
================================================================
The below code represents everything on the right side of the window in the screenshot.
JPanel textBoxesPanel = new JPanel(new GridLayout(4,1));
JLabel filterBoxLabel = new JLabel("Custom LDAP Filter: ");
customSearchFilterBox = new JTextArea(4,100);
customSearchFilterBox.setLineWrap(true);
customSearchFilterBox.setBorder(new EtchedBorder (EtchedBorder.RAISED));
JLabel resultsBoxLabel= new JLabel("LDAP Results: ");
ldapResultsBox = new JTextArea(50,100);
ldapResultsBox.setLineWrap(true);
ldapResultsBox.setBorder(new EtchedBorder (EtchedBorder.RAISED));
textBoxesPanel.add(filterBoxLabel);
textBoxesPanel.add(customSearchFilterBox);
textBoxesPanel.add(resultsBoxLabel);
textBoxesPanel.add(ldapResultsBox);
Sorry for including a screenshot in the actual mesg but I figured it was a good way of showing you waht I'm doing. The code
snippet represents the old version where I'm
still using GridLayout and not GridBagLayout. With the Grid Layout I get 7.5 rows that are visible (but it seems to be unlimited
rows that are actually i nthe box) and with
GridBagLayout (not shown) I get 1 row (until I figure out a better way of doing the layout using the constraints).
Am i missing something obvious/easy?
thanks
Andrew Thompson - 15 Jul 2005 04:01 GMT
> The first box was defined to have 2 rows and it has 4 so what gives?
'GridLayout'..
As I mentioned briefly before, you are (I was not sure then)
'fighting' against a Layout that does not do what you want.
GridLayout always assigns *equal* size to components, this
takes precedence over the component's *preferred* size.
It is important to understand that Java uses Layout Managers
for very good reasons - they take a little getting used to,
but once you get the hang of them you will be able to get
the look and shape you need for your GUI, exactly as the
end user needs.
Have a look at this page, which explains it far better than I
can (with pics.'n'all!) on usenet. See if you can find a layout,
or *combination* of layouts (you can nest them) that suits your GUI.
<http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/shortcourse.html>
HTH

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
You Can't Prove It Won't Happen
Brandon McCombs - 15 Jul 2005 04:30 GMT
> > The first box was defined to have 2 rows and it has 4 so what gives?
>
[quoted text clipped - 16 lines]
> or *combination* of layouts (you can nest them) that suits your GUI.
> <http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/shortcourse.html>
As I mentioned in my 2nd post from the original thread, I'm in the process of
switching to gridbaglayout (and since I'm not done that is why the example code I
sent was using gridbag) but I'm experiencing the same issues. In fact, to "solve"
the problem I had to end up using ipadx and ipady methods to resize the text boxes
to get them to a certain size. I've found out that the ipad[x,y] can override what
the row count is supposed to be and render it useless, although I've found the row
count variable to already be useless. Anyway, so far the issue in my mind hasn't
been solved and I still consider the row count to be useless as the textareas dont
obey it upon initially being drawn and the row count can be overridden using
ipad[x,y]. The only thing I think I solved correctly was that when using
gridbaglayout I could keep pressing Enter within one of the textareas and it would
end up getting resized on the fly so much that it would push the other text area off
the edge of the window and I solved that by putting both text areas into
scrollpanes.
I'll read the site in case it sheds any more light onto the situation but I've
already looked at the tutorial for the gridbaglayout.
I think an easy way for me to get closure on this subject is to ask, have you ever
had this problem before (as in, w/o doing anything extra can you get a textarea to
be drawn with the correct number of rows that you specify in the constructor?) and
how do you solve the issue,by doing something extra, when it comes to that (using
another layout manager)? If your answer is to use a layout manager then I have to
say that the row count is indeed useless. Agree with me on that will ya? lol
Andrew Thompson - 15 Jul 2005 07:42 GMT
> If your answer is to use a layout manager then I have to
> say that the row count is indeed useless. Agree with me on that will ya? lol
Sure it's not. If a layout asks for a component's *preferred*
size, as in FlowLayout, the Layout will size the component the
size it wants to be.
Unfortunately though, I get the sense that something still has
not 'clicked' with you in terms of Java layouts.
..Do you yet understand *why* Java uses Layouts, rather than
encouraging you to drag this widget onto your UI, then
drag another one 2 pixels to the right of that widget?
Out of curiosity, what other languages have you written?
( Don't be afraid to say 'none', but I get the impression
you have programmed other languages. )

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
In Hypno-Vision
Brandon McCombs - 16 Jul 2005 06:21 GMT
> > If your answer is to use a layout manager then I have to
> > say that the row count is indeed useless. Agree with me on that will ya? lol
[quoted text clipped - 9 lines]
> encouraging you to drag this widget onto your UI, then
> drag another one 2 pixels to the right of that widget?
I assume it's to try to take the dirty work away from you and focus on layout and
relative placement instead of exact placement.
> Out of curiosity, what other languages have you written?
> ( Don't be afraid to say 'none', but I get the impression
> you have programmed other languages. )
I've done no other GUI programming(except a little GTK+/Linux) but I've done C,
C++, and I had a class on Ada recently that I didn't like.
Andrew Thompson - 16 Jul 2005 14:07 GMT
>>> If your answer is to use a layout manager then I have to
>>> say that the row count is indeed useless. Agree with me on that will ya? lol
[quoted text clipped - 12 lines]
> I assume it's to try to take the dirty work away from you and focus on layout and
> relative placement instead of exact placement.
Thatr is partly it. The thing is, you cna never be sure
how *big* anything is - fonts, boreder insets, menu items.
whatever.. will change in size between different users,
screeen sizes, default fonst, PLAF's ..even the Java
version if Sun decieds to 'tweak' a PLAF between one
release and the next.
Layouts take care of that, pretty much as you stated,
but the reasons are more than Sun wanting you to think
that way - it is simply *necessary* in order to create
a GUI that will be x-plat, and robust through the ..ages,
versions, PLAF's..
>> Out of curiosity, what other languages have you written?
>> ( Don't be afraid to say 'none', but I get the impression
>> you have programmed other languages. )
>
> I've done no other GUI programming(except a little GTK+/Linux) but I've done C,
> C++, and I had a class on Ada recently that I didn't like.
Did the GTK+/Linux GUI programming (that is what I am most
interested in) allow exact positioning*?
[ * I would not be surprised if it did, I suspect the
Sun/Java approach to layouts is rather unusual! ]

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Filmed on Location
Brandon McCombs - 19 Jul 2005 04:35 GMT
> >>> If your answer is to use a layout manager then I have to
> >>> say that the row count is indeed useless. Agree with me on that will ya? lol
[quoted text clipped - 35 lines]
> Did the GTK+/Linux GUI programming (that is what I am most
> interested in) allow exact positioning*?
It's been too long for me to remember. If I had to guess I'd say no. The only thing I
remember is that there were horizontal and vertical containers to use for holding
widgets and there was a table container that could be used to layout widgets in a grid
format and you weren't confined to having widgets added right after another like you
are with the Java gridlayout (you could skip locations in the grid to put spaces in
between buttons and such). You could actaully specify the coordinates and it was
simpler than gridbaglayout and more useful than java's gridlayout. I guess that could
be considered the exact placement you mention below.
> [ * I would not be surprised if it did, I suspect the
> Sun/Java approach to layouts is rather unusual! ]
Monique Y. Mudama - 15 Jul 2005 04:03 GMT
[snip]
>> - *you* stopped posting,
>
[quoted text clipped - 8 lines]
> no one else did, you are right, and i responded to yoru request, but
> somehow it got lost in the mail. But anyway....
[snip]
A lot of news servers reject messages with attachments posted to
non-binary newsgroups. That's probably what happened here. The best
thing to do is to include a link to a screenshot.

Signature
monique
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Andrew Thompson - 15 Jul 2005 04:08 GMT
> Sorry for including a screenshot in the actual mesg...
(Fortunately) it did not get posted along with the message.
In fact, that may have been the problem getting the message through.
Many groups do not welcome 'binaries' such as images, exes,
mp3s and such, and many news servers will automatically
strip any and all attachments for any such groups. My own
ISP does it for me, free and automatically - one of the
few good things about it.
None of the comp.lang.java.* groups welcome binaries.
A better way to do it is to put the screenshot (reduced to
16 colors, preferably) and Java code at a free site and link
to a simple page that links to/includes both.
This is a little more effort for you, but it allows those
who want/need to see the scresnshot to get at it easily,
while saving the bandwidth for other members of the group.

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
== Proudly Made On Earth ==
Brandon McCombs - 15 Jul 2005 04:31 GMT
> > Sorry for including a screenshot in the actual mesg...
>
> (Fortunately) it did not get posted along with the message.
> In fact, that may have been the problem getting the message through.
well it got far enough to be visible from my news server and I can still
view the message with the screenshot intact but i guess the actual
java.gui server didn't want to replicate it.