Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. public class GUI extends JFrame {
  2.  
  3. private JPanel contentPane;
  4.  
  5. public static void main(String[] args){
  6. GUI g = new GUI(null);
  7. }
  8.  
  9. public GUI(Applet a) {
  10. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  11. setBounds(100, 100, 947, 539);
  12. contentPane = new JPanel();
  13. contentPane.setBackground(Color.DARK_GRAY);
  14. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  15. setContentPane(contentPane);
  16. setSize(900,450);
  17. setVisible(true);
  18.  
  19.  
  20. try {
  21. for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
  22. if ("Nimbus".equals(info.getName())) {
  23. UIManager.setLookAndFeel(info.getClassName());
  24. break;
  25. }
  26. }
  27. } catch (Exception e) {
  28. // If Nimbus is not available, you can set the GUI to another look and feel.
  29. }
  30.  
  31. JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
  32.  
  33. JPanel panel_1 = new JPanel();
  34. panel_1.setBackground(Color.ORANGE);
  35. //panel_1.add(a);
  36. GroupLayout gl_contentPane = new GroupLayout(contentPane);
  37. gl_contentPane.setHorizontalGroup(
  38. gl_contentPane.createParallelGroup(Alignment.LEADING)
  39. .addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup()
  40. .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 764, Short.MAX_VALUE)
  41. .addPreferredGap(ComponentPlacement.RELATED)
  42. .addComponent(tabbedPane, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE))
  43. );
  44. gl_contentPane.setVerticalGroup(
  45. gl_contentPane.createParallelGroup(Alignment.LEADING)
  46. .addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup()
  47. .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
  48. .addComponent(panel_1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE)
  49. .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 497, Short.MAX_VALUE))
  50. .addGap(2))
  51. );
  52.  
  53. //Image img = new ImageIcon(this.getClass().getResource("/lookup.png")).getImage();
  54. //Image img1 = new ImageIcon(this.getClass().getResource("/stats.png")).getImage();
  55.  
  56. JPanel panel_2 = new JPanel();
  57. tabbedPane.addTab(null, null, panel_2, null);
  58.  
  59. JPanel panel = new JPanel();
  60. tabbedPane.addTab(null, null, panel, null);
  61.  
  62. JPanel panel_3 = new JPanel();
  63. tabbedPane.addTab("New tab", null, panel_3, null);
  64. contentPane.setLayout(gl_contentPane);
  65.  
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement