Coverage Report - net.miginfocom.examples.ExampleGood
 
Classes in this File Line Coverage Branch Coverage Complexity
ExampleGood
N/A
N/A
2.5
 
 1  
 package net.miginfocom.examples;
 2  
 
 3  
 import net.miginfocom.swt.MigLayout;
 4  
 import org.eclipse.swt.SWT;
 5  
 import org.eclipse.swt.widgets.*;
 6  
 
 7  
 /*
 8  
  * License (BSD):
 9  
  * ==============
 10  
  *
 11  
  * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (miglayout (at) miginfocom (dot) com)
 12  
  * All rights reserved.
 13  
  *
 14  
  * Redistribution and use in source and binary forms, with or without modification,
 15  
  * are permitted provided that the following conditions are met:
 16  
  * Redistributions of source code must retain the above copyright notice, this list
 17  
  * of conditions and the following disclaimer.
 18  
  * Redistributions in binary form must reproduce the above copyright notice, this
 19  
  * list of conditions and the following disclaimer in the documentation and/or other
 20  
  * materials provided with the distribution.
 21  
  * Neither the name of the MiG InfoCom AB nor the names of its contributors may be
 22  
  * used to endorse or promote products derived from this software without specific
 23  
  * prior written permission.
 24  
  *
 25  
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 26  
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 27  
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 28  
  * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 29  
  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 30  
  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 31  
  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 32  
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 33  
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
 34  
  * OF SUCH DAMAGE.
 35  
  *
 36  
  * @version 1.0
 37  
  * @author Mikael Grev, MiG InfoCom AB
 38  
  *         Date: 2006-sep-08
 39  
  */
 40  
 public class ExampleGood
 41  
 {
 42  
         protected void buildControls(Composite parent)
 43  
         {
 44  
                 parent.setLayout(new MigLayout("inset 0", "[fill, grow]", "[fill, grow]"));
 45  
 
 46  
                 Table table = new Table(parent, SWT.BORDER|SWT.H_SCROLL|SWT.V_SCROLL);
 47  
                 table.setLayoutData("id table, hmin 100, wmin 300");
 48  
                 table.setHeaderVisible(true);
 49  
                 table.setLinesVisible(true);
 50  
 
 51  
                 Label statusLabel = new Label(parent, SWT.BORDER);
 52  
                 statusLabel.setText("Label Text");
 53  
                 statusLabel.moveAbove(null);
 54  
                 statusLabel.setLayoutData("pos 0 0");
 55  
 
 56  
                 for (int i = 0; i < 10; i++)
 57  
                 {
 58  
                         TableItem ti = new TableItem(table, SWT.NONE);
 59  
                         ti.setText("item #" + i);
 60  
                 }
 61  
         }
 62  
 
 63  
         public static void main(String[] args)
 64  
         {
 65  
                 final Display display = new Display();
 66  
                 final Shell shell = new Shell(display);
 67  
                 new ExampleGood().buildControls(shell);
 68  
                 shell.open();
 69  
                 while (!shell.isDisposed())
 70  
                 {
 71  
                         if (!display.readAndDispatch())
 72  
                                 display.sleep();
 73  
                 }
 74  
                 display.dispose();
 75  
         }
 76  
 }