Update DrukujBilet.java

This commit is contained in:
s441433 2019-01-12 15:25:01 +01:00
parent 3c599a09b1
commit bd3269fd3d

View File

@ -1,4 +1,6 @@
//import javax.swing.AbstractButton; //import javax.swing.AbstractButton;
import javax.comm.SerialPort;
import javax.swing.ImageIcon;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
@ -14,7 +16,7 @@ import java.sql.ResultSet;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Calendar; import java.util.Calendar;
import java.util.GregorianCalendar; //import java.util.GregorianCalendar;
import java.util.TimeZone; import java.util.TimeZone;
import java.awt.Font; import java.awt.Font;
import java.awt.Color; import java.awt.Color;
@ -37,7 +39,18 @@ import javax.swing.UIManager;
//import java.awt.event.MouseListener; //import java.awt.event.MouseListener;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.ImageIcon; //import javax.comm.SerialPort;
//import javax.comm.CommPort;
//import javax.comm.SerialPortEventListener;
//import javax.comm.CommDriver;
//import javax.swing.ImageIcon;
//import jssc.SerialPort;
//import jssc.SerialPortEvent;
//import jssc.SerialPortException;
//import jssc.SerialPortList;
import java.io.IOException;
import java.io.OutputStream;
public class DrukujBilet extends StolowkaZPM { public class DrukujBilet extends StolowkaZPM {
@ -88,8 +101,10 @@ public class DrukujBilet extends StolowkaZPM {
public void run() { public void run() {
try { try {
for(;;) { for(;;) {
Calendar cal = new GregorianCalendar(); Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("Europe/Warsaw")); cal.setTimeZone(TimeZone.getTimeZone("Europe/Warsaw"));
long timeInMillis = System.currentTimeMillis();
cal.setTimeInMillis(timeInMillis);
int day = cal.get(Calendar.DAY_OF_MONTH); int day = cal.get(Calendar.DAY_OF_MONTH);
int month = cal.get(Calendar.MONTH); int month = cal.get(Calendar.MONTH);
@ -195,7 +210,7 @@ public class DrukujBilet extends StolowkaZPM {
JTextArea txtrWybrano = new JTextArea(); JTextArea txtrWybrano = new JTextArea();
txtrWybrano.setEditable(false); txtrWybrano.setEditable(false);
txtrWybrano.setText("Suma kosztow wybranych da\u0144: 25 z\u0142"); //txtrWybrano.setText("Suma kosztow wybranych dań: 25 PLN");
txtrWybrano.setForeground(Color.BLACK); txtrWybrano.setForeground(Color.BLACK);
txtrWybrano.setBackground(Color.WHITE); txtrWybrano.setBackground(Color.WHITE);
txtrWybrano.setLineWrap(true); txtrWybrano.setLineWrap(true);
@ -424,7 +439,7 @@ public class DrukujBilet extends StolowkaZPM {
//@SuppressWarnings("unused") //@SuppressWarnings("unused")
//int jakiWiersz = selectedRow; //int jakiWiersz = selectedRow;
JOptionPane.showMessageDialog(null,"WYBRANO"); JOptionPane.showMessageDialog(null,"WYBRANO");
txtrWybrano.setText("Suma kosztów wybranych pozycji: "+sumaKoszt+" z³"); txtrWybrano.setText("Suma kosztów wybranych pozycji: "+sumaKoszt+" zlotych");
} }
@ -468,6 +483,7 @@ public class DrukujBilet extends StolowkaZPM {
pst.setString(4, "nie"); pst.setString(4, "nie");
pst.execute(); pst.execute();
rs.close(); rs.close();
pst.close(); pst.close();
MenuStolowkaZPM.setVisible(false); MenuStolowkaZPM.setVisible(false);
@ -484,7 +500,8 @@ public class DrukujBilet extends StolowkaZPM {
} }
} }
}}); }
});
pst.close(); pst.close();
} }
} }