Java Swing JTable Demo

  Рет қаралды 13,536

Alley B

Alley B

Күн бұрын

Пікірлер: 11
@andreirizea5407
@andreirizea5407 Жыл бұрын
I’ve done exactly the same as you but my table will not want to render onto the screen. Any ideas why.l? It is added to the correct panel
@alleyb62
@alleyb62 Жыл бұрын
The most common problem is the layout. You may try setting your layout to null, or using a different type of layout.
@andreirizea5407
@andreirizea5407 Жыл бұрын
@@alleyb62Layout is already set to null :(
@kevinhart437
@kevinhart437 Жыл бұрын
@@alleyb62 is the problem still there? maybe i could help you, but need to see the code, is it same as the video?
@kevinhart437
@kevinhart437 Жыл бұрын
package App.Anmeldung; import javax.swing.*; import javax.swing.filechooser.FileSystemView; import java.awt.*; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; public class AnmeldungsFenster { JFrame frame; JPanel panel; JScrollPane scrollPane; JTable table; String[] spalten; Object[][] data; public AnmeldungsFenster() { frame = new JFrame(); panel = new JPanel(); spalten = new String[]{"Interne Bezeichnung", "elektr. Bezeichnung", "Zulassung", "Artikelnummer EK", "Artikelnummer VK", "Warencode", "Verkaufart", "Packungsgrößen", "EU-NUmmer", "Packmittel Bez.", "elektr. Packmittel Bez.", "Zielland", "PPN/PZN", "Dormant", "GTIN", "Packmittel", "Material Bez."}; data = getData(); table = new JTable(data, spalten); scrollPane = new JScrollPane(table); panel.setLayout(new BorderLayout()); panel.add(scrollPane, BorderLayout.CENTER); frame.add(panel); frame.setSize(1290, 860); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } Object[][] getData() { String path = FileSystemView.getFileSystemView().getDefaultDirectory().getPath(); try { BufferedReader br = new BufferedReader(new FileReader(path + "/Mappe1.csv")); //change to you name the expetion that will come maybe show your whole data path mine is : C:\Users\instadmin\OneDrive\Dokumente + "\YOURFILE" ArrayList list = new ArrayList(); String str = ""; while ((str = br.readLine()) != null) { String[] rowData = str.split(","); list.add(rowData); System.out.println(str); } int n = spalten.length; Object[][] data = new Object[list.size()][n]; for (int i = 0; i < list.size(); i++) { String[] rowData = list.get(i); if (rowData.length != n) { rowData = new String[n]; } data[i] = rowData; } br.close(); return data; } catch (FileNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } public static void main(String[] args) { SwingUtilities.invokeLater(() -> new AnmeldungsFenster()); } }
@malshisathsarani5196
@malshisathsarani5196 Жыл бұрын
true :(
@magnadux8123
@magnadux8123 11 ай бұрын
Thank You :)
@alleyb62
@alleyb62 11 ай бұрын
My pleasure
@KennethGarcia-x2n
@KennethGarcia-x2n 3 ай бұрын
Christiansen Avenue
@gessocode
@gessocode 7 ай бұрын
❤❤❤❤❤❤❤❤❤❤❤
JTable in JAVA Swing | ADD Data into JTable
16:25
Knowledge to Share
Рет қаралды 157 М.
Java JOptionPane 🛑
12:26
Bro Code
Рет қаралды 97 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
Part 4: Python SQLite Relational Database - Insert Artist
7:00
WNCC IT Program
Рет қаралды 6
Java textfield 📛
10:07
Bro Code
Рет қаралды 76 М.
A tricky Harvard Exam Question | Nice Radical Math Problem.!!
8:08
Arraylist with objects in Java
12:37
Alley B
Рет қаралды 21 М.
Java clock app 🕓
16:30
Bro Code
Рет қаралды 77 М.
JAVA - How to Create a Table with JTable in Eclipse
20:55
Ganda1f
Рет қаралды 38 М.
Advent of Code: Catch-up Day 17 Part 2
51:38
Paul McBurney
Рет қаралды 18
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН