Here is my example.jelly that uses GridBagLayout. I spent a while on it so
I thought I would send it.

Another question, how do you embed an image? Is there an image tag? I
could not find anything on this in the docs or in the archives.

Thanks,
Dave

<?xml version="1.0"?>
<j:jelly 
        xmlns:j="jelly:core" 
        xmlns="jelly:swing" 
        xmlns:log="jelly:log"
        xmlns:define="jelly:define">

  <action var="fooAction" name="Foo" tooltip="some text">
        <log:info>Just evaluated the foo action!</log:info>
  </action>

  <font var="bigfont" name="helvetica" family="helvetica" size="${20}"/>

        <define:script var="onClosing">
    <log:info>The frame is closing via event: ${event}</log:info>
  </define:script>
  
  <frame title="This is a frame" var="frame" location="100,100" size="800,400">
        <font family="helvetica" size="14"/>
    <menuBar>
      <menu text="File">
        <menuItem>
          <action name="New">
                <log:info>clicked on the New menu item!</log:info>
          </action>
        </menuItem>
        <menuItem>
          <action name="Open">
                <log:info>Popup a file dialog!</log:info>
          </action>
        </menuItem>
        <menuItem text="Save" enabled="false" />
        <separator/>
        <menuItem text="Properties" font="${bigfont}"/>
        <menuItem action="${fooAction}"/>
      </menu>
      <menu text="Demo">
        <menuItem>
          <action name="GridBagLayout demo">
                <log:info>about to run the GridBagLayout demo...</log:info>
                <j:include uri="gridBagDemo.jelly"/>
          </action>
        </menuItem>
      </menu>
      <menu text="Run">
        <menuItem>
          <action name="Run a Jelly script">
                <log:info>about to open the Jelly script runner...</log:info>
                <j:include uri="run.jelly"/>
          </action>
        </menuItem>
      </menu>
      <menu text="Help">
        <menuItem>
          <action name="About">
                <log:info>about to display the about dialog...</log:info>
                <j:include uri="about.jelly"/>
          </action>
        </menuItem>
      </menu>
    </menuBar>
    
    
    <!--<gbc gridx="0" gridy="0">
      <panel>
        <titledBorder title="Sample Border Title"/>
        
        <gridBagLayout>
                        <gbc gridx="0" gridy="0">
                                <label text="Name"/>
                                </gbc>
                                <gbc gridx="1" gridy="0">
                                <textField text="James"/>
                                </gbc>
                                <gbc gridx="0" gridy="1">
                                <label text="Location"/>
                                </gbc>
                                <gbc gridx="1" gridy="1">
                                <textField text="London"/>
                                </gbc>
                                
                                <gbc gridx="0" gridy="2">
                                <panel>
                                        <button>
                                          <action name="OK">
                                                <log:info>Clicked on the OK 
button</log:info>
                                          </action>
                                        </button>
                                        <button action="${fooAction}"/>
                                </panel>
                                </gbc>
        </gridBagLayout>
      </panel>
      </gbc>-->
      
      <!--<gridBagLayout>
      
      
      
      <gbc gridx="0" gridy="0" fill="both" weightx="1.0" weighty="1.0" >
      
      
      <titledBorder title="Sample Border Title"/>-->
      
      <panel>
      <gridBagLayout>
        <gbc gridx="0" gridy="0" gridwidth="1" anchor="north" weightx="3" weighty=".5" 
fill="both">
        
        <splitPane>
        <panel>
        <titledBorder title="Sample Border Title"/>
        <gridBagLayout>
                <gbc gridx="0" gridy="0" anchor="north" weightx="0" weighty="0" 
fill="horizontal">
                                <label text="Name"/>
                                </gbc>
                                <gbc gridx="2" gridy="0" weightx="1" gridwidth="2" 
weighty="0" fill="horizontal" anchor="north">
                                <textField text="James"/>
                                </gbc>
                                        
                                        
                                        <gbc gridx="0" gridy="1" anchor="north" 
weightx="0" weighty="0" fill="horizontal">
                                <label text="Location"/>
                                </gbc>
                                <gbc gridx="2" gridy="1" weightx="1" gridwidth="2" 
fill="horizontal" anchor="north" weighty="0">
                                <textField text="London"/>
                                </gbc>
                                <gbc gridx="0" gridy="2" anchor="north" weightx="0" 
weighty="1">
                                        <button>
                                          <action name="OK">
                                                <log:info>Clicked on the OK 
button</log:info>
                                          </action>
                                        </button>
                                        </gbc>
                                        <gbc gridx="1" gridy="2" gridwidth="2" 
fill="none" align="west" anchor="north" weighty="0">
                                        <button action="${fooAction}"/>
                                        </gbc>
                        </gridBagLayout>
                        </panel>
        <panel>
        <gridBagLayout>
        <gbc gridx="1" gridy="0" fill="both" weightx="1" weighty="1">
      <scrollPane>
      
      
        <!-- this tag can set properties on the bean model too -->
        <j:useBean var="tableModel" 
class="org.apache.commons.jelly.swing.MyTableModel"/>
        <table model="${tableModel}"/>
        
        
      </scrollPane>
      </gbc>
      </gridBagLayout>
      </panel>
      
      
      
      
      </splitPane>
      
      
      
      </gbc>
      </gridBagLayout>
      </panel>
      
      
        
    
    <windowListener var="event" closing="${onClosing}"/>
  </frame>
  
  ${frame.show()}
  
</j:jelly>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to