public RobonoboFrame(RobonoboController control, String[] args) { this.control = control; this.cmdLineArgs = args; setTitle("robonobo"); setIconImage(GUIUtils.getImage("/icon/robonobo-64x64.png")); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new CloseListener()); menuBar = Platform.getPlatform().getMenuBar(this); setJMenuBar(menuBar); JPanel contentPane = new JPanel(); double[][] cellSizen = {{5, 200, 5, TableLayout.FILL, 5}, {3, TableLayout.FILL, 5}}; contentPane.setLayout(new TableLayout(cellSizen)); setContentPane(contentPane); leftSidebar = new LeftSidebar(this); contentPane.add(leftSidebar, "1,1"); mainPanel = new MainPanel(this); contentPane.add(mainPanel, "3,1"); setPreferredSize(new Dimension(1024, 723)); pack(); leftSidebar.selectMyMusic(); guiConfig = (GuiConfig) control.getConfig("gui"); addListeners(); }
@Override public boolean dispatchKeyEvent(KeyEvent e) { int code = e.getKeyCode(); int modifiers = e.getModifiers(); if (code == KeyEvent.VK_ESCAPE) { if (isShowingSheet()) { discardTopSheet(); return true; } } if (code == KeyEvent.VK_Q && modifiers == Platform.getPlatform().getCommandModifierMask()) { shutdown(); return true; } return false; }