Some more changes to support GUI size for high resolutions.

This commit is contained in:
LevelX2 2016-02-09 03:06:32 +01:00
parent c7aa7c9238
commit a07db4cb8e
9 changed files with 148 additions and 24 deletions

View file

@ -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);

View file

@ -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

View file

@ -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();