issue #7: Kleinere Designänderungen am Inspect-Frame und dem
Datenmodell.
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
package de.katho.kBorrow.gui;
|
package de.katho.kBorrow.gui;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
import de.katho.kBorrow.data.KArticle;
|
import de.katho.kBorrow.data.KArticle;
|
||||||
import de.katho.kBorrow.db.DbConnector;
|
import de.katho.kBorrow.db.DbConnector;
|
||||||
@@ -35,9 +36,40 @@ public class ArticleInspectFrame extends JFrame {
|
|||||||
article = articleModel.getArticleByRow(pRow);
|
article = articleModel.getArticleByRow(pRow);
|
||||||
|
|
||||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
setBounds(100, 100, 660, 541);
|
setBounds(150, 150, 660, 541);
|
||||||
setTitle("Details: "+article.getName());
|
setTitle("Details: "+article.getName());
|
||||||
|
|
||||||
|
// ContentPane
|
||||||
|
contentPane = new JPanel();
|
||||||
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
|
setContentPane(contentPane);
|
||||||
|
contentPane.setLayout(null);
|
||||||
|
|
||||||
|
// Panel Info
|
||||||
|
JPanel panelInfo = new JPanel();
|
||||||
|
panelInfo.setBounds(0, 0, 644, 134);
|
||||||
|
panelInfo.setBorder(BorderFactory.createTitledBorder("Artikeldetails"));
|
||||||
|
|
||||||
|
panelInfo.setLayout(null);
|
||||||
|
|
||||||
|
JLabel lblNewLabel_1 = new JLabel("Artikelname:");
|
||||||
|
JLabel lblArticleName = new JLabel(article.getName());
|
||||||
|
JLabel lblNewLabel_2 = new JLabel ("Artikelbeschreibung:");
|
||||||
|
JTextArea taArticleDesc = new JTextArea(article.getDescription());
|
||||||
|
taArticleDesc.setRows(5);
|
||||||
|
taArticleDesc.setBorder(BorderFactory.createEtchedBorder());
|
||||||
|
|
||||||
|
lblNewLabel_1.setBounds(10, 21, 100, 20);
|
||||||
|
lblNewLabel_2.setBounds(10, 47, 100, 20);
|
||||||
|
lblArticleName.setBounds(120, 21, 100, 20);
|
||||||
|
taArticleDesc.setBounds(120, 45, 250, 78);
|
||||||
|
taArticleDesc.setEditable(false);
|
||||||
|
|
||||||
|
panelInfo.add(lblNewLabel_1);
|
||||||
|
panelInfo.add(lblNewLabel_2);
|
||||||
|
panelInfo.add(lblArticleName);
|
||||||
|
panelInfo.add(taArticleDesc);
|
||||||
|
|
||||||
// Table
|
// Table
|
||||||
artInsModel = new ArticleInspectTableModel(pRow, dbCon, pModels);
|
artInsModel = new ArticleInspectTableModel(pRow, dbCon, pModels);
|
||||||
table = new JTable(artInsModel);
|
table = new JTable(artInsModel);
|
||||||
@@ -46,36 +78,14 @@ public class ArticleInspectFrame extends JFrame {
|
|||||||
table.getColumnModel().getColumn(0).setMinWidth(30);
|
table.getColumnModel().getColumn(0).setMinWidth(30);
|
||||||
table.getColumnModel().getColumn(0).setMaxWidth(30);
|
table.getColumnModel().getColumn(0).setMaxWidth(30);
|
||||||
table.getColumnModel().getColumn(0).setPreferredWidth(30);
|
table.getColumnModel().getColumn(0).setPreferredWidth(30);
|
||||||
|
|
||||||
JScrollPane scrollPane = new JScrollPane(table);
|
JScrollPane scrollPane = new JScrollPane(table);
|
||||||
|
scrollPane.setBounds(0, 131, 644, 371);
|
||||||
|
scrollPane.setBorder(BorderFactory.createTitledBorder("Alle Ausleihen des Artikels \""+article.getName()+"\""));
|
||||||
|
|
||||||
contentPane = new JPanel();
|
// Add components to ContentPane
|
||||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
contentPane.add(panelInfo);
|
||||||
contentPane.setLayout(new BorderLayout(0, 0));
|
contentPane.add(scrollPane);
|
||||||
|
|
||||||
|
|
||||||
JPanel panel = new JPanel();
|
|
||||||
|
|
||||||
panel.setLayout(null);
|
|
||||||
|
|
||||||
JLabel lblNewLabel_1 = new JLabel("Artikelname:");
|
|
||||||
JLabel lblArticleName = new JLabel(article.getName());
|
|
||||||
JLabel lblNewLabel_2 = new JLabel ("Artikelbeschreibung:");
|
|
||||||
JLabel lblArticleDesc = new JLabel(article.getDescription());
|
|
||||||
|
|
||||||
lblNewLabel_1.setBounds(0, 0, 100, 30);
|
|
||||||
lblNewLabel_2.setBounds(0, 20, 100, 30);
|
|
||||||
lblArticleName.setBounds(120, 0, 100, 30);
|
|
||||||
lblArticleDesc.setBounds(120, 20, 200, 60);
|
|
||||||
|
|
||||||
|
|
||||||
panel.add(lblNewLabel_1);
|
|
||||||
panel.add(lblNewLabel_2);
|
|
||||||
panel.add(lblArticleName);
|
|
||||||
panel.add(lblArticleDesc);
|
|
||||||
|
|
||||||
setContentPane(contentPane);
|
|
||||||
contentPane.add(panel, BorderLayout.CENTER);
|
|
||||||
contentPane.add(scrollPane, BorderLayout.SOUTH);
|
|
||||||
|
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ public class ArticleInspectTableModel extends AbstractTableModel {
|
|||||||
return data.size();
|
return data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCellEditable(int pRow, int pCol){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public Object getValueAt(int row, int col) {
|
public Object getValueAt(int row, int col) {
|
||||||
switch(col){
|
switch(col){
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user