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