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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
view.getCbCharm().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
@@ -124,7 +124,7 @@ public enum CSubmenuChallenges implements ICDoc {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.control.home.IControlSubmenu#update()
|
||||
*/
|
||||
@@ -136,7 +136,7 @@ public enum CSubmenuChallenges implements ICDoc {
|
||||
final QuestController qCtrl = Singletons.getModel().getQuest();
|
||||
|
||||
if (qCtrl.getAchievements() == null) return;
|
||||
|
||||
|
||||
view.getLblTitle().setText("Challenges: " + qCtrl.getRank());
|
||||
|
||||
view.getPnlChallenges().removeAll();
|
||||
@@ -161,9 +161,9 @@ public enum CSubmenuChallenges implements ICDoc {
|
||||
}
|
||||
rad.addKeyListener(_startOnEnter);
|
||||
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) {
|
||||
final FLabel lbl = new FLabel.Builder()
|
||||
@@ -180,7 +180,7 @@ public enum CSubmenuChallenges implements ICDoc {
|
||||
}
|
||||
|
||||
Singletons.getView().getFrame().validate();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -67,7 +67,7 @@ public enum CSubmenuDuels implements ICDoc {
|
||||
quest.save();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
view.getCbCharm().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
@@ -105,7 +105,7 @@ public enum CSubmenuDuels implements ICDoc {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.control.home.IControlSubmenu#update()
|
||||
*/
|
||||
@@ -134,9 +134,9 @@ public enum CSubmenuDuels implements ICDoc {
|
||||
}
|
||||
rad.addKeyListener(_startOnEnter);
|
||||
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.ScrollPaneConstants;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
@@ -21,7 +19,7 @@ import forge.gui.home.VHomeUI;
|
||||
import forge.gui.toolbox.FCheckBox;
|
||||
import forge.gui.toolbox.FComboBoxWrapper;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FScrollPanel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
@@ -38,11 +36,10 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
||||
private final DragTab tab = new DragTab("Quest Challenges");
|
||||
|
||||
//========== INSTANTIATION
|
||||
private final JPanel pnlChallenges = new JPanel();
|
||||
private final JPanel pnlStats = 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);
|
||||
|
||||
private final StartButton btnStart = new StartButton();
|
||||
@@ -93,10 +90,6 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
||||
* Constructor.
|
||||
*/
|
||||
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";
|
||||
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 3"));
|
||||
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(lblCurrentDeck, "span 2");
|
||||
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(btnStart, "gap 0 0 30px 30px, ax center");
|
||||
|
||||
@@ -159,27 +152,22 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JPanel} */
|
||||
public JPanel getPnlChallenges() {
|
||||
public FScrollPanel getPnlChallenges() {
|
||||
return pnlChallenges;
|
||||
}
|
||||
|
||||
/** @return {@link forge.gui.toolbox.FPanel} */
|
||||
public JPanel getPnlStats() {
|
||||
return pnlStats;
|
||||
}
|
||||
|
||||
/** @return {@link forge.gui.toolbox.FPanel} */
|
||||
public JPanel getPnlStart() {
|
||||
return pnlStart;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JLabel} */
|
||||
public JLabel getLblTitle() {
|
||||
return lblTitle;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JLabel} */
|
||||
@Override
|
||||
public FLabel getLblWorld() {
|
||||
return lblWorld;
|
||||
|
||||
@@ -7,8 +7,6 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
@@ -21,7 +19,7 @@ import forge.gui.home.VHomeUI;
|
||||
import forge.gui.toolbox.FCheckBox;
|
||||
import forge.gui.toolbox.FComboBoxWrapper;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.gui.toolbox.FScrollPane;
|
||||
import forge.gui.toolbox.FScrollPanel;
|
||||
import forge.gui.toolbox.FSkin;
|
||||
|
||||
/**
|
||||
@@ -38,10 +36,9 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
||||
private final DragTab tab = new DragTab("Quest Duels");
|
||||
|
||||
// Other fields
|
||||
private final JPanel pnlDuels = 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);
|
||||
|
||||
private final StartButton btnStart = new StartButton();
|
||||
@@ -91,10 +88,6 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
||||
* Constructor.
|
||||
*/
|
||||
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";
|
||||
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 0"));
|
||||
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(lblCurrentDeck, "span 2");
|
||||
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(btnStart, "gap 0 0 30px 30px, ax center");
|
||||
|
||||
@@ -156,22 +149,18 @@ public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JPanel} */
|
||||
public JPanel getPnlDuels() {
|
||||
public FScrollPanel getPnlDuels() {
|
||||
return pnlDuels;
|
||||
}
|
||||
|
||||
/** @return {@link forge.gui.toolbox.FPanel} */
|
||||
public JPanel getPnlStats() {
|
||||
return pnlStats;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JLabel} */
|
||||
public JLabel getLblTitle() {
|
||||
return lblTitle;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JLabel} */
|
||||
@Override
|
||||
public FLabel getLblWorld() {
|
||||
return lblWorld;
|
||||
|
||||
@@ -153,6 +153,7 @@ public class FScrollPane extends SkinnedScrollPane {
|
||||
scrollBar = scrollBar0;
|
||||
incrementDirection = incrementDirection0;
|
||||
timer.setInitialDelay(500); //wait half a second after mouse down before starting timer
|
||||
this.setFocusable(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,9 @@ package forge.gui.toolbox;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.MenuComponent;
|
||||
import java.awt.PopupMenu;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
|
||||
@@ -97,4 +99,40 @@ public class FScrollPanel extends FScrollPane {
|
||||
}
|
||||
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