Advertisement
Guest User

Untitled

a guest
Sep 8th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. public class PanelWLabels {
  2.  
  3.     private JFrame frame;
  4.  
  5.     /**
  6.      * Launch the application.
  7.      */
  8.     public static void main(String[] args) {
  9.         EventQueue.invokeLater(new Runnable() {
  10.             public void run() {
  11.                 try {
  12.                     PanelWLabels window = new PanelWLabels();
  13.                     window.frame.setVisible(true);
  14.                 } catch (Exception e) {
  15.                     e.printStackTrace();
  16.                 }
  17.             }
  18.         });
  19.     }
  20.  
  21.     /**
  22.      * Create the application.
  23.      */
  24.     public PanelWLabels() {
  25.         initialize();
  26.     }
  27.  
  28.     /**
  29.      * Initialize the contents of the frame.
  30.      */
  31.     private void initialize() {
  32.         frame = new JFrame();
  33.         frame.setBounds(100, 100, 450, 300);
  34.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  35.        
  36.         JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
  37.         frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
  38.        
  39.         JScrollPane scrollPane = new JScrollPane();
  40.         tabbedPane.addTab("New tab", null, scrollPane, null);
  41.        
  42.         JPanel panel = new JPanel();
  43.         scrollPane.setViewportView(panel);
  44.         panel.setLayout(new MigLayout("", "[][][][][][]", "[][][][]"));
  45.        
  46.         JLabel label = new JLabel("New label");
  47.         panel.add(label, "cell 0 0");
  48.        
  49.         JLabel lblNewLabel_1 = new JLabel("New label");
  50.         panel.add(lblNewLabel_1, "cell 5 1");
  51.        
  52.         JLabel lblNewLabel = new JLabel("New label");
  53.         panel.add(lblNewLabel, "cell 2 3");
  54.        
  55.     }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement