* UI changes resizable main and Win/Loose windows

* less gray and native Look & Feel
* new jar for layouts
This commit is contained in:
jendave
2011-08-06 05:08:21 +00:00
parent 7eb1e66210
commit 0b101f1494
12 changed files with 49 additions and 100 deletions

View File

@@ -8,5 +8,6 @@
<classpathentry kind="lib" path="res/lib/substance.jar"/>
<classpathentry kind="lib" path="res/lib/java-image-scaling-0.8.4.jar"/>
<classpathentry kind="lib" path="res/lib/google-collections-1.0.jar"/>
<classpathentry kind="lib" path="res/lib/miglayout-3.7.3.1-swing.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
.gitattributes vendored
View File

@@ -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

View File

@@ -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

Binary file not shown.

View File

@@ -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() {

View File

@@ -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);

View File

@@ -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));

View File

@@ -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));

View File

@@ -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));

View File

@@ -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);

View File

@@ -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));

View File

@@ -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) {