madhawaseeeee

Untitled

Jul 25th, 2015
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. public class Test {
  2.  
  3.     private static void CreateAndShowGui() {
  4.  
  5.         JFrame frame = new JFrame("Program");
  6.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  7.  
  8.         JTextPane txt = new JTextPane();
  9.         JPanel noWrapPanel = new JPanel(new BorderLayout());
  10.         noWrapPanel.add(txt);
  11.  
  12.         JScrollPane scroll = new JScrollPane(noWrapPanel);
  13.  
  14.         JPanel topPanel = new JPanel();
  15.         topPanel.setLayout(new BorderLayout());
  16.  
  17.         frame.add(topPanel);
  18.  
  19.         JPanel panel = new JPanel();
  20.         panel.setLayout(new BorderLayout());
  21.         panel.add(scroll, BorderLayout.CENTER);
  22.  
  23.         JTabbedPane tabbedPane = new JTabbedPane();
  24.         tabbedPane.addTab("Welcome", panel);
  25.         topPanel.add(tabbedPane);
  26.  
  27.         frame.setSize(400, 200);
  28.         frame.setVisible(true);
  29.  
  30.     }
  31.  
  32.     public static void main(String[] args) {
  33.  
  34.         SwingUtilities.invokeLater(new Runnable() {
  35.  
  36.             public void run() {
  37.  
  38.                 UIManager.put("swing.boldmetal", Boolean.FALSE);
  39.                 CreateAndShowGui();
  40.  
  41.             }
  42.  
  43.         });
  44.  
  45.     }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment