🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.java.programmer
5 messages
5 total messages Started by Luis Hernandez Wed, 21 Jul 1999 00:00
help with applet layout!
#205
Author: Luis Hernandez
Date: Wed, 21 Jul 1999 00:00
16 lines
1918 bytes
I've been programming in Java for two years now, but it was mostly in
unix command line. Now I'm moving into applets, and I'm having trouble
with laying out my applets. Any resources that would be helpful for an
applet programmer for layout?
Specific questions:
With FlowLayout, is there any type of command to make the layout process
go to the next line and continue layoung out the additional components?
For example, if I wanted a button on one line, and the next button on
the next line, what is the easiest way to make flow layout to do it?
Also, if I create a new layout manager, how do I set it so that the
applet takes on that layout manager? I tried
setLayourManager(LayoutManager);  but it didn't do anything, all the
components added to that manager didn't display.

Thanks for any help,
Luis
Re: help with applet layout!
#206
Author: Silent Knight
Date: Thu, 22 Jul 1999 00:00
39 lines
2412 bytes
> With FlowLayout, is there any type of command to make the layout
process
> go to the next line and continue layoung out the additional
components?
> For example, if I wanted a button on one line, and the next button on
> the next line, what is the easiest way to make flow layout to do it?

I think the point of FlowLayout is that the container decides for itself
how to layout the components ... if you want more control you should use
a different layout manager, eg. GridLayout(1,2) will do what you want.
Also, you can do some pretty complex layouts if you use GridBagLayout.

If you were set on FlowLayout, I guess you could get some control over
the arrangement in a FlowLayout by setting the size of the container
(the applet here).

> Also, if I create a new layout manager, how do I set it so that the
> applet takes on that layout manager? I tried
> setLayourManager(LayoutManager);  but it didn't do anything, all the
> components added to that manager didn't display.
>

The container method 'setLayout' is used to set the layout manager.

Also, You should be adding components to the applet rather than to the
manager.

  applet.setLayout ( new FlowLayout() ); // default anyway i think
  applet.add ( component );

Cheers,

Silent Knight.



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Re: help with applet layout!
#207
Author: Matt
Date: Thu, 22 Jul 1999 00:00
25 lines
2220 bytes
As far as getting some buttons on one line, and others on another.  I would
use a GridLayout instead of a FlowLayout.  To get the buttons to look right,
add them to a Panel first, then add the Panel to the layout.  Try the same
thing as far as getting the stuff to appear in the applet.
Hope this helps,
Matt

Luis Hernandez wrote:

> I've been programming in Java for two years now, but it was mostly in
> unix command line. Now I'm moving into applets, and I'm having trouble
> with laying out my applets. Any resources that would be helpful for an
> applet programmer for layout?
> Specific questions:
> With FlowLayout, is there any type of command to make the layout process
> go to the next line and continue layoung out the additional components?
> For example, if I wanted a button on one line, and the next button on
> the next line, what is the easiest way to make flow layout to do it?
> Also, if I create a new layout manager, how do I set it so that the
> applet takes on that layout manager? I tried
> setLayourManager(LayoutManager);  but it didn't do anything, all the
> components added to that manager didn't display.
>
> Thanks for any help,
> Luis
Re: help with applet layout!
#208
Author: KhAiReEl
Date: Sat, 24 Jul 1999 00:00
29 lines
2254 bytes
I have had that problem too. But then I decided to do away with the whole
Layout stuffs and just be creative and calculative on my own.

I used the following commands on paint() :
1) component.setLocation(int x1, int y1)
2) component.reshape(int x1, int y1, int width, int height), or
    component.setBounds(int x1, int y1, int width, int height).


Luis Hernandez <lmhernan@unix.amherst.edu> wrote in message
news:37968D90.C39CE214@unix.amherst.edu...
> I've been programming in Java for two years now, but it was mostly in
> unix command line. Now I'm moving into applets, and I'm having trouble
> with laying out my applets. Any resources that would be helpful for an
> applet programmer for layout?
> Specific questions:
> With FlowLayout, is there any type of command to make the layout process
> go to the next line and continue layoung out the additional components?
> For example, if I wanted a button on one line, and the next button on
> the next line, what is the easiest way to make flow layout to do it?
> Also, if I create a new layout manager, how do I set it so that the
> applet takes on that layout manager? I tried
> setLayourManager(LayoutManager);  but it didn't do anything, all the
> components added to that manager didn't display.
>
> Thanks for any help,
> Luis
>
>
Re: help with applet layout!
#209
Author: Jonas Olsson
Date: Mon, 26 Jul 1999 00:00
21 lines
1908 bytes
Being "creative and calculative" in this way throws portability out the
window. I think it's important to acknowledge all parts of portabilirt,
not just platform-independence. Fixed sized components is like the "best
viewed at 800x600" on web-pages: an attempt at controlling the target
environment. In Java you just shouldn't. There's enough support for
portability to "roll with the punches" in a proper GUI. Not only
component sizes and layouts, but also languages and keyboard navigation
(to name a few).

/jonas

KhAiReEl wrote:
> 
> I have had that problem too. But then I decided to do away with the whole
> Layout stuffs and just be creative and calculative on my own.
> 
> I used the following commands on paint() :
> 1) component.setLocation(int x1, int y1)
> 2) component.reshape(int x1, int y1, int width, int height), or
>     component.setBounds(int x1, int y1, int width, int height).
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads