Commit 949adbb1 authored by Stephen's avatar Stephen
Browse files

Merged

parents 806fecd8 0519cfe5
...@@ -1687,7 +1687,7 @@ ...@@ -1687,7 +1687,7 @@
<Component id="FindIcon" min="-2" max="-2" attributes="0"/> <Component id="FindIcon" min="-2" max="-2" attributes="0"/>
<Component id="Find" min="-2" max="-2" attributes="0"/> <Component id="Find" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace min="0" pref="165" max="32767" attributes="0"/> <EmptySpace min="0" pref="174" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
...@@ -1732,14 +1732,14 @@ ...@@ -1732,14 +1732,14 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="FindPotion" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="FindPotion" alignment="0" max="32767" attributes="0"/>
<Component id="FindHoney" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="FindHoney" alignment="0" max="32767" attributes="0"/>
<Component id="FindHerbs" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="FindHerbs" alignment="0" max="32767" attributes="0"/>
<Component id="FindClay" alignment="0" min="-2" pref="155" max="-2" attributes="0"/> <Component id="FindMineral" alignment="0" max="32767" attributes="0"/>
<Component id="FindMineral" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="FindClay" alignment="0" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace type="separate" max="-2" attributes="0"/> <EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="FindIncense" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="FindIncense" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="FindGems" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="FindGems" alignment="0" min="-2" max="-2" attributes="0"/>
...@@ -1758,7 +1758,6 @@ ...@@ -1758,7 +1758,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/honey.PNG"/> <Image iconType="3" name="/inventory/images/honey.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1771,7 +1770,6 @@ ...@@ -1771,7 +1770,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/herbs.PNG"/> <Image iconType="3" name="/inventory/images/herbs.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1784,7 +1782,6 @@ ...@@ -1784,7 +1782,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/clay.PNG"/> <Image iconType="3" name="/inventory/images/clay.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1797,7 +1794,6 @@ ...@@ -1797,7 +1794,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/mineral.PNG"/> <Image iconType="3" name="/inventory/images/mineral.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1810,7 +1806,6 @@ ...@@ -1810,7 +1806,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/potion.PNG"/> <Image iconType="3" name="/inventory/images/potion.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1823,7 +1818,6 @@ ...@@ -1823,7 +1818,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/stone.PNG"/> <Image iconType="3" name="/inventory/images/stone.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1836,7 +1830,6 @@ ...@@ -1836,7 +1830,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/manaCrystal.PNG"/> <Image iconType="3" name="/inventory/images/manaCrystal.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1849,7 +1842,6 @@ ...@@ -1849,7 +1842,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/lifeElixir.PNG"/> <Image iconType="3" name="/inventory/images/lifeElixir.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1862,7 +1854,6 @@ ...@@ -1862,7 +1854,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/gems.PNG"/> <Image iconType="3" name="/inventory/images/gems.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1875,7 +1866,6 @@ ...@@ -1875,7 +1866,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/incense.PNG"/> <Image iconType="3" name="/inventory/images/incense.PNG"/>
</Property> </Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/> <Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/> <Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
...@@ -1907,7 +1897,7 @@ ...@@ -1907,7 +1897,7 @@
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="tradeitemPanel"> <Container class="javax.swing.JPanel" name="FindOfferItemPanel">
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
<CardConstraints cardName="TradeItemCard"/> <CardConstraints cardName="TradeItemCard"/>
...@@ -1917,15 +1907,44 @@ ...@@ -1917,15 +1907,44 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="908" max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Component id="FindOfferItemScrollPane" min="-2" pref="847" max="-2" attributes="0"/>
<EmptySpace pref="42" max="32767" attributes="0"/>
</Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="540" max="32767" attributes="0"/> <Group type="102" alignment="1" attributes="0">
<EmptySpace pref="20" max="32767" attributes="0"/>
<Component id="FindOfferItemScrollPane" min="-2" pref="500" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
</Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="FindOfferItemScrollPane">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="FindOfferItemTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="tradeboxModel" type="code"/>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0"/>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container> </Container>
</SubComponents> </SubComponents>
</Container> </Container>
......
...@@ -53,20 +53,22 @@ public class MainPage extends javax.swing.JFrame { ...@@ -53,20 +53,22 @@ public class MainPage extends javax.swing.JFrame {
//atribut //atribut
private TCPClient client; private TCPClient client;
private TableModel mapModel; private TableModel mapModel;
private int MixItem1; private int MixItem1 = -1;
private int MixItem2; private int MixItem2 = -1;
private int OfferedItemId; private int OfferedItemId = -1;
private int DemandedItemId; private int DemandedItemId = -1;
private int FindId; private int FindId = -1;
private Date currentTime; private Date currentTime;
private Date time; private Date time;
private Timer timer; private Timer timer;
private TradeboxTableModel tradeboxModel; private TradeboxTableModel tradeboxModel;
private TradeboxTableModel FindOfferBoxModel;
public MainPage() { public MainPage() {
mapModel=new MapTableModel(); mapModel=new MapTableModel();
tradeboxModel=new TradeboxTableModel(); tradeboxModel=new TradeboxTableModel();
FindOfferBoxModel = new TradeboxTableModel();
initComponents(); initComponents();
//mapTable //mapTable
MenuPanel.setVisible(false); MenuPanel.setVisible(false);
...@@ -197,7 +199,9 @@ public class MainPage extends javax.swing.JFrame { ...@@ -197,7 +199,9 @@ public class MainPage extends javax.swing.JFrame {
FindIncense = new javax.swing.JButton(); FindIncense = new javax.swing.JButton();
FindIcon = new javax.swing.JButton(); FindIcon = new javax.swing.JButton();
Find = new javax.swing.JButton(); Find = new javax.swing.JButton();
tradeitemPanel = new javax.swing.JPanel(); FindOfferItemPanel = new javax.swing.JPanel();
FindOfferItemScrollPane = new javax.swing.JScrollPane();
FindOfferItemTable = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
...@@ -1312,7 +1316,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1312,7 +1316,6 @@ public class MainPage extends javax.swing.JFrame {
MainPanel.add(offerPanel, "OfferCard"); MainPanel.add(offerPanel, "OfferCard");
FindHoney.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/honey.PNG"))); // NOI18N FindHoney.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/honey.PNG"))); // NOI18N
FindHoney.setText("jButton1");
FindHoney.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindHoney.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindHoney.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindHoney.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindHoney.addActionListener(new java.awt.event.ActionListener() { FindHoney.addActionListener(new java.awt.event.ActionListener() {
...@@ -1322,7 +1325,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1322,7 +1325,6 @@ public class MainPage extends javax.swing.JFrame {
}); });
FindHerbs.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/herbs.PNG"))); // NOI18N FindHerbs.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/herbs.PNG"))); // NOI18N
FindHerbs.setText("jButton1");
FindHerbs.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindHerbs.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindHerbs.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindHerbs.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindHerbs.addActionListener(new java.awt.event.ActionListener() { FindHerbs.addActionListener(new java.awt.event.ActionListener() {
...@@ -1332,7 +1334,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1332,7 +1334,6 @@ public class MainPage extends javax.swing.JFrame {
}); });
FindClay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/clay.PNG"))); // NOI18N FindClay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/clay.PNG"))); // NOI18N
FindClay.setText("jButton1");
FindClay.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindClay.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindClay.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindClay.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindClay.addActionListener(new java.awt.event.ActionListener() { FindClay.addActionListener(new java.awt.event.ActionListener() {
...@@ -1342,7 +1343,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1342,7 +1343,6 @@ public class MainPage extends javax.swing.JFrame {
}); });
FindMineral.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/mineral.PNG"))); // NOI18N FindMineral.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/mineral.PNG"))); // NOI18N
FindMineral.setText("jButton1");
FindMineral.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindMineral.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindMineral.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindMineral.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindMineral.addActionListener(new java.awt.event.ActionListener() { FindMineral.addActionListener(new java.awt.event.ActionListener() {
...@@ -1352,7 +1352,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1352,7 +1352,6 @@ public class MainPage extends javax.swing.JFrame {
}); });
FindPotion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/potion.PNG"))); // NOI18N FindPotion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/potion.PNG"))); // NOI18N
FindPotion.setText("jButton1");
FindPotion.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindPotion.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindPotion.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindPotion.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindPotion.addActionListener(new java.awt.event.ActionListener() { FindPotion.addActionListener(new java.awt.event.ActionListener() {
...@@ -1362,7 +1361,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1362,7 +1361,6 @@ public class MainPage extends javax.swing.JFrame {
}); });
FindPhilosopherStone.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/stone.PNG"))); // NOI18N FindPhilosopherStone.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/stone.PNG"))); // NOI18N
FindPhilosopherStone.setText("jButton1");
FindPhilosopherStone.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindPhilosopherStone.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindPhilosopherStone.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindPhilosopherStone.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindPhilosopherStone.addActionListener(new java.awt.event.ActionListener() { FindPhilosopherStone.addActionListener(new java.awt.event.ActionListener() {
...@@ -1372,7 +1370,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1372,7 +1370,6 @@ public class MainPage extends javax.swing.JFrame {
}); });
FindManaCrystal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/manaCrystal.PNG"))); // NOI18N FindManaCrystal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/manaCrystal.PNG"))); // NOI18N
FindManaCrystal.setText("jButton1");
FindManaCrystal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindManaCrystal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindManaCrystal.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindManaCrystal.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindManaCrystal.addActionListener(new java.awt.event.ActionListener() { FindManaCrystal.addActionListener(new java.awt.event.ActionListener() {
...@@ -1382,7 +1379,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1382,7 +1379,6 @@ public class MainPage extends javax.swing.JFrame {
}); });
FindLifeElixir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/lifeElixir.PNG"))); // NOI18N FindLifeElixir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/lifeElixir.PNG"))); // NOI18N
FindLifeElixir.setText("jButton1");
FindLifeElixir.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindLifeElixir.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindLifeElixir.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindLifeElixir.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindLifeElixir.addActionListener(new java.awt.event.ActionListener() { FindLifeElixir.addActionListener(new java.awt.event.ActionListener() {
...@@ -1392,7 +1388,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1392,7 +1388,6 @@ public class MainPage extends javax.swing.JFrame {
}); });
FindGems.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/gems.PNG"))); // NOI18N FindGems.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/gems.PNG"))); // NOI18N
FindGems.setText("jButton1");
FindGems.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindGems.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindGems.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindGems.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindGems.addActionListener(new java.awt.event.ActionListener() { FindGems.addActionListener(new java.awt.event.ActionListener() {
...@@ -1402,7 +1397,6 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1402,7 +1397,6 @@ public class MainPage extends javax.swing.JFrame {
}); });
FindIncense.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/incense.PNG"))); // NOI18N FindIncense.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventory/images/incense.PNG"))); // NOI18N
FindIncense.setText("jButton1");
FindIncense.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); FindIncense.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
FindIncense.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); FindIncense.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
FindIncense.addActionListener(new java.awt.event.ActionListener() { FindIncense.addActionListener(new java.awt.event.ActionListener() {
...@@ -1442,13 +1436,13 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1442,13 +1436,13 @@ public class MainPage extends javax.swing.JFrame {
FindItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) FindItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(FindItemLayout.createSequentialGroup() .addGroup(FindItemLayout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(FindItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(FindItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(FindPotion) .addComponent(FindPotion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(FindHoney) .addComponent(FindHoney, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(FindHerbs) .addComponent(FindHerbs, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(FindClay, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(FindMineral, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(FindMineral)) .addComponent(FindClay, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18) .addGap(36, 36, 36)
.addGroup(FindItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(FindItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(FindIncense) .addComponent(FindIncense)
.addComponent(FindGems) .addComponent(FindGems)
...@@ -1498,23 +1492,32 @@ public class MainPage extends javax.swing.JFrame { ...@@ -1498,23 +1492,32 @@ public class MainPage extends javax.swing.JFrame {
.addGroup(finditemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(finditemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(FindIcon) .addComponent(FindIcon)
.addComponent(Find)) .addComponent(Find))
.addGap(0, 165, Short.MAX_VALUE)) .addGap(0, 174, Short.MAX_VALUE))
); );
MainPanel.add(finditemPanel, "FindItemCard"); MainPanel.add(finditemPanel, "FindItemCard");
javax.swing.GroupLayout tradeitemPanelLayout = new javax.swing.GroupLayout(tradeitemPanel); FindOfferItemTable.setModel(tradeboxModel);
tradeitemPanel.setLayout(tradeitemPanelLayout); FindOfferItemScrollPane.setViewportView(FindOfferItemTable);
tradeitemPanelLayout.setHorizontalGroup(
tradeitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout FindOfferItemPanelLayout = new javax.swing.GroupLayout(FindOfferItemPanel);
.addGap(0, 908, Short.MAX_VALUE) FindOfferItemPanel.setLayout(FindOfferItemPanelLayout);
FindOfferItemPanelLayout.setHorizontalGroup(
FindOfferItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(FindOfferItemPanelLayout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(FindOfferItemScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 847, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(42, Short.MAX_VALUE))
); );
tradeitemPanelLayout.setVerticalGroup( FindOfferItemPanelLayout.setVerticalGroup(
tradeitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) FindOfferItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 540, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, FindOfferItemPanelLayout.createSequentialGroup()
.addContainerGap(20, Short.MAX_VALUE)
.addComponent(FindOfferItemScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 500, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(20, 20, 20))
); );
MainPanel.add(tradeitemPanel, "TradeItemCard"); MainPanel.add(FindOfferItemPanel, "TradeItemCard");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
...@@ -2205,17 +2208,9 @@ public class MainPage extends javax.swing.JFrame { ...@@ -2205,17 +2208,9 @@ public class MainPage extends javax.swing.JFrame {
private void FindActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FindActionPerformed private void FindActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FindActionPerformed
// TODO add your handling code here: // TODO add your handling code here:
try { generateFindOfferTable();
//JSONObject response = client.sendFind(client.token,FindId);
/*if(response.get("status").equals("ok")) {
CardLayout cl = (CardLayout) MainPanel.getLayout(); CardLayout cl = (CardLayout) MainPanel.getLayout();
cl.show(MainPanel, "TradeItemCard"); cl.show(MainPanel, "TradeItemCard");
}*/
}
catch(Exception e) {
e.printStackTrace();
}
}//GEN-LAST:event_FindActionPerformed }//GEN-LAST:event_FindActionPerformed
private void fieldButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fieldButtonActionPerformed private void fieldButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fieldButtonActionPerformed
...@@ -2293,6 +2288,61 @@ public class MainPage extends javax.swing.JFrame { ...@@ -2293,6 +2288,61 @@ public class MainPage extends javax.swing.JFrame {
} }
} }
private void generateFindOfferTable() {
try {
JSONObject response = client.sendFind(client.token,FindId);
if(response.getString("status").equals("ok")) {
JSONArray offer = response.getJSONArray("offers");
int dimX=offer.length();
int dimY=5;
FindOfferBoxModel =new TradeboxTableModel(dimX, dimY);
for(int i=0;i<offer.length();i++)
{
ImageIcon newPlayerIcon = getImage(offer.getJSONArray(i).getInt(0), 100, 100);
FindOfferBoxModel.setValueAt(newPlayerIcon, i, 0);
FindOfferBoxModel.setValueAt(offer.getJSONArray(i).get(1), i, 1);
newPlayerIcon = getImage(offer.getJSONArray(i).getInt(2), 100, 100);
FindOfferBoxModel.setValueAt(newPlayerIcon, i, 2);
FindOfferBoxModel.setValueAt(offer.getJSONArray(i).get(3), i, 3);
if(offer.getJSONArray(i).get(4).toString().equals("true")){ //avalaible
FindOfferBoxModel.setValueAt("Buy", i, 4);
}
}
FindOfferItemTable.setModel(FindOfferBoxModel);
FindOfferItemTable.setRowHeight(100);
Action delete = new AbstractAction()
{
public void actionPerformed(ActionEvent e)
{
JTable table = (JTable)e.getSource();
int modelRow = Integer.valueOf( e.getActionCommand() );
try {
if(offer.getJSONArray(modelRow).get(4).toString().equals("true"))
{
String offerToken=offer.getJSONArray(modelRow).get(5).toString();
sendAccept(offerToken);
}
} catch (JSONException ex) {
System.out.println("mouse click json Exception");
Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
}
}
};
ButtonColumn buttonColumn = new ButtonColumn(FindOfferItemTable, delete, 4);
buttonColumn.setMnemonic(KeyEvent.VK_D);
} else {
showMessage("Cannot find item. Try again later..");
}
} catch (Exception ex) {
showMessage("Server does not respond. Please try again later..");
System.out.println("FindItem Exception");