From b2dbfcc317d7cdec57cc4081801e75a9d25b1d07 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 1 May 2011 19:14:55 +0200 Subject: Fix formatting git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@52 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/view/impl/View.java | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/jrummikub/view/impl/View.java') diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java index 4cbad44..3508877 100644 --- a/src/jrummikub/view/impl/View.java +++ b/src/jrummikub/view/impl/View.java @@ -1,7 +1,6 @@ package jrummikub.view.impl; import java.awt.Color; -import java.awt.Dimension; import java.awt.Insets; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; @@ -18,16 +17,15 @@ import jrummikub.view.IView; public class View extends JFrame implements IView { private Table table; private PlayerPanel playerPanel; - + private final static float PLAYER_PANEL_RATIO = 0.125f; private final static int PLAYER_PANEL_BORDER_WIDTH = 1; private final static int PLAYER_PANEL_MAX_HEIGHT = 180 + PLAYER_PANEL_BORDER_WIDTH; - - + private static int even(double d) { - return 2*(int)(d/2); + return 2 * (int) (d / 2); } - + public ITable getTable() { return table; } @@ -36,39 +34,42 @@ public class View extends JFrame implements IView { return playerPanel; } - public View() { super("JRummikub"); setLayout(null); - + setSize(1000, 700); setDefaultCloseOperation(EXIT_ON_CLOSE); - + table = new Table(); add(table); playerPanel = new PlayerPanel(); - playerPanel.setBorder(new CustomBorder(Color.BLACK, PLAYER_PANEL_BORDER_WIDTH, 0, 0, 0)); + playerPanel.setBorder(new CustomBorder(Color.BLACK, + PLAYER_PANEL_BORDER_WIDTH, 0, 0, 0)); add(playerPanel); - + addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { Insets insets = getInsets(); - int x = insets.left, y = insets.top, width = getWidth()-insets.left-insets.right, height = getHeight()-insets.top-insets.bottom; - - int playerPanelHeight = even(Math.pow((double)width*width*height, 1/3.0)*PLAYER_PANEL_RATIO) + PLAYER_PANEL_BORDER_WIDTH; + int x = insets.left, y = insets.top, width = getWidth() - insets.left + - insets.right, height = getHeight() - insets.top - insets.bottom; + + int playerPanelHeight = even(Math.pow((double) width * width * height, + 1 / 3.0) * PLAYER_PANEL_RATIO) + + PLAYER_PANEL_BORDER_WIDTH; if (playerPanelHeight > PLAYER_PANEL_MAX_HEIGHT) playerPanelHeight = PLAYER_PANEL_MAX_HEIGHT; - + int tableHeight = height - playerPanelHeight; - + table.setBounds(x, y, width, tableHeight); table.validate(); - playerPanel.setBounds(x, y+tableHeight, width, playerPanelHeight); + playerPanel.setBounds(x, y + tableHeight, width, playerPanelHeight); } }); - + setVisible(true); } -- cgit v1.2.3