mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Fix so menu bar not blanked out when changing skins and status message is retained
This commit is contained in:
@@ -114,7 +114,6 @@ public enum CHomeUI implements ICDoc, IMenuProvider {
|
|||||||
|
|
||||||
private void setupMyMenuBar() {
|
private void setupMyMenuBar() {
|
||||||
Singletons.getControl().getMenuBar().setupMenuBar(this);
|
Singletons.getControl().getMenuBar().setupMenuBar(this);
|
||||||
Singletons.getControl().getMenuBar().setStatusText("F1 : hide menu");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|||||||
@@ -14,21 +14,24 @@ import forge.gui.menus.ForgeMenu;
|
|||||||
import forge.gui.menus.HelpMenu;
|
import forge.gui.menus.HelpMenu;
|
||||||
import forge.gui.menus.LayoutMenu;
|
import forge.gui.menus.LayoutMenu;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
import forge.gui.toolbox.FSkin.JLabelSkin;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class FMenuBar extends JMenuBar {
|
public class FMenuBar extends JMenuBar {
|
||||||
|
|
||||||
private JLabel statusCaption;
|
private String statusText;
|
||||||
|
private JLabel lblStatus;
|
||||||
private IMenuProvider provider;
|
private IMenuProvider provider;
|
||||||
|
|
||||||
public FMenuBar(JFrame f) {
|
public FMenuBar(JFrame f) {
|
||||||
f.setJMenuBar(this);
|
f.setJMenuBar(this);
|
||||||
setPreferredSize(new Dimension(f.getWidth(), 26));
|
setPreferredSize(new Dimension(f.getWidth(), 26));
|
||||||
refresh();
|
refresh();
|
||||||
|
setStatusText(""); //set default status text
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupMenuBar(IMenuProvider provider0) {
|
public void setupMenuBar(IMenuProvider provider0) {
|
||||||
this.provider = provider0;
|
provider = provider0;
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,25 +41,31 @@ public class FMenuBar extends JMenuBar {
|
|||||||
addProviderMenus();
|
addProviderMenus();
|
||||||
add(LayoutMenu.getMenu());
|
add(LayoutMenu.getMenu());
|
||||||
add(HelpMenu.getMenu());
|
add(HelpMenu.getMenu());
|
||||||
setStatusCaption();
|
addStatusLabel();
|
||||||
repaint();
|
revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a label to the right-hand side of the MenuBar which can
|
* Adds a label to the right-hand side of the MenuBar which can
|
||||||
* be used to show hints or status information.
|
* be used to show hints or status information.
|
||||||
*/
|
*/
|
||||||
private void setStatusCaption() {
|
private void addStatusLabel() {
|
||||||
add(Box.createHorizontalGlue()); // align right hack/patch.
|
add(Box.createHorizontalGlue()); // align right hack/patch.
|
||||||
statusCaption = new JLabel();
|
lblStatus = new JLabel(statusText);
|
||||||
statusCaption.setForeground(getForeground());
|
JLabelSkin<JLabel> labelSkin = FSkin.get(lblStatus);
|
||||||
statusCaption.setFont(FSkin.getItalicFont(11));
|
labelSkin.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
statusCaption.setOpaque(false);
|
lblStatus.setFont(FSkin.getItalicFont(11));
|
||||||
add(statusCaption);
|
lblStatus.setOpaque(false);
|
||||||
|
add(lblStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatusText(String text) {
|
public void setStatusText(String text) {
|
||||||
statusCaption.setText(text.trim() + " ");
|
statusText = text.trim();
|
||||||
|
if (statusText.isEmpty()) {
|
||||||
|
statusText = "F1 : hide menu"; //show shortcut to hide menu if no other status to show
|
||||||
|
}
|
||||||
|
statusText += " "; //add padding from right edge of menu bar
|
||||||
|
lblStatus.setText(statusText);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addProviderMenus() {
|
private void addProviderMenus() {
|
||||||
|
|||||||
Reference in New Issue
Block a user