Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import javax.swing.JPanel;
- import javax.swing.JTable;
- import javax.swing.table.DefaultTableModel;
- import utils.Utils;
- import javax.swing.JScrollPane;
- import javax.swing.JButton;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- public class Jpanel1 extends JPanel {
- private JTable table;
- private JScrollPane scrollPane;
- private JButton btnActivate;
- /**
- * Create the panel.
- */
- public Jpanel1() {
- initialize();
- }
- private void initialize() {
- setLayout(null);
- add(getScrollPane());
- add(getBtnActivate());
- }
- public JTable getTable() {
- if (table == null) {
- table = new JTable();
- table.setModel(new DefaultTableModel(
- new Object[][] {
- {"aaaa", "bbbb", "ccc", "ddd"},
- {"ddd", "ddd", "ddd", "ddd"},
- {"ddd", "ddd", "ddd", "ddd"},
- {"", "ddd", "ddd", "ddd"},
- {"ddd", "ddd", "ddd", "ddd"},
- },
- new String[] {
- "New column", "New column", "New column", "New column"
- }
- ));
- }
- return table;
- }
- private JScrollPane getScrollPane() {
- if (scrollPane == null) {
- scrollPane = new JScrollPane();
- scrollPane.setBounds(47, 130, 280, 140);
- scrollPane.setViewportView(getTable());
- }
- return scrollPane;
- }
- private JButton getBtnActivate() {
- if (btnActivate == null) {
- btnActivate = new JButton("activate");
- btnActivate.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Utils a = new Utils();
- a.RAZ();
- }
- });
- btnActivate.setBounds(96, 35, 89, 23);
- }
- return btnActivate;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement