summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Listing3807.java
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/hjp5/examples/Listing3807.java
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Reference Architectures and Patterns/hjp5/examples/Listing3807.java')
-rw-r--r--Master/Reference Architectures and Patterns/hjp5/examples/Listing3807.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/hjp5/examples/Listing3807.java b/Master/Reference Architectures and Patterns/hjp5/examples/Listing3807.java
new file mode 100644
index 0000000..78ee67e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/hjp5/examples/Listing3807.java
@@ -0,0 +1,42 @@
+/* Listing3807.java */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+public class Listing3807
+extends JFrame
+implements ActionListener
+{
+ JTable table;
+ SparseTableModel tableModel;
+
+ public Listing3807()
+ {
+ super("JTable 2");
+ addWindowListener(new WindowClosingAdapter(true));
+ tableModel = new SparseTableModel(1000);
+ table = new JTable(tableModel, null);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+ table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+ table.setCellSelectionEnabled(true);
+ Container cp = getContentPane();
+ cp.add(new JScrollPane(table), BorderLayout.CENTER);
+ JButton button = new JButton("Drucken");
+ button.addActionListener(this);
+ cp.add(button, BorderLayout.SOUTH);
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ tableModel.printData();
+ }
+
+ public static void main(String[] args)
+ {
+ Listing3807 frame = new Listing3807();
+ frame.setLocation(100, 100);
+ frame.setSize(320, 200);
+ frame.setVisible(true);
+ }
+} \ No newline at end of file