Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: Java  |  size: 0.59 KB  |  hits: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4. import javax.*;
  5.  
  6.  
  7. public class swing {
  8.  
  9.         public static void main (String[] args){
  10.                 JFrame frame = new JFrame ("Test");
  11.                 frame.setSize(500,500);
  12.                 frame.setVisible(true);
  13.                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  14.                 JPanel panel = new JPanel (new GridBagLayout());
  15.                 frame.add(panel);
  16.                 GridBagConstraints c = new GridBagConstraints();
  17.                 frame.getContentPane().add(panel,BorderLayout.NORTH);
  18.                 JLabel label1 = new JLabel ("Test1");
  19.                 c.gridx = 1;
  20.                 c.gridy = 0;
  21.                 c.insets = new Insets(10,10,10,10);
  22.  
  23.         }
  24. }