Feedback panel back to the left. Some more minor changes.

This commit is contained in:
magenoxx 2011-06-09 09:09:02 +04:00
parent 175dd21f92
commit 3eb387b780
2 changed files with 19 additions and 6 deletions

View file

@ -64,6 +64,12 @@ public class Cards extends javax.swing.JPanel {
private boolean dontDisplayTapped = false;
private static final int GAP_X = 5;
/**
* Defines whether component should be visible whenever there is no objects within.
* True by default.
*/
private boolean isVisibleIfEmpty = true;
private Dimension cardDimension;
/** Creates new form Cards */
@ -94,6 +100,10 @@ public class Cards extends javax.swing.JPanel {
cardArea.setBackground(color);
}
public void setVisibleIfEmpty(boolean isVisibleIfEmpty) {
this.isVisibleIfEmpty = isVisibleIfEmpty;
}
public void setBorder(Border border) {
super.setBorder(border);
if (jScrollPane1 != null) {
@ -139,7 +149,9 @@ public class Cards extends javax.swing.JPanel {
layoutCards(getCardDimension());
}
cardArea.setVisible(cards.size() > 0);
if (!isVisibleIfEmpty) {
cardArea.setVisible(cards.size() > 0);
}
cardArea.setPreferredSize(new Dimension(cards.size() * (Config.dimensions.frameWidth + GAP_X), Config.dimensions.frameHeight));
cardArea.revalidate();
cardArea.repaint();

View file

@ -90,6 +90,7 @@ public class GamePanel extends javax.swing.JPanel {
hand.setHScrollSpeed(8);
hand.setBackgroundColor(new Color(0, 0, 0, 100));
hand.setVisibleIfEmpty(false);
combat = new CombatDialog();
pickNumber = new PickNumberDialog();
MageFrame.getDesktop().add(combat, JLayeredPane.POPUP_LAYER);
@ -629,7 +630,7 @@ public class GamePanel extends javax.swing.JPanel {
.addComponent(btnStopWatching)
.addContainerGap(62, Short.MAX_VALUE))
.addComponent(bigCard, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
//.addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
.addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
.addComponent(stack, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
.addGroup(pnlGameInfoLayout.createSequentialGroup()
.addContainerGap()
@ -640,8 +641,8 @@ public class GamePanel extends javax.swing.JPanel {
pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnlGameInfoLayout.createSequentialGroup()
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
//.addGap(1, 1, 1)
//.addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
/*.addGap(7, 7, 7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@ -773,7 +774,7 @@ public class GamePanel extends javax.swing.JPanel {
//helper.setBackground(new Color(0, 0, 0, 80));
//helper.setPreferredSize(new Dimension(0, 35));
feedbackPanel.setPreferredSize(new Dimension(0, 70));
//feedbackPanel.setPreferredSize(new Dimension(0, 70));
setOpaque(false);
jPanel.setOpaque(false);
@ -787,7 +788,7 @@ public class GamePanel extends javax.swing.JPanel {
setLayout(new BorderLayout());
add(jScrollPane1, BorderLayout.CENTER);
//add(helper, BorderLayout.PAGE_END);
add(feedbackPanel, BorderLayout.PAGE_END);
//add(feedbackPanel, BorderLayout.PAGE_END);
feedbackPanel.setHelperPanel(helper);
}