|
|
Newbi to swing, need layout knowledge
I have been using java for years, now I need to go gui work. I am
having a Dickens of a time trying to grasp the swing layout managers,
specifically how to control placement on screen.
I am not looking for an IDE, but want to gain a better understanding
of the mechanics of how the layout managers "decide" to layout
components. Most references I have found only parrot what the API
javadocs , which are terse as best.
Does anyone have real world examples of laying out java swing UIs?
I am sure I will be flamed for this general, newbie question, assuming
somewhere on this group this question has been asked and answered.
Sorry in advance.
cj
|
|
0
|
|
|
|
Reply
|
spambox1 (50)
|
9/1/2007 1:37:15 PM |
|
CJ wrote:
> I have been using java for years, now I need to go gui work. I am
> having a Dickens of a time trying to grasp the swing layout managers,
> specifically how to control placement on screen.
>
> I am not looking for an IDE, but want to gain a better understanding
> of the mechanics of how the layout managers "decide" to layout
> components. Most references I have found only parrot what the API
> javadocs , which are terse as best.
>
> Does anyone have real world examples of laying out java swing UIs?
>
There's some tutorials at Sun's website
http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html
In my view, the easist way to start is to use nested combinations of
BorderLayout, FlowLayout, BoxLayout and GridLayout. For an awful lot of
applications that may be all you need.
Use the centre of a borderlayout for components that you want to take as
much space as is available - e.g. a JTextArea for an editor.
Note that different layout managers will make differing use of the
preferred/min/max sizes of the components they contain. Some layout
managers will ignore one or other of these. This isn't clearly
documented in my view.
Save learning GridBagLayout for last - I think it's pretty fearsome.
In my view, rather than use GridBagLayout, it is better to use a third
party layout manager like Karsten Lentsch's JGoodies FormLayout.
Personally I prefer MigLayout.
Note that many experts will disagree with me and say that GridBagLayout
is one that you should learn. YMMV.
|
|
0
|
|
|
|
Reply
|
RedGrittyBrick
|
9/1/2007 7:39:57 PM
|
|
On Sat, 01 Sep 2007 06:37:15 -0700, CJ <spambox1@mindspring.com>
wrote, quoted or indirectly quoted someone who said :
>I have been using java for years, now I need to go gui work. I am
>having a Dickens of a time trying to grasp the swing layout managers,
>specifically how to control placement on screen.
See http://mindprod.com/jgloss/layout.html
and follow links for tips.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
|
|
0
|
|
|
|
Reply
|
Roedy
|
9/2/2007 10:51:18 AM
|
|
|
2 Replies
118 Views
(page loaded in 0.722 seconds)
Similiar Articles: Increasing height of Tabs in JTabbedPane - comp.lang.java.gui ...... touch screen based application in Swing in which i need to place a ... Newbie: Prevent stretching of widgets when using ... 2) Increase the available size of your layout by ... [Eclipse] How to fix indentations. - comp.lang.java.help ...... evt); } }); javax.swing.GroupLayout layout = new javax.swing ... I don't mind the effort if I can gain some knowledge ... Pseudo Silk Kimono wrote: .... > You may need to ... Sampling: What Nyquist Didn't Say, and What to Do About It - comp ...(you also need to consider which PDF version you ... It *really* complicates layout. You end up having to ... It is not a training or electronics education, something ... Using C and Assembly code: 64Bit Calling convention - comp.lang ...As for the prologue, I don't get why I need the first ... It requires some knowledge about a machine to use it ... Are newbie questions OK in here? - comp.lang.asm.x86 ... microblaze spi core problem - comp.arch.fpgaYou need a timer in your system that you can watch to ... com TRW Conekt - Consultancy in Engineering, Knowledge ... FPGA module, XPS, microblaze, verilog ... and layout OK ... Freescale's Idea of Open Source JTAG - comp.arch.embedded ...... multi- vendor presentation is not a wealth of knowledge. ... :( Someday I need to learn how to build and use the ... Newbie's first FPGA board ! - comp.arch.fpga FPGA ... top 10 uses for random data compression?? anyone? - comp ...If the illegal layouts can drain on, the accessible burial ... Others nearly swing. We become them, then we exactly ... Little by little, landlords need in view of governing ... FREE CALENDAR - comp.parallel.mpi... calendar downloads create free february calendar free school calendars education ... free print free monthly calendars free calendar code free calendar layouts ... Need help with basic Java (Newbie)Need help with basic Java (Newbie) ... javax.swing.GroupLayout layout = new javax.swing ... A basic knowledge of Java fundamentals is ... How to Use SpringLayout (The Java™ Tutorials > Creating a GUI ...Depending on the constraints you use, you may also need to set ... layout treats labels and text fields differently, spring layout has no special knowledge of any Swing or ... 7/12/2012 10:28:05 PM
|
|
|
|
|
|
|
|
|