Commit 6b3026db authored by mohammadmahdihn's avatar mohammadmahdihn
Browse files

Woo

parent 1da6d4a7
<changelist name="Uncommitted_changes_before_Update_at_7_21_2021_8_44_PM_[Default_Changelist]" date="1626884095509" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_7_21_2021_8_44_PM_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Update at 7/21/2021 8:44 PM [Default Changelist]" />
</changelist>
\ No newline at end of file
......@@ -36,11 +36,6 @@ public class ChatBoxController {
try {
socket = new Socket("localhost", 8888);
objectInputStream = new ObjectInputStream(socket.getInputStream());
// try {
// objectInputStream.reset();
// } catch (IOException e) {
// e.printStackTrace();
// }
newThread(objectInputStream);
} catch (IOException x) {
......@@ -62,26 +57,19 @@ public class ChatBoxController {
}
public void newThread(ObjectInputStream objectInputStream){
// try {
// objectInputStream.reset();
// } catch (IOException e) {
// e.printStackTrace();
// }
new Thread(() -> {
while (true) {
try {
ArrayList<String> messages = (ArrayList<String>) objectInputStream.readObject();
if(messages != null) {
for (String message : messages) {
System.out.println(message);
}
view.showChat(messages);
}
//objectInputStream.reset();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NegativeArraySizeException e) {
System.out.println("");
}
}
......
......@@ -138,6 +138,7 @@ public class ShopView extends Application {
amountForAdmin.setText(details);
adminButtonBar.getButtons().clear();
Button changeAmountButton = new Button("Change amount");
changeAmountButton.setPrefWidth(600);
changeAmountButton.setOnMouseClicked(mouseEvent1 -> {
String result = JOptionPane.showInputDialog("Enter amount: ");
try {
......@@ -159,6 +160,7 @@ public class ShopView extends Application {
adminButtonBar.getButtons().add(changeAmountButton);
if(details.endsWith("Available")) {
Button makeUnavailable = new Button("Make unavailable");
makeUnavailable.setPrefWidth(400);
makeUnavailable.setOnMouseClicked(mouseEvent1 -> {
try {
LoginMenuController.sendAndReceive("set card unavailable --token " + MainClient.getToken() + " --card " + cardName);
......@@ -170,6 +172,7 @@ public class ShopView extends Application {
adminButtonBar.getButtons().add(makeUnavailable);
} else if (details.endsWith("Unavailable")) {
Button makeAvailable = new Button("Make available");
makeAvailable.setPrefWidth(400);
makeAvailable.setOnMouseClicked(mouseEvent1 -> {
try {
LoginMenuController.sendAndReceive("set card available --token " + MainClient.getToken() + " --card " + cardName);
......
......@@ -72,6 +72,6 @@
<Font name="thewitcher" size="19.0" />
</font>
</Text>
<ButtonBar fx:id="adminButtonBar" layoutX="669.0" layoutY="263.0" prefHeight="40.0" prefWidth="200.0" />
<ButtonBar fx:id="adminButtonBar" layoutX="565.0" layoutY="263.0" prefHeight="91.0" prefWidth="305.0" />
</children>
</AnchorPane>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment