Velikost videa: 1280 X 720853 X 480640 X 360
Zobrazit ovladače přehrávání
Automatické přehrávání
Přehrát
Thank You :)
My pleasure
❤❤❤❤❤❤❤❤❤❤❤
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
The most common problem is the layout. You may try setting your layout to null, or using a different type of layout.
@@alleyb62Layout is already set to null :(
@@alleyb62 is the problem still there? maybe i could help you, but need to see the code, is itsame as the video?
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()); }}
true:(
Thank You :)
My pleasure
❤❤❤❤❤❤❤❤❤❤❤
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
The most common problem is the layout. You may try setting your layout to null, or using a different type of layout.
@@alleyb62Layout is already set to null :(
@@alleyb62 is the problem still there? maybe i could help you, but need to see the code, is it
same as the video?
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());
}
}
true
:(