diff --git a/.classpath b/.classpath index 0c0789de606..dde97586384 100644 --- a/.classpath +++ b/.classpath @@ -8,5 +8,6 @@ + diff --git a/.gitattributes b/.gitattributes index e1f6d7b6081..43002a58c30 100644 --- a/.gitattributes +++ b/.gitattributes @@ -29,6 +29,7 @@ res/lib/google-collections-1.0.jar -text svneol=unset#unset res/lib/java-image-scaling-0.8.4.jar -text svneol=unset#unset res/lib/jdom-1.0.jar -text svneol=unset#unset res/lib/jl1.0.1.jar -text svneol=unset#unset +res/lib/miglayout-3.7.3.1-swing.jar -text svneol=unset#unset res/lib/napkinlaf-1.2.jar -text svneol=unset#unset res/lib/napkinlaf-swingset-1.2.jar -text svneol=unset#unset res/lib/nimrodlf.jar -text svneol=unset#unset diff --git a/build/manifest.forge b/build/manifest.forge index 53bb8b5e180..3a1de20c187 100644 --- a/build/manifest.forge +++ b/build/manifest.forge @@ -1,3 +1,3 @@ Manifest-Version: 1.0 Main-Class: forge.Gui_NewGame -Class-Path: res/lib/google-collections-1.0.jar res/lib/java-image-scaling-0.8.4.jar res/lib/substance.jar res/lib/napkinlaf-1.2.jar res/lib/napkinlaf-swingset-1.2.jar res/lib/nimrodlf.jar res/lib/jl1.0.1.jar res/lib/jdom-1.0.jar +Class-Path: res/lib/google-collections-1.0.jar res/lib/java-image-scaling-0.8.4.jar res/lib/substance.jar res/lib/napkinlaf-1.2.jar res/lib/napkinlaf-swingset-1.2.jar res/lib/nimrodlf.jar res/lib/jl1.0.1.jar res/lib/jdom-1.0.jar res/lib/miglayout-3.7.3.1-swing.jar diff --git a/res/lib/miglayout-3.7.3.1-swing.jar b/res/lib/miglayout-3.7.3.1-swing.jar new file mode 100644 index 00000000000..9b88362b4a8 Binary files /dev/null and b/res/lib/miglayout-3.7.3.1-swing.jar differ diff --git a/src/forge/GUI_ImportPicture.java b/src/forge/GUI_ImportPicture.java index d53bc17cf30..d484391917c 100644 --- a/src/forge/GUI_ImportPicture.java +++ b/src/forge/GUI_ImportPicture.java @@ -242,7 +242,6 @@ public class GUI_ImportPicture extends JDialog implements NewConstants { private JCheckBox getJCheckBox() { if(jCheckBox == null) { jCheckBox = new JCheckBox(); - jCheckBox.setBackground(new Color(204, 204, 204)); jCheckBox.setSelected(false); jCheckBox.setText("Overwriting picture in resource folder"); jCheckBox.addMouseListener(new java.awt.event.MouseAdapter() { diff --git a/src/forge/GuiDisplay3.java b/src/forge/GuiDisplay3.java index 9fb4365477e..73f0844267e 100644 --- a/src/forge/GuiDisplay3.java +++ b/src/forge/GuiDisplay3.java @@ -83,17 +83,9 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo Font statFont = new Font("Dialog", Font.PLAIN, 12); Font lifeFont = new Font("Dialog", Font.PLAIN, 40); Font checkboxFont = new Font("Dialog", Font.PLAIN, 9); + - /* - public Color c1 = new Color(112,112,112); - public Color c2 = new Color(50,50,50); - public Color c3 = new Color(204,204,204); - */ - //private int count = 0; - - public static Color c1 = new Color(204, 204, 204); - public static Color c2 = new Color(204, 204, 204); - public static Color c3 = new Color(0, 164, 0); + public static Color greenColor = new Color(0, 164, 0); private Action HUMAN_GRAVEYARD_ACTION; private Action HUMAN_REMOVED_ACTION; @@ -591,7 +583,6 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo p.add(panel); } - p.setBackground(c2); p.revalidate(); p.repaint(); } @@ -607,7 +598,6 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo p.removeAll(); GuiDisplayUtil.setupLandPanel(p, AllZone.Human_Play.getCards()); - p.setBackground(c2); p.revalidate(); p.repaint(); } @@ -624,7 +614,6 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo p.removeAll(); GuiDisplayUtil.setupNoLandPanel(p, AllZone.Human_Play.getCards()); - p.setBackground(c2); p.revalidate(); p.repaint(); } @@ -642,7 +631,6 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo GuiDisplayUtil.setupNoLandPanel(p, AllZone.Computer_Play.getCards()); - p.setBackground(c2); p.revalidate(); p.repaint(); } @@ -658,7 +646,6 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo p.removeAll(); GuiDisplayUtil.setupLandPanel(p, AllZone.Computer_Play.getCards()); - p.setBackground(c2); p.revalidate(); p.repaint(); } @@ -807,7 +794,6 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo //if(okButton.isEnabled()) //okButton.doClick(); JPanel yesNoPanel = new JPanel(new FlowLayout()); - yesNoPanel.setBackground(c1); yesNoPanel.setBorder(new EtchedBorder()); yesNoPanel.add(cancelButton); yesNoPanel.add(okButton); @@ -824,7 +810,7 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo //oppLifeLabel.setHorizontalAlignment(SwingConstants.CENTER); //oppPCLabel.setHorizontalAlignment(SwingConstants.TOP); - oppPCLabel.setForeground(c3); + oppPCLabel.setForeground(greenColor); JLabel oppHandLabel = new JLabel(ForgeProps.getLocalized(COMPUTER_HAND.TITLE), SwingConstants.TRAILING); if(!Gui_NewGame.useLAFFonts.isSelected()) oppHandLabel.setFont(statFont); @@ -861,17 +847,14 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo oppNumbersPanel.add(oppLibraryValue); oppNumbersPanel.add(gravePanel); oppNumbersPanel.add(oppGraveValue); - oppNumbersPanel.setBackground(c1); oppLifeLabel.setHorizontalAlignment(SwingConstants.CENTER); JPanel oppIconLifePanel = new JPanel(new GridLayout(0, 1, 0, 0)); oppIconLifePanel.add(oppIconLabel); oppIconLifePanel.add(oppLifeLabel); - oppIconLifePanel.setBackground(c1); JPanel oppPanel = new JPanel(); - oppPanel.setBackground(c1); oppPanel.setBorder(new TitledBorder(new EtchedBorder(), ForgeProps.getLocalized(COMPUTER_TITLE))); oppPanel.setLayout(new BorderLayout()); oppPanel.add(oppNumbersPanel, BorderLayout.WEST); @@ -891,10 +874,8 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo combatArea.setEditable(false); combatArea.setLineWrap(true); combatArea.setWrapStyleWord(true); - combatArea.setBackground(c1); JScrollPane combatPane = new JScrollPane(combatArea); - combatPane.setBackground(c1); combatPane.setBorder(new TitledBorder(new EtchedBorder(), ForgeProps.getLocalized(COMBAT))); pane.add(new ExternalPanel(combatPane), "combat"); @@ -904,7 +885,7 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo //int fontSize = 12; playerLifeLabel.setHorizontalAlignment(SwingConstants.CENTER); - playerPCLabel.setForeground(c3); + playerPCLabel.setForeground(greenColor); JLabel playerLibraryLabel = new JLabel(ForgeProps.getLocalized(HUMAN_LIBRARY.TITLE), SwingConstants.TRAILING); @@ -959,10 +940,8 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo playerNumbersPanel.add(playerGraveValue); playerNumbersPanel.add(playerFBPanel); playerNumbersPanel.add(playerFBValue); - playerNumbersPanel.setBackground(c1); JPanel playerPanel = new JPanel(); - playerPanel.setBackground(c1); playerPanel.setBorder(new TitledBorder(new EtchedBorder(), ForgeProps.getLocalized(HUMAN_TITLE))); playerPanel.setLayout(new BorderLayout()); playerPanel.add(playerNumbersPanel, BorderLayout.WEST); diff --git a/src/forge/Gui_CardShop.java b/src/forge/Gui_CardShop.java index bfac7ffa650..adff9289ccc 100644 --- a/src/forge/Gui_CardShop.java +++ b/src/forge/Gui_CardShop.java @@ -427,7 +427,6 @@ public class Gui_CardShop extends JFrame implements CardContainer, DeckDisplay, this.getContentPane().setLayout(null); jScrollPane1.setBorder(titledBorder1); jScrollPane1.setBounds(new Rectangle(19, 20, 726, 346)); - jScrollPane2.getViewport().setBackground(new Color(204, 204, 204)); jScrollPane2.setBorder(titledBorder2); jScrollPane2.setBounds(new Rectangle(19, 458, 726, 218)); sellButton.setBounds(new Rectangle(180, 403, 146, 49)); diff --git a/src/forge/Gui_DeckEditor.java b/src/forge/Gui_DeckEditor.java index 4dd362a655e..11f61b86bf3 100644 --- a/src/forge/Gui_DeckEditor.java +++ b/src/forge/Gui_DeckEditor.java @@ -476,7 +476,6 @@ public class Gui_DeckEditor extends JFrame implements CardContainer, DeckDisplay this.getContentPane().setLayout(null); jScrollPane1.setBorder(titledBorder1); jScrollPane1.setBounds(new Rectangle(19, 20, 726, 346)); - jScrollPane2.getViewport().setBackground(new Color(204, 204, 204)); jScrollPane2.setBorder(titledBorder2); jScrollPane2.setBounds(new Rectangle(19, 458, 726, 218)); removeButton.setBounds(new Rectangle(180, 403, 146, 49)); diff --git a/src/forge/Gui_DeckEditorNew.java b/src/forge/Gui_DeckEditorNew.java index db6d6716725..cbe668b044c 100755 --- a/src/forge/Gui_DeckEditorNew.java +++ b/src/forge/Gui_DeckEditorNew.java @@ -240,7 +240,6 @@ public class Gui_DeckEditorNew extends JFrame implements CardContainer, NewConst this.getContentPane().setLayout(null); jScrollPane1.setBorder(titledBorder1); jScrollPane1.setBounds(new Rectangle(19, 28, 726, 346)); - jScrollPane2.getViewport().setBackground(new Color(204, 204, 204)); jScrollPane2.setBorder(titledBorder2); jScrollPane2.setBounds(new Rectangle(19, 458, 726, 218)); removeButton.setBounds(new Rectangle(180, 403, 146, 49)); diff --git a/src/forge/Gui_NewGame.java b/src/forge/Gui_NewGame.java index e60d4cec362..ef475af3a2b 100644 --- a/src/forge/Gui_NewGame.java +++ b/src/forge/Gui_NewGame.java @@ -39,6 +39,8 @@ import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.border.Border; import javax.swing.border.TitledBorder; +import net.miginfocom.swing.MigLayout; + import forge.error.ErrorViewer; import forge.error.ExceptionHandler; import forge.gui.ListChooser; @@ -109,21 +111,8 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA public static void main(String[] args) { ExceptionHandler.registerErrorHandling(); - try { - Object[] o = UIManager.getInstalledLookAndFeels(); - if(o.length > 3) { - final Color background = new Color(204, 204, 204); - - String[] properties = { - "Panel.background", "Panel.background", "JPanel.background", "Button.background", - "RadioButton.background", "MenuBar.background", "Menu.background", "JMenu.background", - "ComboBox.background", "MenuItem.background", "JCheckBoxMenuItem.background", - "Dialog.background", "OptionPane.background", "ScrollBar.background"}; - for(int i = 0; i < properties.length; i++) { - UIManager.put(properties[i], background); - } - } + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception ex) { ErrorViewer.showError(ex); } @@ -302,22 +291,19 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA titledBorder2 = new TitledBorder(border2, "Library"); border3 = BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)); titledBorder3 = new TitledBorder(border3, "Settings"); - titleLabel.setBounds(new Rectangle(1, 8, 518, 57)); titleLabel.setText("New Game"); titleLabel.setFont(new java.awt.Font("Dialog", 0, 26)); titleLabel.setHorizontalAlignment(SwingConstants.CENTER); - this.getContentPane().setLayout(null); + this.getContentPane().setLayout(new MigLayout("fill")); /* * Game Type Panel */ jPanel2.setBorder(titledBorder1); - jPanel2.setBounds(new Rectangle(20, 71, 480, 137)); - jPanel2.setLayout(null); + jPanel2.setLayout(new MigLayout("align center")); singleRadioButton.setText("Constructed (Easy) - Use all of the cards to defeat the computer"); - singleRadioButton.setBounds(new Rectangle(20, 24, 445, 31)); singleRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { singleRadioButton_actionPerformed(e); @@ -326,7 +312,6 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA sealedRadioButton.setToolTipText(""); sealedRadioButton.setText("Sealed Deck (Medium) - Create your deck from 75 available cards"); - sealedRadioButton.setBounds(new Rectangle(20, 59, 445, 28)); sealedRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { sealedRadioButton_actionPerformed(e); @@ -335,7 +320,6 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA draftRadioButton.setToolTipText(""); draftRadioButton.setText("Booster Draft (Hard) - Pick cards 1 at a time to create your deck"); - draftRadioButton.setBounds(new Rectangle(20, 91, 445, 25)); draftRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { draftRadioButton_actionPerformed(e); @@ -347,45 +331,34 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA */ jPanel1.setBorder(titledBorder2); - // jPanel1.setBorder(BorderFactory.createEtchedBorder()); - jPanel1.setBounds(new Rectangle(20, 219, 317, 120)); - jPanel1.setLayout(null); + jPanel1.setLayout(new MigLayout("align center")); jLabel2.setText("Your Deck"); - jLabel2.setBounds(new Rectangle(18, 27, 85, 27)); jLabel3.setText("Opponent"); - jLabel3.setBounds(new Rectangle(18, 70, 85, 27)); - - humanComboBox.setBounds(new Rectangle(88, 29, 207, 23)); + humanComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { humanComboBox_actionPerformed(e); } }); - computerComboBox.setBounds(new Rectangle(88, 72, 207, 23)); /* * Settings Panel */ jPanel3.setBorder(titledBorder3); - jPanel3.setBounds(new Rectangle(20, 350, 317, 140)); - jPanel3.setLayout(null); + jPanel3.setLayout(new MigLayout("align center")); newGuiCheckBox.setText("Resizable Game Area"); - newGuiCheckBox.setBounds(new Rectangle(102, 376, 190, 25)); // newGuiCheckBox.setSelected(true); smoothLandCheckBox.setText("Stack AI land"); - smoothLandCheckBox.setBounds(new Rectangle(102, 409, 190, 25)); // smoothLandCheckBox.setSelected(true); millLoseCheckBox.setText("Milling = Loss Condition"); - millLoseCheckBox.setBounds(new Rectangle(102, 442, 190, 25)); /* * Buttons */ - deckEditorButton.setBounds(new Rectangle(364, 261, 124, 36)); deckEditorButton.setToolTipText(""); deckEditorButton.setFont(new java.awt.Font("Dialog", 0, 15)); deckEditorButton.setText("Deck Editor"); @@ -395,7 +368,6 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA } }); - startButton.setBounds(new Rectangle(356, 380, 142, 37)); startButton.setFont(new java.awt.Font("Dialog", 0, 18)); startButton.setHorizontalTextPosition(SwingConstants.LEADING); startButton.setText("Start Game"); @@ -405,27 +377,32 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA } }); - questButton.setBounds(new Rectangle(356, 430, 142, 37)); questButton.setFont(new java.awt.Font("Dialog", 0, 18)); questButton.setText("Quest Mode"); - this.getContentPane().add(titleLabel, null); - jPanel1.add(computerComboBox, null); - jPanel1.add(humanComboBox, null); - jPanel1.add(jLabel2, null); - jPanel1.add(jLabel3, null); - this.getContentPane().add(deckEditorButton, null); - this.getContentPane().add(startButton, null); - this.getContentPane().add(newGuiCheckBox, null); - this.getContentPane().add(smoothLandCheckBox, null); - this.getContentPane().add(millLoseCheckBox, null); - this.getContentPane().add(questButton, null); - this.getContentPane().add(jPanel2, null); - this.getContentPane().add(jPanel3, null); - jPanel2.add(singleRadioButton, null); - jPanel2.add(sealedRadioButton, null); - jPanel2.add(draftRadioButton, null); - this.getContentPane().add(jPanel1, null); + this.getContentPane().add(titleLabel, "align center, span 3, grow, wrap"); + + this.getContentPane().add(jPanel2, "span 3, grow, wrap"); + jPanel2.add(singleRadioButton, "span 3, wrap"); + jPanel2.add(sealedRadioButton, "span 3, wrap"); + jPanel2.add(draftRadioButton, "span 3, wrap"); + + this.getContentPane().add(jPanel1, "span 2, grow"); + jPanel1.add(jLabel2); + jPanel1.add(humanComboBox, "wrap"); + jPanel1.add(jLabel3); + jPanel1.add(computerComboBox); + this.getContentPane().add(deckEditorButton, "sg buttons, align 50% 50%, wrap"); + + this.getContentPane().add(jPanel3, "span 2, grow"); + + jPanel3.add(newGuiCheckBox, "wrap"); + jPanel3.add(smoothLandCheckBox, "wrap"); + jPanel3.add(millLoseCheckBox, "wrap"); + + this.getContentPane().add(startButton, "sg buttons, align 50% 50%, split 2, flowy"); + this.getContentPane().add(questButton, "sg buttons, align 50% 50%"); + buttonGroup1.add(singleRadioButton); buttonGroup1.add(sealedRadioButton); buttonGroup1.add(draftRadioButton); diff --git a/src/forge/Gui_Quest_DeckEditor.java b/src/forge/Gui_Quest_DeckEditor.java index 687d2cc8a85..6a68dac7816 100644 --- a/src/forge/Gui_Quest_DeckEditor.java +++ b/src/forge/Gui_Quest_DeckEditor.java @@ -506,7 +506,6 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardContainer, DeckD this.getContentPane().setLayout(null); jScrollPane1.setBorder(titledBorder1); jScrollPane1.setBounds(new Rectangle(19, 20, 726, 346)); - jScrollPane2.getViewport().setBackground(new Color(204, 204, 204)); jScrollPane2.setBorder(titledBorder2); jScrollPane2.setBounds(new Rectangle(19, 458, 726, 218)); removeButton.setBounds(new Rectangle(180, 403, 146, 49)); diff --git a/src/forge/Gui_WinLose.java b/src/forge/Gui_WinLose.java index fd4e8d060cf..039c24cb4c1 100644 --- a/src/forge/Gui_WinLose.java +++ b/src/forge/Gui_WinLose.java @@ -20,6 +20,8 @@ import javax.swing.SwingConstants; import javax.swing.border.Border; import javax.swing.border.TitledBorder; +import net.miginfocom.swing.MigLayout; + import forge.error.ErrorViewer; import forge.properties.ForgeProps; import forge.properties.NewConstants; @@ -171,23 +173,19 @@ public class Gui_WinLose extends JFrame implements NewConstants { titleLabel.setFont(new java.awt.Font("Dialog", 0, 26)); titleLabel.setHorizontalAlignment(SwingConstants.CENTER); titleLabel.setText("You Won"); - titleLabel.setBounds(new Rectangle(-4, 0, 198, 60)); - this.getContentPane().setLayout(null); - continueButton.setBounds(new Rectangle(22, 21, 123, 30)); + this.getContentPane().setLayout(new MigLayout("fill")); continueButton.setText("Continue Match"); continueButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { continueButton_actionPerformed(e); } }); - restartButton.setBounds(new Rectangle(22, 90, 123, 30)); restartButton.setText("Restart Match"); restartButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { restartButton_actionPerformed(e); } }); - quitButton.setBounds(new Rectangle(22, 158, 123, 30)); quitButton.setText("Quit Match"); quitButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { @@ -196,23 +194,21 @@ public class Gui_WinLose extends JFrame implements NewConstants { }); statsLabel.setFont(new java.awt.Font("Dialog", 0, 16)); statsLabel.setHorizontalAlignment(SwingConstants.CENTER); - statsLabel.setText("Wins 2, Lost 1"); - statsLabel.setBounds(new Rectangle(12, 59, 170, 30)); jPanel2.setBorder(BorderFactory.createLineBorder(Color.black)); - jPanel2.setBounds(new Rectangle(20, 104, 166, 217)); - jPanel2.setLayout(null); + jPanel2.setLayout(new MigLayout("align center")); this.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(WindowEvent e) { this_windowClosing(e); } }); - this.getContentPane().add(statsLabel, null); - this.getContentPane().add(jPanel2, null); - jPanel2.add(continueButton, null); - jPanel2.add(quitButton, null); - jPanel2.add(restartButton, null); - this.getContentPane().add(titleLabel, null); + this.getContentPane().add(titleLabel, "align center, grow, wrap"); + this.getContentPane().add(statsLabel, "align center, grow, wrap"); + this.getContentPane().add(jPanel2, "grow"); + jPanel2.add(continueButton, "sg buttons, w 80%, h 20%, wrap"); + jPanel2.add(quitButton, "sg buttons, wrap"); + jPanel2.add(restartButton, "sg buttons"); + } void editDeckButton_actionPerformed(ActionEvent e) {