Subversion Repository Public Repository

FingerPrint_5.2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
package test;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.PrintJob;
import java.awt.Toolkit;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.border.LineBorder;
import javax.swing.UIManager;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;

import java.awt.event.ActionListener;
import java.util.Vector;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;

public class ModalTicketDetails extends JFrame {

	private final JPanel contentPanel = new JPanel();
	JLabel txtVisitorId;
	JLabel txtVisitorName;
	JLabel txtWhomToMeet;
	JLabel txtPurposeOfVisit;
	JLabel txtCheckinTime;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			ModalTicketDetails dialog = new ModalTicketDetails(new Vector());
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public ModalTicketDetails(Vector details_vector) {
		setTitle("Ticket");
		setBounds(100, 100, 654, 377);
		setResizable(false);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBackground(Color.WHITE);
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);
		
		JLabel lblHeading = new JLabel("Entry Ticket");
		lblHeading.setFont(new Font("Arial Unicode MS", Font.BOLD, 16));
		lblHeading.setBounds(261, 96, 114, 23);
		contentPanel.add(lblHeading);
		
		JPanel panel = new JPanel();
		panel.setBackground(Color.LIGHT_GRAY);
		panel.setBorder(new LineBorder(Color.GRAY, 1, true));
		panel.setBounds(36, 130, 571, 126);
		contentPanel.add(panel);
		panel.setLayout(null);
		
		JLabel lblVisitorId = new JLabel("Visitor Id");
		lblVisitorId.setBounds(10, 11, 106, 14);
		panel.add(lblVisitorId);
		lblVisitorId.setFont(new Font("Arial Unicode MS", Font.BOLD, 12));
		
		JLabel lblVisitorName = new JLabel("Visitor Name");
		lblVisitorName.setBounds(229, 11, 106, 14);
		panel.add(lblVisitorName);
		lblVisitorName.setFont(new Font("Arial Unicode MS", Font.BOLD, 12));
		
		JLabel lblWhomToMeet = new JLabel("Whom To Meet");
		lblWhomToMeet.setBounds(10, 40, 106, 14);
		panel.add(lblWhomToMeet);
		lblWhomToMeet.setFont(new Font("Arial Unicode MS", Font.BOLD, 12));
		
		JLabel lblPurposeOfVisit = new JLabel("Purpose Of Visit");
		lblPurposeOfVisit.setBounds(10, 65, 106, 14);
		panel.add(lblPurposeOfVisit);
		lblPurposeOfVisit.setFont(new Font("Arial Unicode MS", Font.BOLD, 12));
		
		JLabel lblCheckinTime = new JLabel("Time of Visit");
		lblCheckinTime.setBounds(10, 94, 106, 14);
		panel.add(lblCheckinTime);
		lblCheckinTime.setFont(new Font("Arial Unicode MS", Font.BOLD, 12));

		txtVisitorId = new JLabel("NA");
		txtVisitorId.setFont(new Font("Arial Unicode MS", Font.PLAIN, 12));
		txtVisitorId.setBounds(126, 11, 77, 14);
		panel.add(txtVisitorId);
		
		txtVisitorName = new JLabel("NA");
		txtVisitorName.setFont(new Font("Arial Unicode MS", Font.PLAIN, 12));
		txtVisitorName.setBounds(338, 11, 209, 14);
		panel.add(txtVisitorName);
		
		txtWhomToMeet = new JLabel("NA");
		txtWhomToMeet.setFont(new Font("Arial Unicode MS", Font.PLAIN, 12));
		txtWhomToMeet.setBounds(126, 40, 405, 14);
		panel.add(txtWhomToMeet);
		
		txtPurposeOfVisit = new JLabel("NA");
		txtPurposeOfVisit.setFont(new Font("Arial Unicode MS", Font.PLAIN, 12));
		txtPurposeOfVisit.setBounds(126, 65, 405, 14);
		panel.add(txtPurposeOfVisit);
		
		txtCheckinTime = new JLabel("NA");
		txtCheckinTime.setFont(new Font("Arial Unicode MS", Font.PLAIN, 12));
		txtCheckinTime.setBounds(126, 94, 390, 14);
		panel.add(txtCheckinTime);
		
		JLabel lblLogo = new JLabel("");
		lblLogo.setIcon(new ImageIcon("images/adyantlogo.png"));
		lblLogo.setBounds(0, 0, 648, 75);
		contentPanel.add(lblLogo);
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton("  Print  ");
				okButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						okButtonActionPerformed(e);
					}
				});
				okButton.setFont(new Font("Arial Unicode MS", Font.PLAIN, 12));
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
			{
				JButton cancelButton = new JButton("Cancel");
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						dispose();
					}
				});
				cancelButton.setFont(new Font("Arial Unicode MS", Font.PLAIN, 12));
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
		loadData(details_vector);
	}
	
	protected void okButtonActionPerformed(ActionEvent e) {
		Toolkit tkp = this.getToolkit();
	    PrintJob pjp = tkp.getPrintJob(this, null, null);
	    Graphics g = pjp.getGraphics();
	    contentPanel.print(g);
	    g.dispose();
	    pjp.end();
	}

	public void loadData(Vector details_vector){
		if(details_vector.size() > 0){
			txtVisitorId.setText(details_vector.elementAt(0).toString());
			txtVisitorName.setText(details_vector.elementAt(1).toString());
			txtWhomToMeet.setText(details_vector.elementAt(2).toString());
			txtPurposeOfVisit.setText(details_vector.elementAt(4).toString());
			txtCheckinTime.setText(details_vector.elementAt(5).toString());
		}
	}
}

Commits for FingerPrint_5.2/src/test/ModalTicketDetails.java

Diff revisions: vs.
Revision Author Commited Message
1 lingaraj picture lingaraj Sat 24 Nov, 2018 09:32:39 +0000