From ae6df988328a87e60a71d460bc2e7f761dd39c07 Mon Sep 17 00:00:00 2001 From: galaxyoyo Date: Thu, 8 Jan 2015 19:58:45 +0100 Subject: [PATCH] =?UTF-8?q?Mis=20=C3=A0=20jour=20fen=C3=AAtre=20d'=C3=A9di?= =?UTF-8?q?tion=20(pas=20version=20finale)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/editor/sprites/SpriteRegister.java | 1 - .../galaxyoyo/unknown/editor/EditorFrame.java | 66 +++++++++++++------ 2 files changed, 45 insertions(+), 22 deletions(-) diff --git a/src/main/java/galaxyoyo/unknown/api/editor/sprites/SpriteRegister.java b/src/main/java/galaxyoyo/unknown/api/editor/sprites/SpriteRegister.java index e1bd922..777aed1 100644 --- a/src/main/java/galaxyoyo/unknown/api/editor/sprites/SpriteRegister.java +++ b/src/main/java/galaxyoyo/unknown/api/editor/sprites/SpriteRegister.java @@ -33,7 +33,6 @@ public class SpriteRegister { BufferedReader br = new BufferedReader(new InputStreamReader(SpriteRegister.class.getResourceAsStream("/assets/unknown/textures/sprites/sprites.json"))); nameToCoords = new Gson().fromJson(br, Map.class); - System.out.println(nameToCoords); br.close(); for (String key : nameToCoords.keySet()) diff --git a/src/main/java/galaxyoyo/unknown/editor/EditorFrame.java b/src/main/java/galaxyoyo/unknown/editor/EditorFrame.java index 263457a..93c078d 100644 --- a/src/main/java/galaxyoyo/unknown/editor/EditorFrame.java +++ b/src/main/java/galaxyoyo/unknown/editor/EditorFrame.java @@ -1,13 +1,13 @@ package galaxyoyo.unknown.editor; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTabbedPane; -public class EditorFrame extends JFrame +public class EditorFrame extends JFrame implements ComponentListener { private static final long serialVersionUID = -2705122356101556462L; @@ -33,26 +33,16 @@ public class EditorFrame extends JFrame this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setLocationRelativeTo(null); - this.setLayout(new GridBagLayout()); this.setContentPane(content); + this.addComponentListener(this); - GridBagConstraints c = new GridBagConstraints(); - - c.gridx = 0; - c.gridy = 0; - c.gridwidth = 3; - c.gridheight = 1; + revalidate(); tabs.addTab("Carte", new JPanel()); tabs.addTab("\u00c9vennements", tabEvents); tabs.addTab("Collisions", tabColl); - content.add(tabs, c); - - c.gridx = 0; - c.gridy = 1; - c.gridwidth = 2; - c.gridheight = 3; + content.add(tabs); content.add(mapPanel); @@ -60,11 +50,45 @@ public class EditorFrame extends JFrame resources.addTab("2", couche2); resources.addTab("3", couche3); - c.gridx = 2; - c.gridy = 1; - c.gridwidth = 1; - c.gridheight = 3; - content.add(resources); + + revalidate(); + repaint(); + } + + @Override + public void componentHidden(ComponentEvent event) + { + } + + @Override + public void componentMoved(ComponentEvent event) + { + componentShown(event); + } + + @Override + public void componentResized(ComponentEvent event) + { + componentShown(event); + } + + @Override + public void componentShown(ComponentEvent event) + { + revalidate(); + } + + @Override + public void revalidate() + { + tabs.setBounds(0, 0, getWidth(), getHeight() / 5); + mapPanel.setBounds(0, getWidth() / 5, getWidth() / 4 * 3, getHeight() / 5 * 4); + resources.setBounds(getWidth() / 4 * 3, getHeight() / 5, getWidth() / 4, getHeight() / 5 * 4); + + tabs.revalidate(); + mapPanel.revalidate(); + resources.revalidate(); + super.revalidate(); } }