mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Change main client window MagePanes from JInternalFrames to JLayeredPanes
* This change's purpose is to get rid of the extra borders shown around the window border. These arise from using JInternalFrames in a JDestopPane and are impossible to remove in a forwards compatible way when using JInternalFrames. The solution it to move to have MagePane inherit from a plain old JLayeredPane instead of JInternalFrame. All of the MagePanes are always maximized anyways, so this doesn't lose any functionality.
This commit is contained in:
parent
fee7e4a4e6
commit
321f5597b7
9 changed files with 131 additions and 186 deletions
|
@ -84,13 +84,10 @@ import javax.swing.event.PopupMenuListener;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -253,13 +250,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
updateMemUsageTask = new UpdateMemUsageTask(jMemUsageLabel);
|
||||
|
||||
try {
|
||||
tablesPane = new TablesPane();
|
||||
desktopPane.add(tablesPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
tablesPane.setMaximum(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
tablesPane = new TablesPane();
|
||||
desktopPane.add(tablesPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
|
||||
addTooltipContainer();
|
||||
setBackground();
|
||||
|
@ -279,6 +271,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
backgroundPane.setSize(width, height);
|
||||
}
|
||||
|
||||
updateCurrentFrameSize();
|
||||
|
||||
ArrowBuilder.getBuilder().setSize(width, height);
|
||||
|
||||
if (title != null) {
|
||||
|
@ -478,7 +472,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
private void createAndShowSwitchPanelsMenu(final JComponent component, final AbstractButton windowButton) {
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
Component[] windows = desktopPane.getComponentsInLayer(javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
MagePaneMenuItem menuItem;
|
||||
|
||||
for (int i = 0; i < windows.length; i++) {
|
||||
|
@ -492,7 +486,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
MagePane frame = ((MagePaneMenuItem) ae.getSource()).getFrame();
|
||||
setActive(frame);
|
||||
});
|
||||
menuItem.setIcon(window.getFrameIcon());
|
||||
//menuItem.setIcon(window.getFrameIcon());
|
||||
menu.add(menuItem);
|
||||
}
|
||||
}
|
||||
|
@ -543,23 +537,28 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
// showUserRequestDialog(message);
|
||||
// }
|
||||
public static void setActive(MagePane frame) {
|
||||
// Nothing to do
|
||||
if (activeFrame == frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Deactivate current frame if there is one
|
||||
if (activeFrame != null) {
|
||||
activeFrame.deactivated();
|
||||
}
|
||||
|
||||
// If null, no new frame to activate, return early
|
||||
if (frame == null) {
|
||||
activeFrame = null;
|
||||
return;
|
||||
}
|
||||
LOGGER.debug("Setting " + frame.getTitle() + " active");
|
||||
if (activeFrame != null) {
|
||||
activeFrame.deactivated();
|
||||
}
|
||||
activeFrame = frame;
|
||||
activeFrame.setVisible(true);
|
||||
activeFrame.toFront();
|
||||
try {
|
||||
activeFrame.setSelected(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
LOGGER.error("Error setting " + frame.getTitle() + " active");
|
||||
}
|
||||
desktopPane.moveToFront(frame);
|
||||
activeFrame.setBounds(0, 0, desktopPane.getWidth(), desktopPane.getHeight());
|
||||
activeFrame.revalidate();
|
||||
activeFrame.activated();
|
||||
activeFrame.setVisible(true);
|
||||
ArrowBuilder.getBuilder().hideAllPanels();
|
||||
if (frame instanceof GamePane) {
|
||||
ArrowBuilder.getBuilder().showPanel(((GamePane) frame).getGameId());
|
||||
|
@ -569,23 +568,36 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
|
||||
private void updateCurrentFrameSize() {
|
||||
if (activeFrame != null) {
|
||||
activeFrame.setBounds(0, 0, desktopPane.getWidth(), desktopPane.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doLayout() {
|
||||
super.doLayout();
|
||||
|
||||
updateCurrentFrameSize();
|
||||
}
|
||||
|
||||
public static void deactivate(MagePane frame) {
|
||||
frame.setVisible(false);
|
||||
setActive(getTopMost(frame));
|
||||
if (activeFrame != frame) {
|
||||
frame.deactivated();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static MagePane getTopMost(MagePane exclude) {
|
||||
MagePane topmost = null;
|
||||
int best = Integer.MAX_VALUE;
|
||||
for (JInternalFrame frame : desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER)) {
|
||||
for (Component frame : desktopPane.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER)) {
|
||||
if (frame.isVisible()) {
|
||||
int z = desktopPane.getComponentZOrder(frame);
|
||||
if (z < best) {
|
||||
if (frame instanceof MagePane) {
|
||||
// Exclude the tables pane if not connected, we never want to show it when not connected
|
||||
if (frame instanceof MagePane && (SessionHandler.isConnected() || !(frame instanceof TablesPane))) {
|
||||
best = z;
|
||||
if (!frame.equals(exclude)) {
|
||||
topmost = (MagePane) frame;
|
||||
|
@ -604,64 +616,47 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
* @param playerId
|
||||
*/
|
||||
public void showGame(UUID gameId, UUID playerId) {
|
||||
try {
|
||||
GamePane gamePane = new GamePane();
|
||||
desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
|
||||
gamePane.setMaximum(true);
|
||||
gamePane.setVisible(true);
|
||||
gamePane.showGame(gameId, playerId);
|
||||
setActive(gamePane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
}
|
||||
GamePane gamePane = new GamePane();
|
||||
desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
|
||||
gamePane.setVisible(true);
|
||||
gamePane.showGame(gameId, playerId);
|
||||
setActive(gamePane);
|
||||
}
|
||||
|
||||
public void watchGame(UUID gameId) {
|
||||
try {
|
||||
for (Component component : desktopPane.getComponents()) {
|
||||
if (component instanceof GamePane
|
||||
&& ((GamePane) component).getGameId().equals(gameId)) {
|
||||
setActive((GamePane) component);
|
||||
return;
|
||||
}
|
||||
for (Component component : desktopPane.getComponents()) {
|
||||
if (component instanceof GamePane
|
||||
&& ((GamePane) component).getGameId().equals(gameId)) {
|
||||
setActive((GamePane) component);
|
||||
return;
|
||||
}
|
||||
GamePane gamePane = new GamePane();
|
||||
desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
|
||||
gamePane.setMaximum(true);
|
||||
gamePane.setVisible(true);
|
||||
gamePane.watchGame(gameId);
|
||||
setActive(gamePane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
LOGGER.debug("Problem starting watching game " + gameId, ex);
|
||||
}
|
||||
GamePane gamePane = new GamePane();
|
||||
desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
|
||||
gamePane.setVisible(true);
|
||||
gamePane.watchGame(gameId);
|
||||
setActive(gamePane);
|
||||
}
|
||||
|
||||
public void replayGame(UUID gameId) {
|
||||
try {
|
||||
GamePane gamePane = new GamePane();
|
||||
desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
|
||||
gamePane.setMaximum(true);
|
||||
gamePane.setVisible(true);
|
||||
gamePane.replayGame(gameId);
|
||||
setActive(gamePane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
}
|
||||
GamePane gamePane = new GamePane();
|
||||
desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
|
||||
gamePane.setVisible(true);
|
||||
gamePane.replayGame(gameId);
|
||||
setActive(gamePane);
|
||||
}
|
||||
|
||||
public void showDraft(UUID draftId) {
|
||||
try {
|
||||
DraftPane draftPane = new DraftPane();
|
||||
desktopPane.add(draftPane, JLayeredPane.DEFAULT_LAYER);
|
||||
draftPane.setMaximum(true);
|
||||
draftPane.setVisible(true);
|
||||
draftPane.showDraft(draftId);
|
||||
setActive(draftPane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
}
|
||||
DraftPane draftPane = new DraftPane();
|
||||
desktopPane.add(draftPane, JLayeredPane.DEFAULT_LAYER);
|
||||
draftPane.setVisible(true);
|
||||
draftPane.showDraft(draftId);
|
||||
setActive(draftPane);
|
||||
}
|
||||
|
||||
public void endDraft(UUID draftId) {
|
||||
// inform all open draft panes about
|
||||
for (JInternalFrame window : desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER)) {
|
||||
for (Component window : desktopPane.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER)) {
|
||||
if (window instanceof DraftPane) {
|
||||
DraftPane draftPane = (DraftPane) window;
|
||||
draftPane.removeDraft();
|
||||
|
@ -670,22 +665,18 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
public void showTournament(UUID tournamentId) {
|
||||
try {
|
||||
for (Component component : desktopPane.getComponents()) {
|
||||
if (component instanceof TournamentPane
|
||||
&& ((TournamentPane) component).getTournamentId().equals(tournamentId)) {
|
||||
setActive((TournamentPane) component);
|
||||
return;
|
||||
}
|
||||
for (Component component : desktopPane.getComponents()) {
|
||||
if (component instanceof TournamentPane
|
||||
&& ((TournamentPane) component).getTournamentId().equals(tournamentId)) {
|
||||
setActive((TournamentPane) component);
|
||||
return;
|
||||
}
|
||||
TournamentPane tournamentPane = new TournamentPane();
|
||||
desktopPane.add(tournamentPane, JLayeredPane.DEFAULT_LAYER);
|
||||
tournamentPane.setMaximum(true);
|
||||
tournamentPane.setVisible(true);
|
||||
tournamentPane.showTournament(tournamentId);
|
||||
setActive(tournamentPane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
}
|
||||
TournamentPane tournamentPane = new TournamentPane();
|
||||
desktopPane.add(tournamentPane, JLayeredPane.DEFAULT_LAYER);
|
||||
tournamentPane.setVisible(true);
|
||||
tournamentPane.showTournament(tournamentId);
|
||||
setActive(tournamentPane);
|
||||
}
|
||||
|
||||
public void showGameEndDialog(GameEndView gameEndView) {
|
||||
|
@ -748,7 +739,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
LOGGER.debug("connecting (auto): " + currentConnection.getProxyType().toString()
|
||||
+ ' ' + currentConnection.getProxyHost() + ' ' + currentConnection.getProxyPort() + ' ' + currentConnection.getProxyUsername());
|
||||
if (MageFrame.connect(currentConnection)) {
|
||||
showGames(false);
|
||||
prepareAndShowTablesPane();
|
||||
return true;
|
||||
} else {
|
||||
showMessage("Unable to connect to server");
|
||||
|
@ -1014,23 +1005,20 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
|
||||
public void showGames(boolean setActive) {
|
||||
public void prepareAndShowTablesPane() {
|
||||
// Update the tables pane with the new session
|
||||
this.tablesPane.showTables();
|
||||
|
||||
// Show the tables pane if there wasn't already an active pane
|
||||
MagePane topPanebefore = getTopMost(tablesPane);
|
||||
if (!tablesPane.isVisible()) {
|
||||
this.tablesPane.setVisible(true);
|
||||
this.tablesPane.showTables();
|
||||
}
|
||||
if (setActive) {
|
||||
if (topPanebefore == null) {
|
||||
setActive(tablesPane);
|
||||
} else // if other panel was already shown, mamke sure it's topmost again
|
||||
if (topPanebefore != null) {
|
||||
setActive(topPanebefore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hideGames() {
|
||||
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
for (JInternalFrame window : windows) {
|
||||
Component[] windows = desktopPane.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
for (Component window : windows) {
|
||||
if (window instanceof GamePane) {
|
||||
GamePane gamePane = (GamePane) window;
|
||||
gamePane.removeGame();
|
||||
|
@ -1066,25 +1054,20 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
name = "Deck Editor";
|
||||
}
|
||||
// use already open editor
|
||||
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
for (JInternalFrame window : windows) {
|
||||
if (window instanceof DeckEditorPane && window.getTitle().equals(name)) {
|
||||
Component[] windows = desktopPane.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
for (Component window : windows) {
|
||||
if (window instanceof DeckEditorPane && ((MagePane)window).getTitle().equals(name)) {
|
||||
setActive((MagePane) window);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
DeckEditorPane deckEditorPane = new DeckEditorPane();
|
||||
desktopPane.add(deckEditorPane, JLayeredPane.DEFAULT_LAYER);
|
||||
deckEditorPane.setMaximum(true);
|
||||
deckEditorPane.setVisible(true);
|
||||
deckEditorPane.show(mode, deck, name, tableId, time);
|
||||
setActive(deckEditorPane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
DeckEditorPane deckEditorPane = new DeckEditorPane();
|
||||
desktopPane.add(deckEditorPane, JLayeredPane.DEFAULT_LAYER);
|
||||
deckEditorPane.setVisible(false);
|
||||
deckEditorPane.show(mode, deck, name, tableId, time);
|
||||
setActive(deckEditorPane);
|
||||
}
|
||||
|
||||
public void showUserRequestDialog(final UserRequestMessage userRequestMessage) {
|
||||
|
@ -1109,22 +1092,17 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
public void showCollectionViewer() {
|
||||
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
for (JInternalFrame window : windows) {
|
||||
Component[] windows = desktopPane.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
for (Component window : windows) {
|
||||
if (window instanceof CollectionViewerPane) {
|
||||
setActive((MagePane) window);
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
CollectionViewerPane collectionViewerPane = new CollectionViewerPane();
|
||||
desktopPane.add(collectionViewerPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
collectionViewerPane.setMaximum(true);
|
||||
collectionViewerPane.setVisible(true);
|
||||
setActive(collectionViewerPane);
|
||||
} catch (PropertyVetoException ex) {
|
||||
LOGGER.fatal(null, ex);
|
||||
}
|
||||
CollectionViewerPane collectionViewerPane = new CollectionViewerPane();
|
||||
desktopPane.add(collectionViewerPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
collectionViewerPane.setVisible(true);
|
||||
setActive(collectionViewerPane);
|
||||
}
|
||||
|
||||
static void renderSplashFrame(Graphics2D g) {
|
||||
|
|
|
@ -36,37 +36,33 @@ package mage.client;
|
|||
import java.awt.AWTEvent;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.beans.PropertyVetoException;
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class MagePane extends javax.swing.JInternalFrame {
|
||||
public abstract class MagePane extends javax.swing.JLayeredPane {
|
||||
private String title = "no title set";
|
||||
|
||||
/**
|
||||
* Creates new form MagePane
|
||||
*/
|
||||
public MagePane() {
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
initComponents();
|
||||
hideTitle();
|
||||
}
|
||||
|
||||
private void hideTitle() {
|
||||
if (ui instanceof BasicInternalFrameUI) {
|
||||
((BasicInternalFrameUI) ui).setNorthPane(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
hideTitle();
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void hideFrame() {
|
||||
|
@ -75,11 +71,6 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
|||
|
||||
public void removeFrame() {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
|
||||
try {
|
||||
this.setClosed(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
|
||||
}
|
||||
MageFrame.deactivate(this);
|
||||
MageFrame.getDesktop().remove(this);
|
||||
}
|
||||
|
@ -106,18 +97,6 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
|||
|
||||
setBorder(null);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 765, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 476, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
|
|
@ -53,7 +53,6 @@ public class DeckEditorPane extends MagePane {
|
|||
* Creates new form TablesPane
|
||||
*/
|
||||
public DeckEditorPane() {
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
boolean initialized = false;
|
||||
if (Plugins.instance.isThemePluginLoaded()) {
|
||||
Map<String, JComponent> uiMap = new HashMap<>();
|
||||
|
@ -105,8 +104,8 @@ public class DeckEditorPane extends MagePane {
|
|||
|
||||
deckEditorPanel1 = new mage.client.deckeditor.DeckEditorPanel();
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(deckEditorPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
|
||||
|
@ -115,14 +114,12 @@ public class DeckEditorPane extends MagePane {
|
|||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(deckEditorPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void initComponents(Component container) {
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
|
||||
|
@ -132,7 +129,7 @@ public class DeckEditorPane extends MagePane {
|
|||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
|
||||
}
|
||||
|
||||
public DeckEditorPanel getPanel() {
|
||||
|
|
|
@ -66,8 +66,8 @@ public class CollectionViewerPane extends MagePane {
|
|||
private void initComponents(Component container) {
|
||||
Component component = container != null ? container : new CollectionViewerPanel();
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(component, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
|
||||
|
@ -76,8 +76,6 @@ public class CollectionViewerPane extends MagePane {
|
|||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(component, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -429,7 +429,7 @@ public class ConnectDialog extends MageDialog {
|
|||
if (result) {
|
||||
lblStatus.setText("");
|
||||
connected();
|
||||
MageFrame.getInstance().showGames(false);
|
||||
MageFrame.getInstance().prepareAndShowTablesPane();
|
||||
} else {
|
||||
lblStatus.setText("Could not connect");
|
||||
}
|
||||
|
|
|
@ -99,8 +99,8 @@ public class DraftPane extends MagePane {
|
|||
|
||||
jScrollPane1.setViewportView(draftPanel1);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 868, Short.MAX_VALUE)
|
||||
|
@ -109,14 +109,12 @@ public class DraftPane extends MagePane {
|
|||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void initComponents(Component container) {
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
|
||||
|
@ -125,8 +123,6 @@ public class DraftPane extends MagePane {
|
|||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
|
|
@ -35,7 +35,8 @@ package mage.client.game;
|
|||
|
||||
import java.awt.AWTEvent;
|
||||
import java.util.UUID;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.*;
|
||||
|
||||
import mage.client.MagePane;
|
||||
|
||||
/**
|
||||
|
@ -48,10 +49,9 @@ public class GamePane extends MagePane {
|
|||
* Creates new form GamePane
|
||||
*/
|
||||
public GamePane() {
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
initComponents();
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
gamePanel.setJLayeredPane(getLayeredPane());
|
||||
gamePanel.setJLayeredPane(this);
|
||||
gamePanel.installComponents();
|
||||
});
|
||||
|
||||
|
@ -96,12 +96,13 @@ public class GamePane extends MagePane {
|
|||
private void initComponents() {
|
||||
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jScrollPane1.setBorder(BorderFactory.createEmptyBorder());
|
||||
gamePanel = new mage.client.game.GamePanel();
|
||||
|
||||
jScrollPane1.setViewportView(gamePanel);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
|
||||
|
@ -113,7 +114,6 @@ public class GamePane extends MagePane {
|
|||
.addGap(0, 400, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}
|
||||
|
||||
public UUID getGameId() {
|
||||
|
|
|
@ -99,8 +99,8 @@ public class TablesPane extends MagePane {
|
|||
|
||||
tablesPanel = new mage.client.table.TablesPanel();
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(tablesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
|
||||
|
@ -110,12 +110,11 @@ public class TablesPane extends MagePane {
|
|||
.addComponent(tablesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void initComponents(JComponent container) {
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
|
||||
|
@ -124,7 +123,6 @@ public class TablesPane extends MagePane {
|
|||
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
|
||||
|
|
|
@ -83,8 +83,8 @@ public class TournamentPane extends MagePane {
|
|||
|
||||
tournamentPanel = new mage.client.tournament.TournamentPanel();
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(tournamentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 758, Short.MAX_VALUE)
|
||||
|
@ -94,7 +94,6 @@ public class TournamentPane extends MagePane {
|
|||
.addComponent(tournamentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 526, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
|
Loading…
Reference in a new issue