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) {
|
||||
super(JOptionPane.getRootFrame(), modal0);
|
||||
allowResize = allowResize0;
|
||||
setUndecorated(true);
|
||||
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);
|
||||
addMoveSupport();
|
||||
|
||||
allowResize = allowResize0;
|
||||
if (allowResize) {
|
||||
this.setBorder(new CompoundSkinBorder(
|
||||
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
|
||||
@Override
|
||||
public void setContentPane(Container contentPane) {
|
||||
|
||||
@@ -63,8 +63,9 @@ public abstract class FTitleBarBase extends SkinnedMenuBar {
|
||||
layout.putConstraint(SpringLayout.SOUTH, btnLockTitleBar, 0, SpringLayout.SOUTH, btnMinimize);
|
||||
}
|
||||
else {
|
||||
int offset = owner instanceof FDialog && ((FDialog)owner).allowResize() ? 0 : -1;
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -165,7 +166,7 @@ public abstract class FTitleBarBase extends SkinnedMenuBar {
|
||||
@Override
|
||||
public void repaintSelf() {
|
||||
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());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -63,6 +63,7 @@ public class FloatingCardArea extends CardArea {
|
||||
|
||||
private PlayerView player;
|
||||
private final ZoneType zone;
|
||||
private final String title;
|
||||
private final FDialog window = new FDialog(false, true, "0");
|
||||
|
||||
private FloatingCardArea(PlayerView player0, ZoneType zone0) {
|
||||
@@ -86,7 +87,7 @@ public class FloatingCardArea extends CardArea {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
window.setTitle(Lang.getPossessedObject(player0.getName(), zone0.name()));
|
||||
title = Lang.getPossessedObject(player0.getName(), zone0.name()) + " (%d)";
|
||||
window.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(final WindowEvent e) {
|
||||
@@ -102,7 +103,6 @@ public class FloatingCardArea extends CardArea {
|
||||
private void showWindow() {
|
||||
FFrame mainFrame = Singletons.getView().getFrame();
|
||||
window.setSize(mainFrame.getWidth() / 4, mainFrame.getHeight() * 2 / 3);
|
||||
window.setLocationRelativeTo(mainFrame);
|
||||
window.setVisible(true);
|
||||
}
|
||||
|
||||
@@ -120,6 +120,7 @@ public class FloatingCardArea extends CardArea {
|
||||
}
|
||||
}
|
||||
setCardPanels(cardPanels);
|
||||
window.setTitle(String.format(title, cardPanels.size()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user