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


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

Re: Using panels

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Subject Re: Using panels
Message-ID <71a7febeb54bc@uwe> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <thw_h.112005$cJ1.110482@newsfe13.lga>
References <thw_h.112005$cJ1.110482@newsfe13.lga>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 133
Date Wed, 27 Apr 2011 15:34:06 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303918446 96.60.20.240 (Wed, 27 Apr 2011 10:34:06 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:34:06 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1573

Show key headers only | View raw


  To: comp.lang.java.gui
Knute Johnson wrote:
>>> .
>>>> Unfortunately when I add a panel to the panel that sits in the split pane
.
>> ...Now we have two complete messages devoted to a few lines of
>> extra code in the classes.  
>
>I don't know what Andrew is using for a reader but in Thunderbird it is 
>almost impossible to read your code after the signature.  

Oops!  My 'software' (a certain OS component using a 
web interface to usenet) *hides* sigs. with a little '+'
to exapnd them - I fogot to check under the sig., and
did not see the code..
..
>Your program is not as simple as it really needs ...

Too true.  Here is my simplified version..
<sscce>
import java.awt.*;
import javax.swing.*;

public class PanelTest extends JFrame {

   /** Creates new form PanelTest */
   public PanelTest() {
       initComponents();

       validate();
   }

   private void initComponents() {
       setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

      Container c = getContentPane();

      JSplitPane jSplitPane1 = new
         JSplitPane(
         JSplitPane.HORIZONTAL_SPLIT,
         new JLabel("left"),
            new ChoreHeaderPanel());

       c.setLayout(new BorderLayout());
       c.add( jSplitPane1, BorderLayout.CENTER );

       pack();
   }

   public static void main(String args[]) {
       EventQueue.invokeLater(new Runnable() {
           public void run() {
               new PanelTest().setVisible(true);
           }
       });
   }
}

class ChoreHeaderPanel extends JPanel {

   public ChoreHeaderPanel() {
       initComponents();
   }

   private void initComponents() {
       jLabel1 = new JLabel();
       jLabel2 = new JLabel();
       jLabel3 = new JLabel();

       setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0)));
       setMinimumSize(new Dimension(100, 35));
       jLabel1.setText("Chores");

       jLabel2.setText("Red");

       jLabel3.setText("White");

       GroupLayout layout = new GroupLayout(this);
       this.setLayout(layout);
       layout.setHorizontalGroup(
           layout.createParallelGroup(GroupLayout.Alignment.LEADING)
           .addGroup(layout.createSequentialGroup()
               .addContainerGap()
               .addComponent(jLabel1,
                  GroupLayout.PREFERRED_SIZE,
                  76,
                  GroupLayout.PREFERRED_SIZE)
               .addGap(50, 50, 50)
               .addComponent(jLabel2,
                  GroupLayout.PREFERRED_SIZE,
                  37,
                  GroupLayout.PREFERRED_SIZE)
               .addGap(0, 0, 0)
               .addComponent(jLabel3)
               .addContainerGap(304, Short.MAX_VALUE))
       );
       layout.setVerticalGroup(
           layout.createParallelGroup(GroupLayout.Alignment.LEADING)
           .addGroup(layout.createSequentialGroup()
               .addGroup(layout.createParallelGroup(GroupLayout.Alignment.
BASELINE)
                   .addComponent(jLabel2)
                   .addComponent(jLabel3)
                   .addComponent(jLabel1))
               .addContainerGap(18, Short.MAX_VALUE))
       );
   }// </editor-fold>

   private JLabel jLabel1;
   private JLabel jLabel2;
   private JLabel jLabel3;
}
</sscce>

.and.  What was the question again?
The main problem seemed to be all those dang
GroupLayouts - I don't know what you intend putting 
into the split pane panels, but I think you need to
get each root component validated and on-screen 
seperately, before trying to put it in a further layout
that goes into the split pane!

-- 
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200705/1

---
 * 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

Using panels "Kenneth P. Turvey" <kenneth.p..turvey@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
  Re: Using panels "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
    Re: Using panels "Kenneth P. Turvey" <kenneth.p..turvey@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
      Re: Using panels "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
        Re: Using panels "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
          Re: Using panels "Kenneth P. Turvey" <kenneth.p..turvey@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
        Re: Using panels "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
        Re: Using panels "Kenneth P. Turvey" <kenneth.p..turvey@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000

csiph-web