MainFrame.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package ui.view.main;
  2. import java.awt.Canvas;
  3. import javax.swing.JFrame;
  4. import javax.swing.JSplitPane;
  5. import utility.ImageImport;
  6. /**
  7. * The MainFrame is responsible for the layout of Holeg.
  8. *
  9. * @author Tom
  10. *
  11. */
  12. public class MainFrame extends JFrame {
  13. // Constants
  14. private String frameTitle = "HOLEG";
  15. // Components
  16. private MainToolBar toolBar = new MainToolBar(this);
  17. private CatalogExplorer explorer = new CatalogExplorer();
  18. private HolonElementViewer elementViewer = new HolonElementViewer();
  19. private Inspector inspector = new Inspector();
  20. private HolonCanvas canvas = new HolonCanvas();
  21. // PanelLayout
  22. private JSplitPane splitCatalogCanvas = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, explorer, canvas);
  23. private JSplitPane splitElementInspector = new JSplitPane(JSplitPane.VERTICAL_SPLIT, elementViewer, inspector);
  24. private JSplitPane splitCanvasInspector = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitCatalogCanvas,
  25. splitElementInspector);
  26. public MainFrame() {
  27. // Size and Position
  28. setBounds(0, 0, 1000, 800);
  29. setLocationRelativeTo(null);
  30. // Title and Icon
  31. setTitle(frameTitle);
  32. setIconImage(ImageImport.loadImage("/Images/Holeg.png", 30, 30));
  33. // Display
  34. add(splitCanvasInspector);
  35. setVisible(true);
  36. // Default DividerLocations
  37. // can only be set after panel is visible
  38. splitCatalogCanvas.setDividerLocation(0.8);
  39. splitCanvasInspector.setDividerLocation(0.8);
  40. splitElementInspector.setDividerLocation(0.7);
  41. //Close Opperation
  42. setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  43. }
  44. }