mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Some more changes to GUI to better support high screen resolutions.
This commit is contained in:
parent
db7e4aea2e
commit
7b79de8e40
7 changed files with 52 additions and 20 deletions
|
|
@ -237,6 +237,7 @@ 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");
|
||||
FontSizeHelper.setGUISize();
|
||||
// Change default font and row size for JTables
|
||||
Font font = FontSizeHelper.getTableFont();
|
||||
UIManager.put("Table.font", font);
|
||||
|
|
@ -244,7 +245,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
} catch (Exception ex) {
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
FontSizeHelper.setGUISize();
|
||||
|
||||
ManaSymbols.loadImages();
|
||||
Plugins.getInstance().loadPlugins();
|
||||
|
||||
|
|
@ -1068,9 +1069,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() {
|
||||
|
|
@ -1402,6 +1405,13 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
setGUISize();
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
private void setGUISize() {
|
||||
Font font = FontSizeHelper.getToolbarFont();
|
||||
// Tables
|
||||
if (tablesPane != null) {
|
||||
tablesPane.changeGUISize();
|
||||
|
|
@ -1419,13 +1429,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
((TournamentPane) component).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();
|
||||
|
|
@ -1449,6 +1452,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
component.setMaximumSize(d);
|
||||
}
|
||||
}
|
||||
balloonTip.setFont(FontSizeHelper.tooltipFont);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,6 +138,8 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
txtMessage.setFont(font);
|
||||
if (jScrollPaneTxt != null) {
|
||||
jScrollPaneTxt.setFont(font);
|
||||
jScrollPaneTxt.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
|
||||
jScrollPaneTxt.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
|
||||
}
|
||||
int height = 30;
|
||||
if (font.getSize() > 20) {
|
||||
|
|
@ -150,8 +152,6 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
if (connectedChat != null) {
|
||||
connectedChat.changeGUISize(font);
|
||||
}
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
public ChatType getChatType() {
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ public class ChatPanelSeparated extends ChatPanelBasic {
|
|||
if (systemMessagesPane != null) {
|
||||
systemMessagesPane.setFont(font);
|
||||
}
|
||||
|
||||
super.changeGUISize(font);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
|
@ -124,11 +125,14 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
private void setGUISize() {
|
||||
Font font = FontSizeHelper.getTableFont();
|
||||
jTablePlayers.getTableHeader().setFont(font);
|
||||
jTablePlayers.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
|
||||
font = FontSizeHelper.getTabFont();
|
||||
jTabbedPaneText.setFont(font);
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
jTablePlayers.getTableHeader().setPreferredSize(new Dimension((int) jTablePlayers.getTableHeader().getPreferredSize().getWidth(), FontSizeHelper.tableHeaderHeight));
|
||||
jScrollPanePlayers.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
|
||||
jScrollPanePlayers.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
|
||||
jScrollPaneSystem.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
|
||||
jScrollPaneSystem.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
|
||||
|
||||
jTabbedPaneText.setFont(FontSizeHelper.getTabFont());
|
||||
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
|
||||
}
|
||||
|
||||
public void setSplitDividerLocation(int location) {
|
||||
|
|
@ -146,7 +150,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
|
||||
class UserTableModel extends AbstractTableModel {
|
||||
|
||||
private final String[] columnNames = new String[]{"Loc", "Players", "Matches", "MQ%", "Tourneys", "TQ%", "Games", "Connection"};
|
||||
private final String[] columnNames = new String[]{"Loc", "Players", "Matches", "MQP", "Tourneys", "TQP", "Games", "Connection"};
|
||||
private UsersView[] players = new UsersView[0];
|
||||
|
||||
public void loadData(Collection<RoomUsersView> roomUserInfoList) throws MageRemoteException {
|
||||
|
|
@ -217,7 +221,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
+ "<br>T = number of matches lost because of match timeout";
|
||||
break;
|
||||
case 3:
|
||||
tooltipText = "<HTML><b>%-Ratio of matches played to matches quit</b>"
|
||||
tooltipText = "<HTML><b>Percent-Ratio of matches played related to matches quit</b>"
|
||||
+ "<br>this calculation does not include tournament matches";
|
||||
break;
|
||||
case 4:
|
||||
|
|
@ -227,7 +231,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
+ "<br>R = number of tournaments left during rounds";
|
||||
break;
|
||||
case 5:
|
||||
tooltipText = "<HTML><b>%-Ratio of tournament matches played to tournament matches quit</b>"
|
||||
tooltipText = "<HTML><b>Percent-Ratio of tournament matches played related to tournament matches quit</b>"
|
||||
+ "<br>this calculation does not include non tournament matches";
|
||||
break;
|
||||
case 6:
|
||||
|
|
@ -399,7 +403,9 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
if (table.convertColumnIndexToModel(vColIndex) != curCol) {
|
||||
if (col != null) {
|
||||
MageFrame.getInstance().getBalloonTip().setAttachedComponent(header);
|
||||
MageFrame.getInstance().getBalloonTip().setTextContents(tips.get(table.convertColumnIndexToModel(vColIndex)));
|
||||
JLabel content = new JLabel(tips.get(table.convertColumnIndexToModel(vColIndex)));
|
||||
content.setFont(FontSizeHelper.tooltipFont);
|
||||
MageFrame.getInstance().getBalloonTip().setContents(content);
|
||||
ToolTipUtils.balloonToToolTip(MageFrame.getInstance().getBalloonTip(), 600, 10000);
|
||||
} else {
|
||||
MageFrame.getInstance().getBalloonTip().setTextContents("");
|
||||
|
|
|
|||
|
|
@ -291,6 +291,10 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
tableTables.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
|
||||
tableCompleted.getTableHeader().setFont(font);
|
||||
tableCompleted.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
|
||||
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
|
||||
jSplitPane2.setDividerSize(FontSizeHelper.dividerBarSize);
|
||||
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
|
||||
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
|
||||
}
|
||||
|
||||
private void saveDividerLocations() {
|
||||
|
|
|
|||
|
|
@ -157,6 +157,12 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
tablePlayers.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
|
||||
tableMatches.getTableHeader().setFont(font);
|
||||
tableMatches.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
|
||||
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
|
||||
jSplitPane2.setDividerSize(FontSizeHelper.dividerBarSize);
|
||||
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
|
||||
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
|
||||
jScrollPane2.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
|
||||
jScrollPane2.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
|
||||
}
|
||||
|
||||
private void saveDividerLocations() {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ public class FontSizeHelper {
|
|||
public static int tableHeaderHeight = 24;
|
||||
public static int tableRowHeight = 20;
|
||||
|
||||
public static int dividerBarSize;
|
||||
public static int scrollBarSize;
|
||||
|
||||
public static Font tooltipFont = new java.awt.Font("Arial", 0, 12);
|
||||
|
||||
public static Font getChatFont() {
|
||||
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
|
||||
return new java.awt.Font("Arial", 0, fontSize);
|
||||
|
|
@ -70,13 +75,19 @@ public class FontSizeHelper {
|
|||
symbolTooltipSize = fontSize - 5;
|
||||
symbolPaySize = fontSize - 5;
|
||||
symbolCardSize = fontSize - 5;
|
||||
dividerBarSize = 10 + (fontSize / 4);
|
||||
scrollBarSize = 14 + (fontSize / 4);
|
||||
} else {
|
||||
symbolTooltipSize = fontSize;
|
||||
symbolPaySize = fontSize;
|
||||
symbolCardSize = fontSize;
|
||||
dividerBarSize = 10;
|
||||
scrollBarSize = 14;
|
||||
}
|
||||
tooltipFont = new java.awt.Font("Arial", 0, fontSize - 2);
|
||||
|
||||
tableRowHeight = fontSize + 4;
|
||||
tableHeaderHeight = fontSize + 10;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue