Coverage Report - net.miginfocom.examples.BugTestApp
 
Classes in this File Line Coverage Branch Coverage Complexity
BugTestApp
N/A
N/A
1.25
BugTestApp$1
N/A
N/A
1.25
 
 1  
 package net.miginfocom.examples;
 2  
 
 3  
 import net.miginfocom.swing.MigLayout;
 4  
 
 5  
 import javax.swing.*;
 6  
 import java.awt.*;
 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  
 
 41  
 /**
 42  
  * @author Mikael Grev, MiG InfoCom AB
 43  
  *         Date: Dec 15, 2008
 44  
  *         Time: 7:04:50 PM
 45  
  */
 46  
 public class BugTestApp
 47  
 {
 48  
         private static JPanel createPanel()
 49  
         {
 50  
                 JPanel c = new JPanel();
 51  
                 c.setBackground(new Color(200, 255, 200));
 52  
                 c.setLayout(new MigLayout("debug"));
 53  
 
 54  
                 JLabel lab = new JLabel("Qwerty");
 55  
                 lab.setFont(lab.getFont().deriveFont(30f));
 56  
                 c.add(lab, "pos 0%+5 0%+5 50%-5  50%-5");
 57  
                 c.add(new JTextField("Qwerty"));
 58  
 
 59  
                 JFrame f = new JFrame();
 60  
                 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 61  
                 f.setLayout(new MigLayout());
 62  
                 f.add(c, "w 400, h 100");
 63  
                 f.setLocationRelativeTo(null);
 64  
                 f.pack();
 65  
                 f.setVisible(true);
 66  
                 return null;
 67  
         }
 68  
 
 69  
         private static JPanel createPanel2()
 70  
         {
 71  
                 JFrame tst = new JFrame();
 72  
                 tst.setLayout(new MigLayout("debug, fillx","",""));
 73  
 
 74  
                 tst.add(new JTextField(),"span 2, grow, wrap");
 75  
                 tst.add(new JTextField(10));
 76  
                 tst.add(new JLabel("End"));
 77  
 
 78  
                 tst.setSize(600, 400);
 79  
                 tst.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 80  
                 tst.setVisible(true);
 81  
                 return null;
 82  
         }
 83  
 
 84  
         public static void main(String[] args)
 85  
         {
 86  
                 SwingUtilities.invokeLater(new Runnable() {
 87  
                         public void run() {
 88  
                                 try {
 89  
                                         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
 90  
                                 } catch (Exception ex) {
 91  
                                         ex.printStackTrace();
 92  
                                 }
 93  
 
 94  
                                 createPanel();
 95  
 
 96  
 //                                JFrame frame = new JFrame("Bug Test App");
 97  
 //                                frame.getContentPane().add(createPanel2());
 98  
 //                                frame.pack();
 99  
 //                                frame.setLocationRelativeTo(null);
 100  
 //                                frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 101  
 //                                frame.setVisible(true);
 102  
                         }
 103  
                 });
 104  
         }
 105  
 }