Update DrukujBilet.java
This commit is contained in:
parent
142a1cb502
commit
80dbf0e5c0
@ -1,25 +1,28 @@
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Toolkit;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import java.awt.Component;
|
||||
import javax.swing.Box;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.JToggleButton;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.awt.EventQueue;
|
||||
import java.sql.SQLException;
|
||||
import java.awt.Font;
|
||||
import java.awt.Color;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
public class DrukujBilet {
|
||||
public class DrukujBilet extends StolowkaZPM {
|
||||
|
||||
private JFrame MenuStolowkaZPM;
|
||||
String Dalej;
|
||||
|
||||
DefaultTableModel defaultTableModel = new DefaultTableModel();
|
||||
|
||||
/**
|
||||
* Launch the application.
|
||||
*/
|
||||
public static void oknoDrukujBilet() {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
@ -32,18 +35,17 @@ public class DrukujBilet {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the application.
|
||||
*/
|
||||
public DrukujBilet() {
|
||||
|
||||
Connection conn=null;
|
||||
|
||||
public DrukujBilet() throws SQLException {
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the contents of the frame.
|
||||
*/
|
||||
private void initialize() {
|
||||
private void initialize() throws SQLException {
|
||||
|
||||
conn=SQLiteConnection.dbConnector();
|
||||
|
||||
MenuStolowkaZPM = new JFrame();
|
||||
MenuStolowkaZPM.getContentPane().setForeground(Color.GREEN);
|
||||
MenuStolowkaZPM.setTitle("Menu Sto\u0142\u00F3wka ZPM");
|
||||
@ -51,38 +53,57 @@ public class DrukujBilet {
|
||||
MenuStolowkaZPM.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
MenuStolowkaZPM.getContentPane().setLayout(null);
|
||||
MenuStolowkaZPM.setResizable(false);
|
||||
MenuStolowkaZPM.setSize(650, 700);
|
||||
MenuStolowkaZPM.setSize(1700, 850);
|
||||
|
||||
JLabel lblMenu = new JLabel("Menu");
|
||||
JLabel lblMenu = new JLabel("MENU (Sto³ówka ZPM)");
|
||||
lblMenu.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblMenu.setBackground(Color.GREEN);
|
||||
lblMenu.setFont(new Font("Tahoma", Font.PLAIN, 50));
|
||||
lblMenu.setBounds(43, 13, 232, 40);
|
||||
lblMenu.setFont(new Font("Tahoma", Font.PLAIN, 70));
|
||||
lblMenu.setBounds(43, 13, 864, 97);
|
||||
MenuStolowkaZPM.getContentPane().add(lblMenu);
|
||||
|
||||
JToggleButton tglbtnNewToggleButton = new JToggleButton("New toggle button");
|
||||
tglbtnNewToggleButton.setBounds(32, 66, 137, 25);
|
||||
MenuStolowkaZPM.getContentPane().add(tglbtnNewToggleButton);
|
||||
try {
|
||||
String query = "SELECT * FROM dania";
|
||||
PreparedStatement pst = conn.prepareStatement(query);
|
||||
ResultSet danie = pst.executeQuery();
|
||||
//table.setModel(DbUtils.resultSetToTableModel(rs))
|
||||
|
||||
JToggleButton tglbtnNewToggleButton_1 = new JToggleButton("New toggle button");
|
||||
tglbtnNewToggleButton_1.setBounds(192, 66, 137, 25);
|
||||
MenuStolowkaZPM.getContentPane().add(tglbtnNewToggleButton_1);
|
||||
Object[] columnData = new Object[3];
|
||||
|
||||
JToggleButton tglbtnNewToggleButton_2 = new JToggleButton("New toggle button");
|
||||
tglbtnNewToggleButton_2.setBounds(32, 104, 137, 25);
|
||||
MenuStolowkaZPM.getContentPane().add(tglbtnNewToggleButton_2);
|
||||
|
||||
JToggleButton tglbtnNewToggleButton_3 = new JToggleButton("New toggle button");
|
||||
tglbtnNewToggleButton_3.setBounds(192, 104, 137, 25);
|
||||
MenuStolowkaZPM.getContentPane().add(tglbtnNewToggleButton_3);
|
||||
int count = 0;
|
||||
while (danie.next()) {
|
||||
count=count+1;
|
||||
columnData[0] = danie.getString("IDdania");
|
||||
columnData[1] = danie.getString("NazwaDania");
|
||||
columnData[2] = danie.getString("KosztDania");
|
||||
|
||||
defaultTableModel.addRow(columnData);
|
||||
|
||||
//JToggleButton Baton = new JToggleButton(NazwaDania);
|
||||
//Baton.setBounds(192, 66, 137, 25);
|
||||
//MenuStolowkaZPM.getContentPane().add(Baton);
|
||||
}
|
||||
danie.close();
|
||||
pst.close();
|
||||
} catch (Exception e1){
|
||||
JOptionPane.showMessageDialog(null, e1);
|
||||
}
|
||||
|
||||
JButton btnNewButton = new JButton("Wybierz zaznaczone / Drukuj bilet");
|
||||
btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 40));
|
||||
btnNewButton.setBounds(514, 629, 696, 127);
|
||||
MenuStolowkaZPM.getContentPane().add(btnNewButton);
|
||||
btnNewButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
//MenuStolowkaZPM.setVisible(false);
|
||||
}
|
||||
});
|
||||
btnNewButton.setBounds(32, 160, 340, 43);
|
||||
MenuStolowkaZPM.getContentPane().add(btnNewButton);
|
||||
|
||||
//try {
|
||||
|
||||
MenuStolowkaZPM.setVisible(false);
|
||||
|
||||
// } catch (Exception e1){
|
||||
// JOptionPane.showMessageDialog(null, e1);
|
||||
//}
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user