public SwingLwjglTest () { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Container container = getContentPane(); canvas1 = new LwjglAWTCanvas(new MusicTest()); canvas2 = new LwjglAWTCanvas(new UITest(), canvas1); canvas3 = new LwjglAWTCanvas(new WindowCreator(), canvas1); canvas1.getCanvas().setSize(200, 480); canvas2.getCanvas().setSize(200, 480); canvas3.getCanvas().setSize(200, 480); container.add(canvas1.getCanvas(), BorderLayout.LINE_START); container.add(canvas2.getCanvas(), BorderLayout.CENTER); container.add(canvas3.getCanvas(), BorderLayout.LINE_END); pack(); setVisible(true); setSize(800, 480); }
/** * Create the frame. */ public GameContainer() { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 800, 480); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel buttonPane = new JPanel(); for(TileType t: TileType.values()) { JButton b = new JButton(t.toString()); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { changeTile(t.toString()); } }); buttonPane.add(b); } buttonPane.setSize(5, this.getHeight()); getContentPane().add(buttonPane, BorderLayout.EAST); buttonPane.setLayout(new GridLayout(8, 8, 0, 0)); LwjglAWTCanvas canvas = new LwjglAWTCanvas(new GDX2()); canvas.getCanvas().setSize(640, 480); getContentPane().add(canvas.getCanvas(), BorderLayout.WEST); }
private void createWindow () { JFrame window = new JFrame(); LwjglAWTCanvas canvas = new LwjglAWTCanvas(new AnimationTest(), canvas1); window.getContentPane().add(canvas.getCanvas(), BorderLayout.CENTER); window.pack(); window.setVisible(true); window.setSize(200, 200); }
public void createHieroCanvas(){ setOpaque(true); removeAll(); HieroPanel panel = new HieroPanel(); canvas = new LwjglAWTCanvas(new HieroPanel.FontRenderer() , false); HieroPanel.gamePanel.add(canvas.getCanvas()); JScrollPane scrollPane = new JScrollPane(panel); scrollPane.setPreferredSize(new Dimension(860, 650)); UIUtils.setDrawBorder(scrollPane, false); add(scrollPane); }
public void createParticleCanvas(){ setOpaque(true); removeAll(); ParticlePanel panel = new ParticlePanel(); canvas = new LwjglAWTCanvas(new ParticleRenderer(panel) , false); panel.initializeComponents(canvas); JScrollPane scrollPane = new JScrollPane(panel); scrollPane.setPreferredSize(new Dimension(860, 650)); UIUtils.setDrawBorder(scrollPane, false); add(scrollPane); }
public MainWindow() { super(); $$$setupUI$$$(); this.current = this; Thread.setDefaultUncaughtExceptionHandler(this); setContentPane(mainContentPane); mainContentPane.remove(mainSplitPane); this.directoryWatcher = new DirectoryWatcher(); shadersController = new ShadersController(directoryWatcher, this); terrainInspectorPanel = new MapPropertySheet(); this.codeEditorWindow = new CodeEditorWindow(); this.resourcesController = new ResourcesController(); this.dockFrameController = new DockFramesController(this); this.codeEditorController = new CodeEditorController(codeEditorWindow); setResizable(true); mainContentPane.setVisible(false); setSize(1360, 760); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); setTitle(null); setVisible(true); this.inputProcessor = new GdxSwingInputProcessor(); this.jobs = new JobManager(); Config config = Config.load("editor"); engine = new ForgE(config, new String[]{}); uiController = new UiController(directoryWatcher, jobs); postProcessingController = new PostProcessingController(directoryWatcher); blocksController = new BlocksController(blockList, directoryWatcher, jobs, (ImagePanel) panelPrimaryBlock, (ImagePanel) panelSecondaryBlock); this.progressTaskDialog = new ProgressTaskDialog(); projectController = new ProjectController(); mainMenu = new MainMenu(projectController, blocksController, dockFrameController, shadersController, postProcessingController, uiController); eventsToolsController = new EventsController(this); terrainToolsController = new TerrainToolsController(terrainToolsToolbar, blocksController, inputProcessor, terrainInspectorPanel); playerController = new PlayerController(projectController, jobs); mainToolbarController = new MainToolbarController(projectController, mainToolbar, mainMenu, inputProcessor, playerController, codeEditorController); mapTreeController = new MapTreeController(mapTree, projectController); engine.addBootListener(this); engine.addBootListener(blocksController); engine.addBootListener(mapTreeController); engine.addBootListener(terrainToolsController); engine.addBootListener(codeEditorController); openGLCanvas = new LwjglAWTCanvas(engine); input = (LwjglAWTInput) openGLCanvas.getInput(); mainContentPane.addMouseListener(input); mainContentPane.addKeyListener(input); mainContentPane.setFocusTraversalKeysEnabled(false); mainContentPane.setFocusable(true); mainContentPane.grabFocus(); mainContentPane.addFocusListener(this); openGlContainer.add(openGLCanvas.getCanvas(), BorderLayout.CENTER); projectController.setStatusLabel(statusFpsLabel, statusMemoryLabel, statusRenderablesLabel, mapCursorPositionLabel, statusTriangleCountLabel); mainToolbarController.editorModeListeners.addListener(terrainToolsController); mainToolbarController.editorModeListeners.addListener(dockFrameController); mainToolbarController.editorModeListeners.addListener(eventsToolsController); projectController.addOnMapChangeListener(terrainToolsController); projectController.addOnMapChangeListener(mainMenu); projectController.addOnMapChangeListener(mainToolbarController); projectController.addOnMapChangeListener(postProcessingController); projectController.addOnMapChangeListener(blocksController); projectController.addOnMapChangeListener(mapTreeController); projectController.addOnMapChangeListener(eventsToolsController); mainContentPane.setVisible(true); invalidate(); addWindowListener(this); addWindowFocusListener(this); }
public void initializeComponents (LwjglAWTCanvas canvas) { canvas.getCanvas().setPreferredSize(new Dimension(300, 250)); // Left JPanel propertiesPanel = new JPanel(new BorderLayout()); propertiesPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory .createTitledBorder("Editor Properties"))); editRowsPanel = new JPanel(new GridBagLayout()); propertiesPanel.add(editRowsPanel, BorderLayout.CENTER); // Center JPanel spacer = new JPanel(new BorderLayout()); spacer.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory .createTitledBorder("Particle Effect"))); spacer.add(canvas.getCanvas(), BorderLayout.CENTER); // Right JPanel emittersPanel = new JPanel(new BorderLayout()); emittersPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(0, 6, 6, 0), BorderFactory .createTitledBorder("Effect Emitters"))); effectPanel = new EffectPanel(this); emittersPanel.add(effectPanel, BorderLayout.CENTER); emittersPanel.setPreferredSize(new Dimension(330, 250)); JPanel propertiesPanel2 = new JPanel(new BorderLayout()); propertiesPanel2.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory .createTitledBorder("Emitter Properties"))); rowsPanel = new JPanel(new GridBagLayout()); propertiesPanel2.add(rowsPanel, BorderLayout.CENTER); JPanel tool = new JPanel(new BorderLayout()); tool.add(propertiesPanel, BorderLayout.WEST); tool.add(spacer, BorderLayout.CENTER); tool.add(emittersPanel, BorderLayout.EAST); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setDividerSize(4); splitPane.add(tool, JSplitPane.TOP); splitPane.add(new JScrollPane(propertiesPanel2), JSplitPane.BOTTOM); splitPane.setDividerLocation(250); add(splitPane, BorderLayout.CENTER); }
public void createStudioCanvas(){ removeAll(); GdxStudio.log("Creating Studio Canvas"); try{ Scene.configJson = Scene.jsonReader.parse(config); Scene.debug = true; Scene.scenesMap.clear(); Scene.scenesMap.put("gdxstudio.SceneEditor", ""); setOpaque(false); canvas = new LwjglAWTCanvas(Scene.app , false); scrollPane = new JScrollPane(canvas.getCanvas()); scrollPane.setPreferredSize(new Dimension(800, 480)); UIUtils.setDrawBorder(scrollPane, false); Style.setScreenSize(scrollPane.getPreferredSize().width, scrollPane.getPreferredSize().height); centerPanel = new CenterPanel(scrollPane, true, false); centerPanel.setBackground(Color.black); UIUtils.setUndecorated(centerPanel, true); UIUtils.setMargin(centerPanel, new Insets(0,0,0,0)); add(centerPanel); validate(); Style.setScreenPosition(scrollPane.getLocation().x, scrollPane.getLocation().y); canvas.getCanvas().setDropTarget(new DropTarget() { private static final long serialVersionUID = 1L; public synchronized void drop(DropTargetDropEvent event) { try{ Transferable transferable = event.getTransferable(); if( transferable.isDataFlavorSupported(DataFlavor.stringFlavor )){ event.acceptDrop( DnDConstants.ACTION_MOVE ); String s = (String)transferable.getTransferData(DataFlavor.stringFlavor); createActor(s); event.getDropTargetContext().dropComplete(true); } else{ event.rejectDrop(); } } catch( Exception exception ){ System.err.println( "Exception" + exception.getMessage() ); event.rejectDrop(); } } }); Asset.save(); }catch(Exception ex){ ex.printStackTrace(); } }
public RenderPreviewPanel() { super(); this.game = new PreviewGame(); this.canvas = new LwjglAWTCanvas(game); this.setLayout(new BorderLayout()); this.add(canvas.getCanvas(), BorderLayout.CENTER); game.pause(); }