-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeeAllCustomers.java
108 lines (93 loc) · 2.91 KB
/
SeeAllCustomers.java
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
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.JTextPane;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import javax.swing.JRadioButton;
import net.miginfocom.swing.MigLayout;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.BoxLayout;
import java.awt.CardLayout;
import javax.swing.JButton;
import java.awt.FlowLayout;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SpringLayout;
import java.awt.GridBagConstraints;
import com.jgoodies.forms.layout.FormSpecs;
import javax.swing.JScrollBar;
import java.awt.event.MouseWheelListener;
import java.awt.event.MouseWheelEvent;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.ScrollPane;
import javax.swing.JTextField;
import javax.swing.DropMode;
public class SeeAllCustomers extends JFrame {
private JPanel contentPane;
File file=new File ("Zoo.txt");
private final ScrollPane scrollPane = new ScrollPane();
private JLabel textField;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SeeAllCustomers frame = new SeeAllCustomers();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public SeeAllCustomers() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 693, 776);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
textField = new JLabel();
JScrollPane ScrollPane = new JScrollPane(textField,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
ScrollPane.setBounds( 0, 0, 600, 600);
contentPane.add(ScrollPane);
if( file.exists()) {
try {
FileReader r=new FileReader(file);
BufferedReader b=new BufferedReader(r);
String line;
int y=1;
int heigth =50;
int x=Short.MAX_VALUE;
while ((line=b.readLine())!=null) {
JLabel lblNewLabel = new JLabel(line);
lblNewLabel.setBounds(0, y, x, heigth);
lblNewLabel.setOpaque(true);
lblNewLabel.setBackground(Color.WHITE);
lblNewLabel.setHorizontalAlignment(SwingConstants.LEFT);
y=y+heigth;
textField.add(lblNewLabel);
}
b.close();
r.close();
}catch(IOException e) {
}
}
}
}