Added tooltip to window titel bar to show longer titels of windows at least as tooltip.

This commit is contained in:
LevelX2 2012-11-09 01:28:28 +01:00
parent baedfd54bf
commit facfc6f1ce
4 changed files with 26 additions and 1 deletions

View file

@ -56,6 +56,7 @@ public class ExileZoneDialog extends MageDialog {
public void loadCards(ExileView exile, BigCard bigCard, UUID gameId) {
this.title = exile.getName();
this.setTitelBarToolTip(exile.getName());
boolean changed = false;
changed = cards.loadCards(exile, bigCard, gameId);
if (exile.size() > 0) {

View file

@ -157,6 +157,29 @@ public class MageDialog extends javax.swing.JInternalFrame {
this.setVisible(false);
}
public void setTitelBarToolTip(final String text) {
desktopIcon.setToolTipText(text); //tooltip on icon
Component[] children = desktopIcon.getComponents();
// if (children != null) {
// for(int i = 0; i < children.length; i++) {
// if (children[i] instanceof JButton){
// ((JButton)children[i]).setToolTipText(text);//tooltip on icon button
// break;
// }
// }
// }
children = getComponents();
if (children != null) {
for(int i = 0; i < children.length; i++) {
if (children[i].getClass().getName().equalsIgnoreCase(
"javax.swing.plaf.synth.SynthInternalFrameTitlePane")){
((JComponent)children[i]).setToolTipText(text);//tooltip on title bar
break;
}
}
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is

View file

@ -78,6 +78,7 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
public void loadCards(String name, CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean modal, Map<String, Serializable> options) {
this.reloaded = true;
this.title = name;
this.setTitelBarToolTip(name);
cardArea.loadCards(showCards, bigCard, dimension, gameId, this);
if (options != null) {
if (options.containsKey("chosen")) {

View file

@ -539,7 +539,7 @@ public class GamePanel extends javax.swing.JPanel {
ShowCardsDialog newReveal = new ShowCardsDialog();
lookedAt.put(looked.getName(), newReveal);
}
lookedAt.get(looked.getName()).loadCards("LookedAt by " + looked.getName(), looked.getCards(), bigCard, Config.dimensions, gameId, false);
lookedAt.get(looked.getName()).loadCards("Looked at by " + looked.getName(), looked.getCards(), bigCard, Config.dimensions, gameId, false);
}
}