Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. public void mainMenu()
  2. {
  3. JPanel menuDisplay=new JPanel();
  4. menuDisplay.setLayout(new BoxLayout(menuDisplay,BoxLayout.Y_AXIS));
  5. menuDisplay.setBackground(Color.white);
  6.  
  7. JLabel menuTitle=new JLabel("Property Rental Appliance Inventory");
  8. menuTitle.setAlignmentX(Component.CENTER_ALIGNMENT);
  9. menuTitle.setFont(new Font("Calibre", Font.BOLD, 45));
  10.  
  11. JLabel subTitle=new JLabel("Main Menu");
  12. subTitle.setAlignmentX(Component.CENTER_ALIGNMENT);
  13. subTitle.setFont(new Font("Calibre", Font.BOLD, 30));
  14.  
  15. int buttonSizeHeight=70;
  16. int buttonSizeWidth=400;
  17. int buttonFontSize=25;
  18.  
  19. JButton navByLoc=new JButton("Navigate By Location");
  20. navByLoc.setAlignmentX(Component.CENTER_ALIGNMENT);
  21. navByLoc.setFont(new Font("Title", Font.BOLD, buttonFontSize));
  22. size(navByLoc,buttonSizeWidth,buttonSizeHeight);
  23.  
  24. JButton advSearch=new JButton("Advanced Search");
  25. advSearch.setAlignmentX(Component.CENTER_ALIGNMENT);
  26. advSearch.setFont(new Font("Title", Font.BOLD, buttonFontSize));
  27. size(advSearch,buttonSizeWidth,buttonSizeHeight);
  28.  
  29. JButton genStats=new JButton("General Statistics");
  30. genStats.setAlignmentX(Component.CENTER_ALIGNMENT);
  31. genStats.setFont(new Font("Title", Font.BOLD, buttonFontSize));
  32. size(genStats,buttonSizeWidth,buttonSizeHeight);
  33.  
  34. JButton backOpt=new JButton("Backup Options");
  35. backOpt.setAlignmentX(Component.CENTER_ALIGNMENT);
  36. backOpt.setFont(new Font("Title", Font.BOLD, buttonFontSize));
  37. size(backOpt,buttonSizeWidth,buttonSizeHeight);
  38.  
  39. fill(menuDisplay,15);
  40. menuDisplay.add(Box.createVerticalGlue());
  41. menuDisplay.add(menuTitle);
  42. fill(menuDisplay,10);
  43. menuDisplay.add(subTitle);
  44. fill(menuDisplay,40);
  45. menuDisplay.add(navByLoc);
  46. fill(menuDisplay,80);
  47. menuDisplay.add(advSearch);
  48. fill(menuDisplay,80);
  49. menuDisplay.add(genStats);
  50. fill(menuDisplay,80);
  51. menuDisplay.add(backOpt);
  52. fill(menuDisplay,200);
  53.  
  54. mainFrame.add(menuDisplay,BorderLayout.NORTH);
  55. showFrame();
  56. }
  57.  
  58. public void fill(JPanel k, int x) //creates a vertical fill space for box layout
  59. {
  60. k.add(Box.createRigidArea(new Dimension(1, x)));
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement