mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Include count in title
Fix hover effect for close button
This commit is contained in:
@@ -54,6 +54,7 @@ public class FDialog extends SkinnedDialog implements ITitleBarOwner, KeyEventDi
|
|||||||
|
|
||||||
public FDialog(boolean modal0, boolean allowResize0, String insets) {
|
public FDialog(boolean modal0, boolean allowResize0, String insets) {
|
||||||
super(JOptionPane.getRootFrame(), modal0);
|
super(JOptionPane.getRootFrame(), modal0);
|
||||||
|
allowResize = allowResize0;
|
||||||
setUndecorated(true);
|
setUndecorated(true);
|
||||||
setIconImage(FSkin.getIcon(FSkinProp.ICO_FAVICON)); //use Forge icon by default
|
setIconImage(FSkin.getIcon(FSkinProp.ICO_FAVICON)); //use Forge icon by default
|
||||||
|
|
||||||
@@ -68,7 +69,6 @@ public class FDialog extends SkinnedDialog implements ITitleBarOwner, KeyEventDi
|
|||||||
titleBar.setVisible(true);
|
titleBar.setVisible(true);
|
||||||
addMoveSupport();
|
addMoveSupport();
|
||||||
|
|
||||||
allowResize = allowResize0;
|
|
||||||
if (allowResize) {
|
if (allowResize) {
|
||||||
this.setBorder(new CompoundSkinBorder(
|
this.setBorder(new CompoundSkinBorder(
|
||||||
BorderFactory.createLineBorder(Color.BLACK, 1),
|
BorderFactory.createLineBorder(Color.BLACK, 1),
|
||||||
@@ -196,6 +196,10 @@ public class FDialog extends SkinnedDialog implements ITitleBarOwner, KeyEventDi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean allowResize() {
|
||||||
|
return allowResize;
|
||||||
|
}
|
||||||
|
|
||||||
//relay certain methods to the inner panel if it has been initialized
|
//relay certain methods to the inner panel if it has been initialized
|
||||||
@Override
|
@Override
|
||||||
public void setContentPane(Container contentPane) {
|
public void setContentPane(Container contentPane) {
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ public abstract class FTitleBarBase extends SkinnedMenuBar {
|
|||||||
layout.putConstraint(SpringLayout.SOUTH, btnLockTitleBar, 0, SpringLayout.SOUTH, btnMinimize);
|
layout.putConstraint(SpringLayout.SOUTH, btnLockTitleBar, 0, SpringLayout.SOUTH, btnMinimize);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
int offset = owner instanceof FDialog && ((FDialog)owner).allowResize() ? 0 : -1;
|
||||||
add(btnClose);
|
add(btnClose);
|
||||||
layout.putConstraint(SpringLayout.EAST, btnClose, -1, SpringLayout.EAST, this);
|
layout.putConstraint(SpringLayout.EAST, btnClose, offset, SpringLayout.EAST, this);
|
||||||
layout.putConstraint(SpringLayout.SOUTH, btnClose, 0, SpringLayout.SOUTH, this);
|
layout.putConstraint(SpringLayout.SOUTH, btnClose, 0, SpringLayout.SOUTH, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,7 +166,7 @@ public abstract class FTitleBarBase extends SkinnedMenuBar {
|
|||||||
@Override
|
@Override
|
||||||
public void repaintSelf() {
|
public void repaintSelf() {
|
||||||
final Container window = FTitleBarBase.this.getParent().getParent().getParent();
|
final Container window = FTitleBarBase.this.getParent().getParent().getParent();
|
||||||
if (window instanceof FDialog) { //prevent hover effect coverring up rounded border
|
if (window instanceof FDialog && !((FDialog)window).allowResize()) { //prevent hover effect covering up rounded border
|
||||||
window.repaint(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
window.repaint(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class FloatingCardArea extends CardArea {
|
|||||||
|
|
||||||
private PlayerView player;
|
private PlayerView player;
|
||||||
private final ZoneType zone;
|
private final ZoneType zone;
|
||||||
|
private final String title;
|
||||||
private final FDialog window = new FDialog(false, true, "0");
|
private final FDialog window = new FDialog(false, true, "0");
|
||||||
|
|
||||||
private FloatingCardArea(PlayerView player0, ZoneType zone0) {
|
private FloatingCardArea(PlayerView player0, ZoneType zone0) {
|
||||||
@@ -86,7 +87,7 @@ public class FloatingCardArea extends CardArea {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
window.setTitle(Lang.getPossessedObject(player0.getName(), zone0.name()));
|
title = Lang.getPossessedObject(player0.getName(), zone0.name()) + " (%d)";
|
||||||
window.addWindowListener(new WindowAdapter() {
|
window.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(final WindowEvent e) {
|
public void windowClosing(final WindowEvent e) {
|
||||||
@@ -102,7 +103,6 @@ public class FloatingCardArea extends CardArea {
|
|||||||
private void showWindow() {
|
private void showWindow() {
|
||||||
FFrame mainFrame = Singletons.getView().getFrame();
|
FFrame mainFrame = Singletons.getView().getFrame();
|
||||||
window.setSize(mainFrame.getWidth() / 4, mainFrame.getHeight() * 2 / 3);
|
window.setSize(mainFrame.getWidth() / 4, mainFrame.getHeight() * 2 / 3);
|
||||||
window.setLocationRelativeTo(mainFrame);
|
|
||||||
window.setVisible(true);
|
window.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +120,7 @@ public class FloatingCardArea extends CardArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setCardPanels(cardPanels);
|
setCardPanels(cardPanels);
|
||||||
|
window.setTitle(String.format(title, cardPanels.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user