mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
Some more changes to support GUI size for high resolutions.
This commit is contained in:
parent
c7aa7c9238
commit
a07db4cb8e
9 changed files with 148 additions and 24 deletions
|
|
@ -33,9 +33,9 @@
|
|||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="mageToolbar" min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="desktopPane" max="32767" attributes="0"/>
|
||||
<Component id="mageToolbar" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
|
||||
<Component id="desktopPane" pref="145" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -60,6 +60,18 @@
|
|||
<Properties>
|
||||
<Property name="floatable" type="boolean" value="false"/>
|
||||
<Property name="rollover" type="boolean" value="true"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Segoe UI" size="48" style="0"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[614, 60]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[566, 60]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[614, 60]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ import java.awt.AlphaComposite;
|
|||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
|
|
@ -112,6 +114,7 @@ import mage.client.remote.CallbackClientImpl;
|
|||
import mage.client.table.TablesPane;
|
||||
import mage.client.tournament.TournamentPane;
|
||||
import mage.client.util.EDTExceptionHandler;
|
||||
import mage.client.util.FontSizeHelper;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.SystemUtil;
|
||||
import mage.client.util.audio.MusicPlayer;
|
||||
|
|
@ -235,6 +238,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
try {
|
||||
UIManager.put("desktop", new Color(0, 0, 0, 0));
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
|
||||
// Change default font and row size for JTables
|
||||
Font font = FontSizeHelper.getTableFont();
|
||||
UIManager.put("Table.font", font);
|
||||
UIManager.put("Table.rowHeight", FontSizeHelper.getTableRowHeight());
|
||||
} catch (Exception ex) {
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
|
|
@ -355,6 +362,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
UI.addButton(MageComponents.TABLES_MENU_BUTTON, btnGames);
|
||||
|
||||
setGUISize();
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
@ -836,6 +845,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
mageToolbar.setFloatable(false);
|
||||
mageToolbar.setRollover(true);
|
||||
mageToolbar.setFont(new java.awt.Font("Segoe UI", 0, 48)); // NOI18N
|
||||
mageToolbar.setMaximumSize(new java.awt.Dimension(614, 60));
|
||||
mageToolbar.setMinimumSize(new java.awt.Dimension(566, 60));
|
||||
mageToolbar.setPreferredSize(new java.awt.Dimension(614, 60));
|
||||
|
||||
btnSendFeedback.setText("Feedback");
|
||||
btnSendFeedback.setFocusable(false);
|
||||
|
|
@ -950,9 +963,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(desktopPane))
|
||||
.addComponent(mageToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2, 2, 2)
|
||||
.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
|
|
@ -1055,9 +1068,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
if (setActive) {
|
||||
setActive(tablesPane);
|
||||
} else // if other panel was already shown, mamke sure it's topmost again
|
||||
if (topPanebefore != null) {
|
||||
{
|
||||
if (topPanebefore != null) {
|
||||
setActive(topPanebefore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hideGames() {
|
||||
|
|
@ -1387,6 +1402,40 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
callbackClient.processCallback(callback);
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
tablesPane.changeGUISize();
|
||||
setGUISize();
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
|
||||
Font font = FontSizeHelper.getToolbarFont();
|
||||
mageToolbar.setFont(font);
|
||||
int newHeight = font.getSize() + 6;
|
||||
Dimension mageToolbarDimension = mageToolbar.getPreferredSize();
|
||||
mageToolbarDimension.height = newHeight + 6;
|
||||
mageToolbar.setMinimumSize(mageToolbarDimension);
|
||||
mageToolbar.setMaximumSize(mageToolbarDimension);
|
||||
mageToolbar.setPreferredSize(mageToolbarDimension);
|
||||
for (Component component : mageToolbar.getComponents()) {
|
||||
if (component instanceof JButton || component instanceof JLabel || component instanceof JToggleButton) {
|
||||
component.setFont(font);
|
||||
Dimension d = component.getPreferredSize();
|
||||
d.height = newHeight;
|
||||
component.setMinimumSize(d);
|
||||
component.setMaximumSize(d);
|
||||
|
||||
}
|
||||
if (component instanceof javax.swing.JToolBar.Separator) {
|
||||
Dimension d = component.getPreferredSize();
|
||||
d.height = newHeight;
|
||||
component.setMinimumSize(d);
|
||||
component.setMaximumSize(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MagePaneMenuItem extends JCheckBoxMenuItem {
|
||||
|
|
|
|||
|
|
@ -147,6 +147,9 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
txtMessage.setMaximumSize(new Dimension(txtMessage.getWidth(), height));
|
||||
txtMessage.setPreferredSize(new Dimension(txtMessage.getWidth(), height));
|
||||
txtMessage.setSize(new Dimension(txtMessage.getWidth(), height));
|
||||
if (connectedChat != null) {
|
||||
connectedChat.changeGUISize(font);
|
||||
}
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -435,9 +435,6 @@
|
|||
<Property name="text" type="java.lang.String" value="Size"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="<HTML>The size of the font used to display text."/>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Size"/>
|
||||
</AccessibilityProperties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
|
|
|
|||
|
|
@ -1998,7 +1998,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
// GUI Size
|
||||
if (getCachedValue(KEY_GUI_FONT_SIZE, 14) != dialog.sliderFontSize.getValue()) {
|
||||
save(prefs, dialog.sliderFontSize, KEY_GUI_FONT_SIZE, "true", "false", UPDATE_CACHE_POLICY);
|
||||
FontSizeHelper.updateGUI();
|
||||
FontSizeHelper.changeGUISize();
|
||||
}
|
||||
|
||||
// Phases & Priority
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
package mage.client.table;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -53,6 +55,7 @@ import mage.client.chat.ChatPanelBasic;
|
|||
import static mage.client.chat.ChatPanelBasic.CHAT_ALPHA;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_WIDTH;
|
||||
import mage.client.util.FontSizeHelper;
|
||||
import mage.client.util.MageTableRowSorter;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
||||
|
|
@ -85,6 +88,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
jTablePlayers.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
jTablePlayers.setForeground(Color.white);
|
||||
jTablePlayers.setRowSorter(new MageTableRowSorter(userTableModel));
|
||||
setGUISize();
|
||||
|
||||
TableUtil.setColumnWidthAndOrder(jTablePlayers, DEFAULT_COLUMNS_WIDTH, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
|
||||
userTableModel.initHeaderTooltips();
|
||||
|
|
@ -113,6 +117,21 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
jScrollPaneTalk.cleanUp();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
Font font = FontSizeHelper.getTableFont();
|
||||
jTablePlayers.getTableHeader().setFont(font);
|
||||
int rowHeight = FontSizeHelper.getTableRowHeight();
|
||||
jTablePlayers.getTableHeader().setPreferredSize(new Dimension(rowHeight, rowHeight));
|
||||
font = FontSizeHelper.getTabFont();
|
||||
jTabbedPaneText.setFont(font);
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
public void setSplitDividerLocation(int location) {
|
||||
if (jSplitPane1 != null) {
|
||||
jSplitPane1.setDividerLocation(location);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
*/
|
||||
package mage.client.table;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -39,7 +39,9 @@ import mage.client.plugins.impl.Plugins;
|
|||
*/
|
||||
public class TablesPane extends MagePane {
|
||||
|
||||
/** Creates new form TablesPane */
|
||||
/**
|
||||
* Creates new form TablesPane
|
||||
*/
|
||||
public TablesPane() {
|
||||
boolean initialized = false;
|
||||
if (Plugins.getInstance().isThemePluginLoaded()) {
|
||||
|
|
@ -56,11 +58,15 @@ public class TablesPane extends MagePane {
|
|||
initComponents();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void cleanUp() {
|
||||
tablesPanel.cleanUp();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
tablesPanel.changeGUISize();
|
||||
}
|
||||
|
||||
public void showTables() {
|
||||
UUID roomId = MageFrame.getSession().getMainRoomId();
|
||||
if (roomId != null) {
|
||||
|
|
@ -79,10 +85,10 @@ public class TablesPane extends MagePane {
|
|||
tablesPanel.getChatPanel().clear();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
@ -108,17 +114,16 @@ public class TablesPane extends MagePane {
|
|||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE)
|
||||
);
|
||||
pack();
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.table.TablesPanel tablesPanel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ package mage.client.table;
|
|||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
|
|
@ -79,6 +81,7 @@ import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_ORDER;
|
|||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH;
|
||||
import mage.client.dialog.TableWaitingDialog;
|
||||
import mage.client.util.ButtonColumn;
|
||||
import mage.client.util.FontSizeHelper;
|
||||
import mage.client.util.MageTableRowSorter;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
|
|
@ -141,6 +144,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH, PreferencesDialog.KEY_TABLES_COLUMNS_ORDER);
|
||||
|
||||
tableCompleted.setRowSorter(new MageTableRowSorter(matchesModel));
|
||||
setGUISize();
|
||||
|
||||
chatPanelMain.getUserChatPanel().useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
|
||||
chatPanelMain.getUserChatPanel().setBorder(null);
|
||||
|
|
@ -276,6 +280,20 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
chatPanelMain.cleanUp();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
chatPanelMain.changeGUISize();
|
||||
setGUISize();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
Font font = FontSizeHelper.getTableFont();
|
||||
tableTables.getTableHeader().setFont(font);
|
||||
int rowHeight = FontSizeHelper.getTableRowHeight();
|
||||
tableTables.getTableHeader().setPreferredSize(new Dimension(rowHeight, rowHeight));
|
||||
tableCompleted.getTableHeader().setFont(font);
|
||||
tableCompleted.getTableHeader().setPreferredSize(new Dimension(rowHeight, rowHeight));
|
||||
}
|
||||
|
||||
private void saveDividerLocations() {
|
||||
// save panel sizes and divider locations.
|
||||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
|
|
|
|||
|
|
@ -21,9 +21,30 @@ public class FontSizeHelper {
|
|||
return new java.awt.Font("Arial", 0, fontSize);
|
||||
}
|
||||
|
||||
public static void updateGUI() {
|
||||
public static Font getTableFont() {
|
||||
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
|
||||
return new java.awt.Font("Arial", 0, fontSize);
|
||||
}
|
||||
|
||||
public static Font getToolbarFont() {
|
||||
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
|
||||
return new java.awt.Font("Arial", 0, fontSize);
|
||||
}
|
||||
|
||||
public static int getTableRowHeight() {
|
||||
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
|
||||
return fontSize + 6;
|
||||
}
|
||||
|
||||
public static Font getTabFont() {
|
||||
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
|
||||
return new java.awt.Font("Arial", 0, fontSize);
|
||||
}
|
||||
|
||||
public static void changeGUISize() {
|
||||
for (ChatPanelBasic chatPanel : MageFrame.getChatPanels().values()) {
|
||||
chatPanel.changeGUISize(getChatFont());
|
||||
}
|
||||
MageFrame.getInstance().changeGUISize();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue