* Some more support for GUI resizing.

This commit is contained in:
LevelX2 2016-03-06 02:59:47 +01:00
parent c6f8d09229
commit 0c242bce5f
2 changed files with 69 additions and 94 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <Form version="1.2" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues> <AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@ -11,7 +11,7 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,-14,0,0,6,17"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,3,20,0,0,6,17"/>
</AuxValues> </AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
@ -464,7 +464,7 @@
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jSplitPaneTables" alignment="0" pref="643" max="32767" attributes="0"/> <Component id="jSplitPaneTables" alignment="0" pref="672" max="32767" attributes="0"/>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
@ -566,7 +566,7 @@
</Border> </Border>
</Property> </Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[664, 39]"/> <Dimension value="[516, 37]"/>
</Property> </Property>
</Properties> </Properties>
<Constraints> <Constraints>
@ -575,64 +575,37 @@
</Constraint> </Constraint>
</Constraints> </Constraints>
<Layout> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
<DimensionLayout dim="0"> <Property name="alignment" type="int" value="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jButtonNext" min="-2" pref="65" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" pref="1350" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButtonNext" alignment="3" min="-2" pref="17" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout> </Layout>
<SubComponents> <SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1"> <Component class="javax.swing.JButton" name="jButtonFooterNext">
<Properties>
<Property name="text" type="java.lang.String" value="Next"/>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonFooterNextActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabelFooterLabel">
<Properties> <Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="11" style="1"/> <Font name="Tahoma" size="11" style="1"/>
</Property> </Property>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="Message of the Day:"/> <Property name="text" type="java.lang.String" value="Message of the Day:"/>
<Property name="alignmentY" type="float" value="0.3"/> <Property name="alignmentY" type="float" value="0.3"/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabel2"> <Component class="javax.swing.JLabel" name="jLabelFooterText">
<Properties> <Properties>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="You are playing Mage version 0.7.5. Welcome! -- Mage dev team --"/> <Property name="text" type="java.lang.String" value="You are playing Mage version 0.7.5. Welcome! -- Mage dev team --"/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JButton" name="jButtonNext">
<Properties>
<Property name="text" type="java.lang.String" value="Next"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[55, 25]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[55, 25]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[55, 25]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonNextActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
</SubComponents> </SubComponents>

View file

