Some more changes to GUI to better support high screen resolutions.

This commit is contained in:
LevelX2 2016-02-13 02:30:05 +01:00
parent 1c2faaadde
commit 7ef0a0a7f0
31 changed files with 745 additions and 518 deletions

View file

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<SyntheticProperties>

View file

@ -26,12 +26,11 @@
* or implied, of BetaSteward_at_googlemail.com.
*/
/*
/*
* DraftPane.java
*
* Created on Jan 7, 2011, 2:11:44 PM
*/
package mage.client.draft;
import java.awt.Component;
@ -48,11 +47,13 @@ import mage.client.plugins.impl.Plugins;
*/
public class DraftPane extends MagePane {
/** Creates new form DraftPane */
/**
* Creates new form DraftPane
*/
public DraftPane() {
boolean initialized = false;
if (Plugins.getInstance().isThemePluginLoaded()) {
Map<String, JComponent> uiComponents = new HashMap<String, JComponent>();
Map<String, JComponent> uiComponents = new HashMap<>();
JComponent container = Plugins.getInstance().updateTablePanel(uiComponents);
if (container != null) {
draftPanel1 = new mage.client.draft.DraftPanel();
@ -68,20 +69,25 @@ public class DraftPane extends MagePane {
}
}
@Override
public void changeGUISize() {
super.changeGUISize(); //To change body of generated methods, choose Tools | Templates.
}
public void showDraft(UUID draftId) {
this.setTitle("Draft - " + draftId);
this.draftPanel1.showDraft(draftId);
}
public void removeDraft() {
draftPanel1.cleanUp();
this.removeFrame();
}
/** 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
@ -112,11 +118,11 @@ public class DraftPane extends MagePane {
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
.addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
);
pack();

View file

@ -26,7 +26,7 @@
* or implied, of BetaSteward_at_googlemail.com.
*/
/*
/*
* DraftPanel.java
*
* Created on Jan 7, 2011, 2:15:48 PM
@ -88,7 +88,7 @@ import org.apache.log4j.Logger;
*/
public class DraftPanel extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(DraftPanel.class);
private static final Logger LOGGER = Logger.getLogger(DraftPanel.class);
private UUID draftId;
private Session session;
@ -121,7 +121,7 @@ public class DraftPanel extends javax.swing.JPanel {
private String currentBoosterHeader;
private String[] currentBooster;
private static final CardsView emptyView = new CardsView();
private static final CardsView EMPTY_VIEW = new CardsView();
/**
* Creates new form DraftPanel
@ -145,16 +145,16 @@ public class DraftPanel extends javax.swing.JPanel {
countdown = new Timer(1000,
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (--timeout > 0) {
setTimeout(timeout);
} else {
setTimeout(0);
countdown.stop();
}
}
@Override
public void actionPerformed(ActionEvent e) {
if (--timeout > 0) {
setTimeout(timeout);
} else {
setTimeout(0);
countdown.stop();
}
}
}
);
}
@ -170,6 +170,15 @@ public class DraftPanel extends javax.swing.JPanel {
}
}
public void changeGUISize() {
draftPicks.changeGUISize();
setGUISize();
}
private void setGUISize() {
}
public synchronized void showDraft(UUID draftId) {
this.draftId = draftId;
session = MageFrame.getSession();
@ -186,7 +195,7 @@ public class DraftPanel extends javax.swing.JPanel {
try {
Files.write(pathToDraftLog(), "".getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
} catch (IOException ex) {
logger.error(null, ex);
LOGGER.error(null, ex);
}
} else {
logFilename = null;
@ -319,24 +328,24 @@ public class DraftPanel extends javax.swing.JPanel {
this.draftBooster.clearCardEventListeners();
this.draftBooster.addCardEventListener(
new Listener<Event>() {
@Override
public void event(Event event) {
if (event.getEventName().equals("pick-a-card")) {
SimpleCardView source = (SimpleCardView) event.getSource();
DraftPickView view = session.sendCardPick(draftId, source.getId(), cardsHidden);
if (view != null) {
loadCardsToPickedCardsArea(view.getPicks());
draftBooster.loadBooster(emptyView, bigCard);
Plugins.getInstance().getActionCallback().hideTooltipPopup();
setMessage("Waiting for other players");
}
}
if (event.getEventName().equals("mark-a-card")) {
SimpleCardView source = (SimpleCardView) event.getSource();
session.sendCardMark(draftId, source.getId());
}
@Override
public void event(Event event) {
if (event.getEventName().equals("pick-a-card")) {
SimpleCardView source = (SimpleCardView) event.getSource();
DraftPickView view = session.sendCardPick(draftId, source.getId(), cardsHidden);
if (view != null) {
loadCardsToPickedCardsArea(view.getPicks());
draftBooster.loadBooster(EMPTY_VIEW, bigCard);
Plugins.getInstance().getActionCallback().hideTooltipPopup();
setMessage("Waiting for other players");
}
}
if (event.getEventName().equals("mark-a-card")) {
SimpleCardView source = (SimpleCardView) event.getSource();
session.sendCardMark(draftId, source.getId());
}
}
}
);
setMessage("Pick a card");
if (!MageFrame.getInstance().isActive()) {
@ -524,7 +533,7 @@ public class DraftPanel extends javax.swing.JPanel {
try {
Files.write(pathToDraftLog(), data.getBytes(), StandardOpenOption.APPEND);
} catch (IOException ex) {
logger.error(null, ex);
LOGGER.error(null, ex);
}
}