mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Make Quest Duels and Quest Challenges screens use FScrollPanel with arrow buttons
Prevent focusing arrow buttons
This commit is contained in:
@@ -98,7 +98,7 @@ public enum CSubmenuChallenges implements ICDoc {
|
|||||||
quest.save();
|
quest.save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
view.getCbCharm().addActionListener(new ActionListener() {
|
view.getCbCharm().addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
@@ -124,7 +124,7 @@ public enum CSubmenuChallenges implements ICDoc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see forge.control.home.IControlSubmenu#update()
|
* @see forge.control.home.IControlSubmenu#update()
|
||||||
*/
|
*/
|
||||||
@@ -136,7 +136,7 @@ public enum CSubmenuChallenges implements ICDoc {
|
|||||||
final QuestController qCtrl = Singletons.getModel().getQuest();
|
final QuestController qCtrl = Singletons.getModel().getQuest();
|
||||||
|
|
||||||
if (qCtrl.getAchievements() == null) return;
|
if (qCtrl.getAchievements() == null) return;
|
||||||
|
|
||||||
view.getLblTitle().setText("Challenges: " + qCtrl.getRank());
|
view.getLblTitle().setText("Challenges: " + qCtrl.getRank());
|
||||||
|
|
||||||
view.getPnlChallenges().removeAll();
|
view.getPnlChallenges().removeAll();
|
||||||
@@ -161,9 +161,9 @@ public enum CSubmenuChallenges implements ICDoc {
|
|||||||
}
|
}
|
||||||
rad.addKeyListener(_startOnEnter);
|
rad.addKeyListener(_startOnEnter);
|
||||||
rad.addMouseListener(_startOnDblClick);
|
rad.addMouseListener(_startOnDblClick);
|
||||||
grpPanel.add(temp, rad, "w 100%!, h 135px!, gap 2% 0 15px 15px");
|
grpPanel.add(temp, rad, "w 100%!, h 135px!, gapy 15px");
|
||||||
}
|
}
|
||||||
view.getPnlChallenges().add(grpPanel, "w 96%!");
|
view.getPnlChallenges().add(grpPanel, "w 100%!");
|
||||||
|
|
||||||
if (!haveAnyChallenges) {
|
if (!haveAnyChallenges) {
|
||||||
final FLabel lbl = new FLabel.Builder()
|
final FLabel lbl = new FLabel.Builder()
|
||||||
@@ -180,7 +180,7 @@ public enum CSubmenuChallenges implements ICDoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Singletons.getView().getFrame().validate();
|
Singletons.getView().getFrame().validate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public enum CSubmenuDuels implements ICDoc {
|
|||||||
quest.save();
|
quest.save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
view.getCbCharm().addActionListener(new ActionListener() {
|
view.getCbCharm().addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
@@ -105,7 +105,7 @@ public enum CSubmenuDuels implements ICDoc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see forge.control.home.IControlSubmenu#update()
|
* @see forge.control.home.IControlSubmenu#update()
|
||||||
*/
|
*/
|
||||||
@@ -134,9 +134,9 @@ public enum CSubmenuDuels implements ICDoc {
|
|||||||
}
|
}
|
||||||
rad.addKeyListener(_startOnEnter);
|
rad.addKeyListener(_startOnEnter);
|
||||||
rad.addMouseListener(_startOnDblClick);
|
rad.addMouseListener(_startOnDblClick);
|
||||||
grpPanel.add(temp, rad, "w 100%!, h 135px!, gap 2% 0 15px 15px");
|
grpPanel.add(temp, rad, "w 100%!, h 135px!, gapy 15px");
|
||||||
}
|
}
|
||||||
view.getPnlDuels().add(grpPanel, "w 96%!");
|
view.getPnlDuels().add(grpPanel, "w 100%!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.ScrollPaneConstants;
|
import javax.swing.ScrollPaneConstants;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.Border;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.gui.framework.DragCell;
|
import forge.gui.framework.DragCell;
|
||||||
import forge.gui.framework.DragTab;
|
import forge.gui.framework.DragTab;
|
||||||
@@ -21,7 +19,7 @@ import forge.gui.home.VHomeUI;
|
|||||||
import forge.gui.toolbox.FCheckBox;
|
import forge.gui.toolbox.FCheckBox;
|
||||||
import forge.gui.toolbox.FComboBoxWrapper;
|
import forge.gui.toolbox.FComboBoxWrapper;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
import forge.gui.toolbox.FScrollPane;
|
import forge.gui.toolbox.FScrollPanel;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,11 +36,10 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
|||||||
private final DragTab tab = new DragTab("Quest Challenges");
|
private final DragTab tab = new DragTab("Quest Challenges");
|
||||||
|
|
||||||
//========== INSTANTIATION
|
//========== INSTANTIATION
|
||||||
private final JPanel pnlChallenges = new JPanel();
|
|
||||||
private final JPanel pnlStats = new JPanel();
|
private final JPanel pnlStats = new JPanel();
|
||||||
private final JPanel pnlStart = new JPanel();
|
private final JPanel pnlStart = new JPanel();
|
||||||
|
|
||||||
private final FScrollPane scrChallenges = new FScrollPane(pnlChallenges,
|
private final FScrollPanel pnlChallenges = new FScrollPanel(new MigLayout("insets 0, gap 0, wrap"), true,
|
||||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
|
||||||
private final StartButton btnStart = new StartButton();
|
private final StartButton btnStart = new StartButton();
|
||||||
@@ -93,10 +90,6 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
|||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
private VSubmenuChallenges() {
|
private VSubmenuChallenges() {
|
||||||
scrChallenges.setBorder((Border)null);
|
|
||||||
pnlChallenges.setOpaque(false);
|
|
||||||
pnlChallenges.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
|
||||||
|
|
||||||
final String constraints = "h 30px!, gap 0 0 0 5px";
|
final String constraints = "h 30px!, gap 0 0 0 5px";
|
||||||
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 3"));
|
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 3"));
|
||||||
pnlStats.add(btnUnlock, "w 150px!, h 30px!, gap 0 0 0 10px");
|
pnlStats.add(btnUnlock, "w 150px!, h 30px!, gap 0 0 0 10px");
|
||||||
@@ -151,7 +144,7 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
|||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblInfo, "h 30px!, span 2");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblInfo, "h 30px!, span 2");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblCurrentDeck, "span 2");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblCurrentDeck, "span 2");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblNextChallengeInWins, "span 2, gap 0 0 0 20px");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblNextChallengeInWins, "span 2, gap 0 0 0 20px");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(scrChallenges, "w 88% - 175px!, pushy, growy");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlChallenges, "w 88% - 175px!, pushy, growy");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStats, "w 185px!, pushy, growy, gap 4% 4% 0 0, span 1 2");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStats, "w 185px!, pushy, growy, gap 4% 4% 0 0, span 1 2");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnStart, "gap 0 0 30px 30px, ax center");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnStart, "gap 0 0 30px 30px, ax center");
|
||||||
|
|
||||||
@@ -159,27 +152,22 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
|||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link javax.swing.JPanel} */
|
public FScrollPanel getPnlChallenges() {
|
||||||
public JPanel getPnlChallenges() {
|
|
||||||
return pnlChallenges;
|
return pnlChallenges;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.gui.toolbox.FPanel} */
|
|
||||||
public JPanel getPnlStats() {
|
public JPanel getPnlStats() {
|
||||||
return pnlStats;
|
return pnlStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.gui.toolbox.FPanel} */
|
|
||||||
public JPanel getPnlStart() {
|
public JPanel getPnlStart() {
|
||||||
return pnlStart;
|
return pnlStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link javax.swing.JLabel} */
|
|
||||||
public JLabel getLblTitle() {
|
public JLabel getLblTitle() {
|
||||||
return lblTitle;
|
return lblTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link javax.swing.JLabel} */
|
|
||||||
@Override
|
@Override
|
||||||
public FLabel getLblWorld() {
|
public FLabel getLblWorld() {
|
||||||
return lblWorld;
|
return lblWorld;
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.ScrollPaneConstants;
|
import javax.swing.ScrollPaneConstants;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.Border;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.gui.framework.DragCell;
|
import forge.gui.framework.DragCell;
|
||||||
import forge.gui.framework.DragTab;
|
import forge.gui.framework.DragTab;
|
||||||
@@ -21,7 +19,7 @@ import forge.gui.home.VHomeUI;
|
|||||||
import forge.gui.toolbox.FCheckBox;
|
import forge.gui.toolbox.FCheckBox;
|
||||||
import forge.gui.toolbox.FComboBoxWrapper;
|
import forge.gui.toolbox.FComboBoxWrapper;
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
import forge.gui.toolbox.FScrollPane;
|
import forge.gui.toolbox.FScrollPanel;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,10 +36,9 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
|||||||
private final DragTab tab = new DragTab("Quest Duels");
|
private final DragTab tab = new DragTab("Quest Duels");
|
||||||
|
|
||||||
// Other fields
|
// Other fields
|
||||||
private final JPanel pnlDuels = new JPanel();
|
|
||||||
private final JPanel pnlStats = new JPanel();
|
private final JPanel pnlStats = new JPanel();
|
||||||
|
|
||||||
private final FScrollPane scrDuels = new FScrollPane(pnlDuels,
|
private final FScrollPanel pnlDuels = new FScrollPanel(new MigLayout("insets 0, gap 0, wrap, ax center"), true,
|
||||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
|
||||||
private final StartButton btnStart = new StartButton();
|
private final StartButton btnStart = new StartButton();
|
||||||
@@ -91,10 +88,6 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
|||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
private VSubmenuDuels() {
|
private VSubmenuDuels() {
|
||||||
scrDuels.setBorder((Border)null);
|
|
||||||
pnlDuels.setOpaque(false);
|
|
||||||
pnlDuels.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center"));
|
|
||||||
|
|
||||||
final String constraints = "h 30px!, gap 0 0 0 5px";
|
final String constraints = "h 30px!, gap 0 0 0 5px";
|
||||||
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 0"));
|
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 0"));
|
||||||
pnlStats.add(btnUnlock, "w 150px!, h 30px!, gap 0 0 0 10px");
|
pnlStats.add(btnUnlock, "w 150px!, h 30px!, gap 0 0 0 10px");
|
||||||
@@ -148,7 +141,7 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
|||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblInfo, "h 30px!, span 2");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblInfo, "h 30px!, span 2");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblCurrentDeck, "span 2");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblCurrentDeck, "span 2");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblNextChallengeInWins, "span 2, gap 0 0 0 20px");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblNextChallengeInWins, "span 2, gap 0 0 0 20px");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(scrDuels, "w 88% - 175px!, pushy, growy");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlDuels, "w 88% - 175px!, pushy, growy");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStats, "w 185px!, pushy, growy, gap 4% 4% 0 0, span 1 2");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStats, "w 185px!, pushy, growy, gap 4% 4% 0 0, span 1 2");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnStart, "gap 0 0 30px 30px, ax center");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnStart, "gap 0 0 30px 30px, ax center");
|
||||||
|
|
||||||
@@ -156,22 +149,18 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
|||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link javax.swing.JPanel} */
|
public FScrollPanel getPnlDuels() {
|
||||||
public JPanel getPnlDuels() {
|
|
||||||
return pnlDuels;
|
return pnlDuels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.gui.toolbox.FPanel} */
|
|
||||||
public JPanel getPnlStats() {
|
public JPanel getPnlStats() {
|
||||||
return pnlStats;
|
return pnlStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link javax.swing.JLabel} */
|
|
||||||
public JLabel getLblTitle() {
|
public JLabel getLblTitle() {
|
||||||
return lblTitle;
|
return lblTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link javax.swing.JLabel} */
|
|
||||||
@Override
|
@Override
|
||||||
public FLabel getLblWorld() {
|
public FLabel getLblWorld() {
|
||||||
return lblWorld;
|
return lblWorld;
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ public class FScrollPane extends SkinnedScrollPane {
|
|||||||
scrollBar = scrollBar0;
|
scrollBar = scrollBar0;
|
||||||
incrementDirection = incrementDirection0;
|
incrementDirection = incrementDirection0;
|
||||||
timer.setInitialDelay(500); //wait half a second after mouse down before starting timer
|
timer.setInitialDelay(500); //wait half a second after mouse down before starting timer
|
||||||
|
this.setFocusable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ package forge.gui.toolbox;
|
|||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.LayoutManager;
|
import java.awt.LayoutManager;
|
||||||
|
import java.awt.MenuComponent;
|
||||||
import java.awt.PopupMenu;
|
import java.awt.PopupMenu;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.ScrollPaneConstants;
|
import javax.swing.ScrollPaneConstants;
|
||||||
|
|
||||||
@@ -97,4 +99,40 @@ public class FScrollPanel extends FScrollPane {
|
|||||||
}
|
}
|
||||||
return super.add(name, comp);
|
return super.add(name, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(Component comp) {
|
||||||
|
if (innerPanel != null) {
|
||||||
|
innerPanel.remove(comp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.remove(comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(int index) {
|
||||||
|
if (innerPanel != null) {
|
||||||
|
innerPanel.remove(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.remove(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(MenuComponent popup) {
|
||||||
|
if (innerPanel != null) {
|
||||||
|
innerPanel.remove(popup);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.remove(popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeAll() {
|
||||||
|
if (innerPanel != null) {
|
||||||
|
innerPanel.removeAll();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.removeAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user