@ -36,6 +36,7 @@ package mage.client.table;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.HeadlessException; import java.awt.HeadlessException;
import java.awt.Image; import java.awt.Image;
import java.awt.Point; import java.awt.Point;
@ -323,9 +324,26 @@ public class TablesPanel extends javax.swing.JPanel {
newimg = img.getScaledInstance(GUISizeHelper.menuFont.getSize(), GUISizeHelper.menuFont.getSize(), java.awt.Image.SCALE_SMOOTH); newimg = img.getScaledInstance(GUISizeHelper.menuFont.getSize(), GUISizeHelper.menuFont.getSize(), java.awt.Image.SCALE_SMOOTH);
btnStateFinished.setIcon(new ImageIcon(newimg)); btnStateFinished.setIcon(new ImageIcon(newimg));
int iconSize = 48 + GUISizeHelper.menuFont.getSize() * 2 - 15;
icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/match_new.png"));
img = icon.getImage();
newimg = img.getScaledInstance(iconSize, iconSize, java.awt.Image.SCALE_SMOOTH);
btnNewTable.setIcon(new ImageIcon(newimg));
icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/tourney_new.png"));
img = icon.getImage();
newimg = img.getScaledInstance(iconSize, iconSize, java.awt.Image.SCALE_SMOOTH);
btnNewTournament.setIcon(new ImageIcon(newimg));
for (JToggleButton component : filterButtons) { for (JToggleButton component : filterButtons) {
component.setFont(GUISizeHelper.menuFont); component.setFont(GUISizeHelper.menuFont);
} }
Dimension newDimension = new Dimension((int) jPanelBottom.getPreferredSize().getWidth(), GUISizeHelper.menuFont.getSize() + 28);
jPanelBottom.setMinimumSize(newDimension);
jPanelBottom.setPreferredSize(newDimension);
jButtonFooterNext.setFont(GUISizeHelper.menuFont);
jLabelFooterLabel.setFont(new Font(GUISizeHelper.menuFont.getName(), Font.BOLD, GUISizeHelper.menuFont.getSize()));
jLabelFooterText.setFont(GUISizeHelper.menuFont);
} }
private void saveDividerLocations() { private void saveDividerLocations() {
@ -509,8 +527,8 @@ public class TablesPanel extends javax.swing.JPanel {
this.jPanelBottom.setVisible(false); this.jPanelBottom.setVisible(false);
} else { } else {
this.jPanelBottom.setVisible(true); this.jPanelBottom.setVisible(true);
this.jLabel2.setText(serverMessages.get(0)); this.jLabelFooterText.setText(serverMessages.get(0));
this.jButtonNext.setVisible(serverMessages.size() > 1); this.jButtonFooterNext.setVisible(serverMessages.size() > 1);
} }
} }
@ -684,9 +702,9 @@ public class TablesPanel extends javax.swing.JPanel {
tableCompleted = new javax.swing.JTable(); tableCompleted = new javax.swing.JTable();
chatPanelMain = new mage.client.table.PlayersChatPanel(); chatPanelMain = new mage.client.table.PlayersChatPanel();
jPanelBottom = new javax.swing.JPanel(); jPanelBottom = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel(); jButtonFooterNext = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel(); jLabelFooterLabel = new javax.swing.JLabel();
jButtonNext = new javax.swing.JButton(); jLabelFooterText = new javax.swing.JLabel();
setLayout(new java.awt.GridBagLayout()); setLayout(new java.awt.GridBagLayout());
@ -1092,7 +1110,7 @@ public class TablesPanel extends javax.swing.JPanel {
); );
jPanelTablesLayout.setVerticalGroup( jPanelTablesLayout.setVerticalGroup(
jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanelTablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 643, Short.MAX_VALUE) .addComponent(jSplitPaneTables, javax.swing.GroupLayout.DEFAULT_SIZE, 672, Short.MAX_VALUE)
); );
jSplitPane1.setLeftComponent(jPanelTables); jSplitPane1.setLeftComponent(jPanelTables);
@ -1107,45 +1125,29 @@ public class TablesPanel extends javax.swing.JPanel {
add(jSplitPane1, gridBagConstraints); add(jSplitPane1, gridBagConstraints);
jPanelBottom.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); jPanelBottom.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jPanelBottom.setPreferredSize(new java.awt.Dimension(664, 39)); jPanelBottom.setPreferredSize(new java.awt.Dimension(516, 37));
jPanelBottom.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jButtonFooterNext.setText("Next");
jLabel1.setText("Message of the Day:"); jButtonFooterNext.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabel1.setAlignmentY(0.3F); jButtonFooterNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonFooterNext.setOpaque(false);
jLabel2.setText("You are playing Mage version 0.7.5. Welcome! -- Mage dev team --"); jButtonFooterNext.addActionListener(new java.awt.event.ActionListener() {
jButtonNext.setText("Next");
jButtonNext.setMaximumSize(new java.awt.Dimension(55, 25));
jButtonNext.setMinimumSize(new java.awt.Dimension(55, 25));
jButtonNext.setPreferredSize(new java.awt.Dimension(55, 25));
jButtonNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonNextActionPerformed(evt); jButtonFooterNextActionPerformed(evt);
} }
}); });
jPanelBottom.add(jButtonFooterNext);
javax.swing.GroupLayout jPanelBottomLayout = new javax.swing.GroupLayout(jPanelBottom); jLabelFooterLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jPanelBottom.setLayout(jPanelBottomLayout); jLabelFooterLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jPanelBottomLayout.setHorizontalGroup( jLabelFooterLabel.setText("Message of the Day:");
jPanelBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jLabelFooterLabel.setAlignmentY(0.3F);
.addGroup(jPanelBottomLayout.createSequentialGroup() jPanelBottom.add(jLabelFooterLabel);
.addComponent(jButtonNext, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) jLabelFooterText.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
.addComponent(jLabel1) jLabelFooterText.setText("You are playing Mage version 0.7.5. Welcome! -- Mage dev team --");
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) jPanelBottom.add(jLabelFooterText);
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 1350, Short.MAX_VALUE)
.addContainerGap())
);
jPanelBottomLayout.setVerticalGroup(
jPanelBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelBottomLayout.createSequentialGroup()
.addGroup(jPanelBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButtonNext, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 2; gridBagConstraints.gridy = 2;
@ -1193,17 +1195,17 @@ public class TablesPanel extends javax.swing.JPanel {
newTableDialog.showDialog(roomId); newTableDialog.showDialog(roomId);
}//GEN-LAST:event_btnNewTableActionPerformed }//GEN-LAST:event_btnNewTableActionPerformed
private void jButtonNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNextActionPerformed private void jButtonFooterNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFooterNextActionPerformed
synchronized (this) { synchronized (this) {
if (messages != null && !messages.isEmpty()) { if (messages != null && !messages.isEmpty()) {
currentMessage++; currentMessage++;
if (currentMessage >= messages.size()) { if (currentMessage >= messages.size()) {
currentMessage = 0; currentMessage = 0;
} }
this.jLabel2.setText(messages.get(currentMessage)); this.jLabelFooterText.setText(messages.get(currentMessage));
} }
} }
}//GEN-LAST:event_jButtonNextActionPerformed }//GEN-LAST:event_jButtonFooterNextActionPerformed
private void btnFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFilterActionPerformed private void btnFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFilterActionPerformed
setTableFilter(); setTableFilter();
@ -1248,9 +1250,9 @@ public class TablesPanel extends javax.swing.JPanel {
private mage.client.table.PlayersChatPanel chatPanelMain; private mage.client.table.PlayersChatPanel chatPanelMain;
private javax.swing.JToolBar filterBar1; private javax.swing.JToolBar filterBar1;
private javax.swing.JToolBar filterBar2; private javax.swing.JToolBar filterBar2;
private javax.swing.JButton jButtonNext; private javax.swing.JButton jButtonFooterNext;
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabelFooterLabel;
private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabelFooterText;
private javax.swing.JPanel jPanelBottom; private javax.swing.JPanel jPanelBottom;
private javax.swing.JPanel jPanelTables; private javax.swing.JPanel jPanelTables;
private javax.swing.JPanel jPanelTop; private javax.swing.JPanel jPanelTop;