Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2240

Re: GroupLayout problem,

From "hiwa" <hiwa@THRWHITE.remove-dii-this>
Subject Re: GroupLayout problem,
Message-ID <1187179060.063613.31160@i13g2000prf.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <76b81edcb6545@uwe>
Date 2011-04-27 15:37 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On Aug 15, 3:44 pm, "Andrew Thompson" <u32984@uwe> wrote:
> hiwa wrote:
>
> ..
>
> >Yes, I am the man who translates cljg GUI FAQ in Japanese. :)
>
> (chuckles) I hate to admit this, but despite knowing
> you so long, and so 'well' (through our conversations
> on usenet) but now is the first moment I could identify
> you as a 'man' rather than simply a 'person'!
>
> I had always been very careful to refer to you as
> 'hiwa' or 'the last poster' or using other, non gender
> specific references to you, or things you wrote.
>
> Of course, it is always a good idea to not jump to
> conclusions, and refer to people generically.
> After all, it is all about *what* they say, rather
> than *who* (other people might think) they are*.
>
> Hope the OP has more luck with your code..
>
> * And as an aside, I am a (male) 'Jack Russell' Terrier
> .but don't hassle me about it, or I'll bite ya'.   ;-)
>
> --
> Andrew Thompsonhttp://www.athompson.info/andrew/
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-gui/200708/1

Yes. I hate the word 'man' but I couldn't think of the word 'person'
then. Now I regret that.

Below is an improved version of the GroupLayout test program in which
we add not only components but group of groups on the main layout
group. I think this is the powerfull feature of the new layout
manager.
-----------------------------------------------
import java.awt.*;
import javax.swing.*;

public class TestGroupLayoutZ extends JPanel {
  JButton button;
  JCheckBox check;
  JComboBox combo1, combo2;
  JLabel jLabel1, jLabel2, jLabel3;
  JSpinner spinner;

  public TestGroupLayoutZ() {
    init();
  }

  private void init() {
    jLabel1 = new JLabel("l1");
    combo1 = new JComboBox();
    jLabel2 = new JLabel("l2");
    combo2 = new JComboBox();
    jLabel3 = new JLabel("l3");
    spinner = new JSpinner();
    check = new JCheckBox("check");
    button = new JButton("bouton");

    org.jdesktop.layout.GroupLayout layout
      = new org.jdesktop.layout.GroupLayout(this);
    setLayout(layout);

    /* make group of groups that occupy the same X loc as checkbox and
     * button */
    org.jdesktop.layout.GroupLayout.ParallelGroup hsubGroup
      = layout.createParallelGroup();
 
hsubGroup.add(layout.createSequentialGroup().add(jLabel1).add(combo1)).
      add(layout.createSequentialGroup().add(jLabel2).add(combo2)).
      add(layout.createSequentialGroup().add(jLabel3).add(spinner));

    /* horizontally, only one loc, but there's a subgroup above */
    org.jdesktop.layout.GroupLayout.SequentialGroup hGroup
      = layout.createSequentialGroup();
    // use group of groups created above to place on a same X loc
    hGroup.add
 
(layout.createParallelGroup().add(check).add(hsubGroup).add(button));
    layout.setHorizontalGroup(hGroup);

    /* vertically, mix of one loc and two locs */
    org.jdesktop.layout.GroupLayout.SequentialGroup vGroup
      = layout.createSequentialGroup();
    vGroup.add(layout.createSequentialGroup().add(check)).  // one loc
 
add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).
          add(jLabel1).add(combo1)). // two locs
 
add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).
          add(jLabel2).add(combo2)).
 
add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).
          add(jLabel3).add(spinner)).
 
add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).
          add(button)); // again one loc
    layout.setVerticalGroup(vGroup);
  }

  public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
      public void run() {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        f.setContentPane(new TestGroupLayoutZ());
        f.pack();
        f.setVisible(true);
      }
    });
  }
}
-----------------------------------------------

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

GroupLayout problem, jbut "Kaiser S." <kaiser.s.@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
  Re: GroupLayout problem, "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
    Re: GroupLayout problem, "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
      Re: GroupLayout problem, "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
        Re: GroupLayout problem, "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
  Re: GroupLayout problem, "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
    Re: GroupLayout problem, "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
      Re: GroupLayout problem, "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
        Re: GroupLayout problem, "Kaiser S." <kaiser.s.@THRWHITE.remove-dii-this> - 2011-04-27 15:38 +0000
          Re: GroupLayout problem, "Kaiser S." <kaiser.s.@THRWHITE.remove-dii-this> - 2011-04-27 15:38 +0000
            Re: GroupLayout problem, "hiwa" <hiwa@THRWHITE.remove-dii-this> - 2011-04-27 15:38 +0000

csiph-web