mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Changed the connect/disconnect button to include the text directly in the menu button.
This commit is contained in:
parent
d6a15a5b8b
commit
ac9b03d277
3 changed files with 61 additions and 47 deletions
|
|
@ -82,7 +82,7 @@
|
||||||
<Image iconType="3" name="/menu/preferences.png"/>
|
<Image iconType="3" name="/menu/preferences.png"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="Preferences"/>
|
<Property name="text" type="java.lang.String" value="Preferences"/>
|
||||||
<Property name="toolTipText" type="java.lang.String" value="Change the settings for the different areas of XMage."/>
|
<Property name="toolTipText" type="java.lang.String" value="By changing the settings in the preferences window you can adjust the look and behaviour of xmage."/>
|
||||||
<Property name="focusable" type="boolean" value="false"/>
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||||
|
|
@ -107,14 +107,6 @@
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnConnectActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnConnectActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="lblStatus">
|
|
||||||
<Properties>
|
|
||||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
|
||||||
<Property name="text" type="java.lang.String" value="Not connected"/>
|
|
||||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
|
||||||
<Property name="inheritsPopupMenu" type="boolean" value="false"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JToolBar$Separator" name="jSeparator1">
|
<Component class="javax.swing.JToolBar$Separator" name="jSeparator1">
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JButton" name="btnDeckEditor">
|
<Component class="javax.swing.JButton" name="btnDeckEditor">
|
||||||
|
|
@ -174,7 +166,7 @@
|
||||||
<Image iconType="3" name="/menu/symbol.png"/>
|
<Image iconType="3" name="/menu/symbol.png"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="Symbols"/>
|
<Property name="text" type="java.lang.String" value="Symbols"/>
|
||||||
<Property name="toolTipText" type="java.lang.String" value="<HTML>Load symbols from the internet.<br>
You need to do that only once."/>
|
<Property name="toolTipText" type="java.lang.String" value="<HTML>Load the mana and other card symbols from the internet.<br>
Otherwise you only see the replacement sequence like {U} for blue mana symbol.<br>
You need to do that only once."/>
|
||||||
<Property name="focusable" type="boolean" value="false"/>
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
private static final String GRAY_MODE_ARG = "-gray";
|
private static final String GRAY_MODE_ARG = "-gray";
|
||||||
private static final String FILL_SCREEN_ARG = "-fullscreen";
|
private static final String FILL_SCREEN_ARG = "-fullscreen";
|
||||||
|
|
||||||
|
private static final String NOT_CONNECTED_TEXT = "<not connected>";
|
||||||
private static MageFrame instance;
|
private static MageFrame instance;
|
||||||
|
|
||||||
private final ConnectDialog connectDialog;
|
private final ConnectDialog connectDialog;
|
||||||
|
|
@ -300,7 +301,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
setGUISize();
|
setGUISize();
|
||||||
|
setConnectButtonText(NOT_CONNECTED_TEXT);
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
disableButtons();
|
disableButtons();
|
||||||
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_CHECK, "false").equals("true")) {
|
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_CHECK, "false").equals("true")) {
|
||||||
|
|
@ -329,7 +330,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
private void setWindowTitle() {
|
private void setWindowTitle() {
|
||||||
setTitle(TITLE_NAME + " Client: "
|
setTitle(TITLE_NAME + " Client: "
|
||||||
+ (VERSION == null ? "<not available>" : VERSION.toString()) + " Server: "
|
+ (VERSION == null ? "<not available>" : VERSION.toString()) + " Server: "
|
||||||
+ ((SessionHandler.getSession() != null && SessionHandler.isConnected()) ? SessionHandler.getVersionInfo() : "<not connected>"));
|
+ ((SessionHandler.getSession() != null && SessionHandler.isConnected()) ? SessionHandler.getVersionInfo() : NOT_CONNECTED_TEXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTooltipContainer() {
|
private void addTooltipContainer() {
|
||||||
|
|
@ -797,7 +798,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnPreferences = new javax.swing.JButton();
|
btnPreferences = new javax.swing.JButton();
|
||||||
jSeparator4 = new javax.swing.JToolBar.Separator();
|
jSeparator4 = new javax.swing.JToolBar.Separator();
|
||||||
btnConnect = new javax.swing.JButton();
|
btnConnect = new javax.swing.JButton();
|
||||||
lblStatus = new javax.swing.JLabel();
|
|
||||||
jSeparator1 = new javax.swing.JToolBar.Separator();
|
jSeparator1 = new javax.swing.JToolBar.Separator();
|
||||||
btnDeckEditor = new javax.swing.JButton();
|
btnDeckEditor = new javax.swing.JButton();
|
||||||
jSeparator2 = new javax.swing.JToolBar.Separator();
|
jSeparator2 = new javax.swing.JToolBar.Separator();
|
||||||
|
|
@ -827,11 +827,15 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
|
|
||||||
btnPreferences.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/preferences.png"))); // NOI18N
|
btnPreferences.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/preferences.png"))); // NOI18N
|
||||||
btnPreferences.setText("Preferences");
|
btnPreferences.setText("Preferences");
|
||||||
btnPreferences.setToolTipText("Change the settings for the different areas of XMage.");
|
btnPreferences.setToolTipText("By changing the settings in the preferences window you can adjust the look and behaviour of xmage.");
|
||||||
btnPreferences.setFocusable(false);
|
btnPreferences.setFocusable(false);
|
||||||
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnPreferences.addActionListener(evt -> btnPreferencesActionPerformed(evt));
|
btnPreferences.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btnPreferencesActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
mageToolbar.add(btnPreferences);
|
mageToolbar.add(btnPreferences);
|
||||||
mageToolbar.add(jSeparator4);
|
mageToolbar.add(jSeparator4);
|
||||||
|
|
||||||
|
|
@ -840,14 +844,12 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnConnect.setFocusable(false);
|
btnConnect.setFocusable(false);
|
||||||
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnConnect.addActionListener(evt -> btnConnectActionPerformed(evt));
|
btnConnect.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btnConnectActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
mageToolbar.add(btnConnect);
|
mageToolbar.add(btnConnect);
|
||||||
|
|
||||||
lblStatus.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
|
||||||
lblStatus.setText("Not connected");
|
|
||||||
lblStatus.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
|
||||||
lblStatus.setInheritsPopupMenu(false);
|
|
||||||
mageToolbar.add(lblStatus);
|
|
||||||
mageToolbar.add(jSeparator1);
|
mageToolbar.add(jSeparator1);
|
||||||
|
|
||||||
btnDeckEditor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/deck_editor.png"))); // NOI18N
|
btnDeckEditor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/deck_editor.png"))); // NOI18N
|
||||||
|
|
@ -856,7 +858,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnDeckEditor.setFocusable(false);
|
btnDeckEditor.setFocusable(false);
|
||||||
btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnDeckEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnDeckEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnDeckEditor.addActionListener(evt -> btnDeckEditorActionPerformed(evt));
|
btnDeckEditor.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btnDeckEditorActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
mageToolbar.add(btnDeckEditor);
|
mageToolbar.add(btnDeckEditor);
|
||||||
mageToolbar.add(jSeparator2);
|
mageToolbar.add(jSeparator2);
|
||||||
|
|
||||||
|
|
@ -866,7 +872,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnCollectionViewer.setFocusable(false);
|
btnCollectionViewer.setFocusable(false);
|
||||||
btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnCollectionViewer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnCollectionViewer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnCollectionViewer.addActionListener(evt -> btnCollectionViewerActionPerformed(evt));
|
btnCollectionViewer.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btnCollectionViewerActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
mageToolbar.add(btnCollectionViewer);
|
mageToolbar.add(btnCollectionViewer);
|
||||||
mageToolbar.add(jSeparator5);
|
mageToolbar.add(jSeparator5);
|
||||||
|
|
||||||
|
|
@ -876,17 +886,25 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnSendFeedback.setFocusable(false);
|
btnSendFeedback.setFocusable(false);
|
||||||
btnSendFeedback.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnSendFeedback.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnSendFeedback.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnSendFeedback.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnSendFeedback.addActionListener(evt -> btnSendFeedbackActionPerformed(evt));
|
btnSendFeedback.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btnSendFeedbackActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
mageToolbar.add(btnSendFeedback);
|
mageToolbar.add(btnSendFeedback);
|
||||||
mageToolbar.add(jSeparator6);
|
mageToolbar.add(jSeparator6);
|
||||||
|
|
||||||
btnSymbols.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/symbol.png"))); // NOI18N
|
btnSymbols.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menu/symbol.png"))); // NOI18N
|
||||||
btnSymbols.setText("Symbols");
|
btnSymbols.setText("Symbols");
|
||||||
btnSymbols.setToolTipText("<HTML>Load symbols from the internet.<br>\nYou need to do that only once.");
|
btnSymbols.setToolTipText("<HTML>Load the mana and other card symbols from the internet.<br>\nOtherwise you only see the replacement sequence like {U} for blue mana symbol.<br>\nYou need to do that only once.");
|
||||||
btnSymbols.setFocusable(false);
|
btnSymbols.setFocusable(false);
|
||||||
btnSymbols.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnSymbols.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnSymbols.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnSymbols.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnSymbols.addActionListener(evt -> btnSymbolsActionPerformed(evt));
|
btnSymbols.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btnSymbolsActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
mageToolbar.add(btnSymbols);
|
mageToolbar.add(btnSymbols);
|
||||||
mageToolbar.add(jSeparatorSymbols);
|
mageToolbar.add(jSeparatorSymbols);
|
||||||
|
|
||||||
|
|
@ -896,7 +914,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnImages.setFocusable(false);
|
btnImages.setFocusable(false);
|
||||||
btnImages.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnImages.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnImages.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnImages.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnImages.addActionListener(evt -> btnImagesActionPerformed(evt));
|
btnImages.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btnImagesActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
mageToolbar.add(btnImages);
|
mageToolbar.add(btnImages);
|
||||||
mageToolbar.add(jSeparatorImages);
|
mageToolbar.add(jSeparatorImages);
|
||||||
|
|
||||||
|
|
@ -906,7 +928,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnAbout.setFocusable(false);
|
btnAbout.setFocusable(false);
|
||||||
btnAbout.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnAbout.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnAbout.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnAbout.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnAbout.addActionListener(evt -> btnAboutActionPerformed(evt));
|
btnAbout.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btnAboutActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
mageToolbar.add(btnAbout);
|
mageToolbar.add(btnAbout);
|
||||||
mageToolbar.add(jSeparator7);
|
mageToolbar.add(jSeparator7);
|
||||||
|
|
||||||
|
|
@ -1201,20 +1227,18 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
private javax.swing.JToolBar.Separator jSeparator7;
|
private javax.swing.JToolBar.Separator jSeparator7;
|
||||||
private javax.swing.JToolBar.Separator jSeparatorImages;
|
private javax.swing.JToolBar.Separator jSeparatorImages;
|
||||||
private javax.swing.JToolBar.Separator jSeparatorSymbols;
|
private javax.swing.JToolBar.Separator jSeparatorSymbols;
|
||||||
private javax.swing.JLabel lblStatus;
|
|
||||||
private javax.swing.JToolBar mageToolbar;
|
private javax.swing.JToolBar mageToolbar;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
private static final long serialVersionUID = -9104885239063142218L;
|
private static final long serialVersionUID = -9104885239063142218L;
|
||||||
private ImagePanel backgroundPane;
|
private ImagePanel backgroundPane;
|
||||||
private final TablesPane tablesPane;
|
private final TablesPane tablesPane;
|
||||||
// private CollectionViewerPane collectionViewerPane;
|
|
||||||
|
|
||||||
public void setStatusText(String status) {
|
public void setConnectButtonText(String status) {
|
||||||
this.lblStatus.setText(status);
|
this.btnConnect.setText(status);
|
||||||
changeGUISize(); // Needed to layout the tooltbar after text length change
|
changeGUISize(); // Needed to layout the tooltbar after text length change
|
||||||
this.lblStatus.repaint();
|
this.btnConnect.repaint();
|
||||||
this.lblStatus.revalidate();
|
this.btnConnect.revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MageUI getUI() {
|
public static MageUI getUI() {
|
||||||
|
|
@ -1272,11 +1296,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
@Override
|
@Override
|
||||||
public void connected(final String message) {
|
public void connected(final String message) {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
setStatusText(message);
|
setConnectButtonText(message);
|
||||||
enableButtons();
|
enableButtons();
|
||||||
} else {
|
} else {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
setStatusText(message);
|
setConnectButtonText(message);
|
||||||
enableButtons();
|
enableButtons();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1286,14 +1310,14 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
public void disconnected(final boolean errorCall) {
|
public void disconnected(final boolean errorCall) {
|
||||||
if (SwingUtilities.isEventDispatchThread()) { // Returns true if the current thread is an AWT event dispatching thread.
|
if (SwingUtilities.isEventDispatchThread()) { // Returns true if the current thread is an AWT event dispatching thread.
|
||||||
LOGGER.info("DISCONNECTED (Event Dispatch Thread)");
|
LOGGER.info("DISCONNECTED (Event Dispatch Thread)");
|
||||||
setStatusText("Not connected");
|
setConnectButtonText(NOT_CONNECTED_TEXT);
|
||||||
disableButtons();
|
disableButtons();
|
||||||
hideGames();
|
hideGames();
|
||||||
hideTables();
|
hideTables();
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("DISCONNECTED (NO Event Dispatch Thread)");
|
LOGGER.info("DISCONNECTED (NO Event Dispatch Thread)");
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
setStatusText("Not connected");
|
setConnectButtonText(NOT_CONNECTED_TEXT);
|
||||||
disableButtons();
|
disableButtons();
|
||||||
hideGames();
|
hideGames();
|
||||||
hideTables();
|
hideTables();
|
||||||
|
|
|
||||||
|
|
@ -35,15 +35,13 @@ package mage.client;
|
||||||
|
|
||||||
import java.awt.AWTEvent;
|
import java.awt.AWTEvent;
|
||||||
import java.awt.KeyboardFocusManager;
|
import java.awt.KeyboardFocusManager;
|
||||||
import java.beans.PropertyVetoException;
|
|
||||||
import javax.swing.*;
|
|
||||||
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public abstract class MagePane extends javax.swing.JLayeredPane {
|
public abstract class MagePane extends javax.swing.JLayeredPane {
|
||||||
|
|
||||||
private String title = "no title set";
|
private String title = "no title set";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue