Icons werden in Buttons verwendet.
This commit is contained in:
@@ -8,4 +8,8 @@ kBorrow is going to be a simple application to manage items that have been borro
|
||||
This software uses the Xerial SQLite JDBC (https://bitbucket.org/xerial/sqlite-jdbc). The SQLite JDBC follows the Apache License Version 2.0 (http://www.apache.org/licenses/)
|
||||
|
||||
### MySQL Connector
|
||||
This software uses the Oracle MySQL Java Connector (http://dev.mysql.com/downloads/connector/j/). The MySQL Java Connector is provided under the GPL License Version 2.0 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
|
||||
This software uses the Oracle MySQL Java Connector (http://dev.mysql.com/downloads/connector/j/). The MySQL Java Connector is provided under the GPL License Version 2.0 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
|
||||
|
||||
### Tango Desktop Project
|
||||
This software also uses icons provided by the Tango Desktop Project (http://tango.freedesktop.org/).
|
||||
License will follow!
|
||||
BIN
assets/icons/accessories-text-editor.png
Normal file
BIN
assets/icons/accessories-text-editor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 995 B |
BIN
assets/icons/edit-delete.png
Normal file
BIN
assets/icons/edit-delete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -39,7 +39,7 @@ public class Main {
|
||||
}
|
||||
try {
|
||||
new MainWindow(this.dbCon);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IOException | UnsupportedLookAndFeelException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
@@ -35,8 +36,9 @@ public class ArticleTab extends JPanel implements ActionListener {
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
* @throws IOException
|
||||
*/
|
||||
public ArticleTab(final DbConnector dbCon) {
|
||||
public ArticleTab(final DbConnector dbCon) throws IOException {
|
||||
super();
|
||||
this.setLayout(null);
|
||||
|
||||
@@ -45,14 +47,18 @@ public class ArticleTab extends JPanel implements ActionListener {
|
||||
*/
|
||||
this.articleTableModel = new ArticleTableModel(dbCon);
|
||||
JTable articleTable = new JTable(articleTableModel);
|
||||
articleTable.setRowHeight(30);
|
||||
ArticleDeleteTableButton articleDeleteTableButton = new ArticleDeleteTableButton("L<EFBFBD>schen", articleTable);
|
||||
ArticleEditTableButton articleEditTableButton = new ArticleEditTableButton("Bearbeiten", articleTable, this);
|
||||
|
||||
articleTable.getColumnModel().getColumn(4).setCellEditor(articleDeleteTableButton);
|
||||
articleTable.getColumnModel().getColumn(4).setCellRenderer(articleDeleteTableButton);
|
||||
|
||||
articleTable.getColumnModel().getColumn(3).setCellEditor(articleEditTableButton);
|
||||
articleTable.getColumnModel().getColumn(3).setCellRenderer(articleEditTableButton);
|
||||
for (int i = 3; i <= 4; i++){
|
||||
articleTable.getColumnModel().getColumn(i).setCellEditor(i == 3 ? articleEditTableButton : articleDeleteTableButton);
|
||||
articleTable.getColumnModel().getColumn(i).setCellRenderer(i == 3 ? articleEditTableButton : articleDeleteTableButton);
|
||||
|
||||
articleTable.getColumnModel().getColumn(i).setMinWidth(30);
|
||||
articleTable.getColumnModel().getColumn(i).setMaxWidth(30);
|
||||
articleTable.getColumnModel().getColumn(i).setPreferredWidth(30);
|
||||
}
|
||||
|
||||
articleTable.setFillsViewportHeight(true);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.io.IOException;
|
||||
|
||||
import de.katho.kBorrow.db.DbConnector;
|
||||
|
||||
@@ -26,8 +27,9 @@ public class MainWindow {
|
||||
* @throws IllegalAccessException
|
||||
* @throws InstantiationException
|
||||
* @throws ClassNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
public MainWindow(DbConnector pDbCon) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
|
||||
public MainWindow(DbConnector pDbCon) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException {
|
||||
this.dbCon = pDbCon;
|
||||
initialize();
|
||||
this.frame.setVisible(true);
|
||||
@@ -39,8 +41,9 @@ public class MainWindow {
|
||||
* @throws IllegalAccessException
|
||||
* @throws InstantiationException
|
||||
* @throws ClassNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
private void initialize() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
|
||||
private void initialize() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException {
|
||||
this.frame = new JFrame();
|
||||
this.frame.setResizable(false);
|
||||
this.frame.setBounds(100, 100, 600, 500);
|
||||
|
||||
@@ -3,6 +3,7 @@ package de.katho.kBorrow.gui;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
@@ -29,20 +30,25 @@ public class UserTab extends JPanel implements ActionListener {
|
||||
private int userEditId;
|
||||
private UserTableModel userTableModel;
|
||||
|
||||
public UserTab(final DbConnector dbCon){
|
||||
public UserTab(final DbConnector dbCon) throws IOException{
|
||||
super();
|
||||
this.setLayout(null);
|
||||
|
||||
//Tabelle und drumherum
|
||||
this.userTableModel = new UserTableModel(dbCon);
|
||||
JTable userTable = new JTable(userTableModel);
|
||||
userTable.setRowHeight(30);
|
||||
UserDeleteTableButton userDeleteTableButton = new UserDeleteTableButton("L<EFBFBD>schen", userTable);
|
||||
userTable.getColumnModel().getColumn(4).setCellEditor(userDeleteTableButton);
|
||||
userTable.getColumnModel().getColumn(4).setCellRenderer(userDeleteTableButton);
|
||||
|
||||
UserEditTableButton userEditTableButton = new UserEditTableButton("Bearbeiten", userTable, this);
|
||||
userTable.getColumnModel().getColumn(3).setCellEditor(userEditTableButton);
|
||||
userTable.getColumnModel().getColumn(3).setCellRenderer(userEditTableButton);
|
||||
|
||||
for (int i = 3; i <= 4; i++){
|
||||
userTable.getColumnModel().getColumn(i).setCellEditor(i == 3 ? userEditTableButton : userDeleteTableButton);
|
||||
userTable.getColumnModel().getColumn(i).setCellRenderer(i == 3 ? userEditTableButton : userDeleteTableButton);
|
||||
|
||||
userTable.getColumnModel().getColumn(i).setMinWidth(30);
|
||||
userTable.getColumnModel().getColumn(i).setMaxWidth(30);
|
||||
userTable.getColumnModel().getColumn(i).setPreferredWidth(30);
|
||||
}
|
||||
|
||||
userTable.setFillsViewportHeight(true);
|
||||
|
||||
@@ -115,7 +121,7 @@ public class UserTab extends JPanel implements ActionListener {
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this.lblUserStatus.setText("Entweder Vor- oder Nachname m<>ssen ausgef<65>llt sein.");
|
||||
this.lblUserStatus.setText("Entweder Vor- oder Nachname m<>ssen ausgef<65>llt sein.");
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -128,7 +134,7 @@ public class UserTab extends JPanel implements ActionListener {
|
||||
|
||||
switch (re){
|
||||
case 0:
|
||||
this.lblUserStatus.setText("Benutzer \""+this.textFieldUserName.getText()+" "+this.textFieldUserSurname.getText()+"\" erfolgreich hinzugef<65>gt.");
|
||||
this.lblUserStatus.setText("Benutzer \""+this.textFieldUserName.getText()+" "+this.textFieldUserSurname.getText()+"\" erfolgreich hinzugef<65>gt.");
|
||||
this.textFieldUserName.setText("");
|
||||
this.textFieldUserSurname.setText("");
|
||||
break;
|
||||
@@ -140,7 +146,7 @@ public class UserTab extends JPanel implements ActionListener {
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this.lblUserStatus.setText("Entweder Vor- oder Nachname m<>ssen ausgef<65>llt sein.");
|
||||
this.lblUserStatus.setText("Entweder Vor- oder Nachname m<>ssen ausgef<65>llt sein.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,12 @@ package de.katho.kBorrow.listener;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JTable;
|
||||
|
||||
import de.katho.kBorrow.gui.ArticleTableModel;
|
||||
@@ -14,8 +19,8 @@ public class ArticleDeleteTableButton extends TableButton {
|
||||
*/
|
||||
private static final long serialVersionUID = 7701712368979056068L;
|
||||
|
||||
public ArticleDeleteTableButton(String pLabel, JTable pTable) {
|
||||
super(pLabel, pTable);
|
||||
public ArticleDeleteTableButton(String pLabel, JTable pTable) throws IOException {
|
||||
super(new ImageIcon(ImageIO.read(new File("assets/icons/edit-delete.png"))), pTable);
|
||||
|
||||
this.buttonE.addActionListener(new ActionListener(){
|
||||
public void actionPerformed(ActionEvent e){
|
||||
|
||||
@@ -2,7 +2,11 @@ package de.katho.kBorrow.listener;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JTable;
|
||||
|
||||
import de.katho.kBorrow.gui.ArticleTab;
|
||||
@@ -15,8 +19,8 @@ public class ArticleEditTableButton extends TableButton {
|
||||
*/
|
||||
private static final long serialVersionUID = -5902626427691636902L;
|
||||
|
||||
public ArticleEditTableButton(String pLabel, JTable pTable, final ArticleTab articleTab) {
|
||||
super(pLabel, pTable);
|
||||
public ArticleEditTableButton(String pLabel, JTable pTable, final ArticleTab articleTab) throws IOException {
|
||||
super(new ImageIcon(ImageIO.read(new File("assets/icons/accessories-text-editor.png"))), pTable);
|
||||
|
||||
this.buttonE.addActionListener(new ActionListener(){
|
||||
public void actionPerformed(ActionEvent e){
|
||||
|
||||
@@ -3,6 +3,7 @@ package de.katho.kBorrow.listener;
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.AbstractCellEditor;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
@@ -15,11 +16,11 @@ public abstract class TableButton extends AbstractCellEditor implements TableCel
|
||||
protected JButton buttonR;
|
||||
protected JButton buttonE;
|
||||
|
||||
public TableButton (String pLabel, JTable pTable) {
|
||||
this.label = pLabel;
|
||||
public TableButton (ImageIcon pIcon, JTable pTable) {
|
||||
//this.label = pLabel;
|
||||
this.table = pTable;
|
||||
this.buttonR = new JButton(pLabel);
|
||||
this.buttonE = new JButton(pLabel);
|
||||
this.buttonR = new JButton(pIcon);
|
||||
this.buttonE = new JButton(pIcon);
|
||||
}
|
||||
|
||||
public Object getCellEditorValue() {
|
||||
|
||||
@@ -2,7 +2,11 @@ package de.katho.kBorrow.listener;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JTable;
|
||||
|
||||
import de.katho.kBorrow.gui.UserTableModel;
|
||||
@@ -11,8 +15,8 @@ public class UserDeleteTableButton extends TableButton {
|
||||
|
||||
private static final long serialVersionUID = -886584066497429394L;
|
||||
|
||||
public UserDeleteTableButton(String pLabel, JTable pTable){
|
||||
super(pLabel, pTable);
|
||||
public UserDeleteTableButton(String pLabel, JTable pTable) throws IOException{
|
||||
super(new ImageIcon(ImageIO.read(new File("assets/icons/edit-delete.png"))), pTable);
|
||||
|
||||
this.buttonE.addActionListener(new ActionListener(){
|
||||
public void actionPerformed(ActionEvent e){
|
||||
|
||||
@@ -2,7 +2,11 @@ package de.katho.kBorrow.listener;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JTable;
|
||||
|
||||
import de.katho.kBorrow.gui.UserTab;
|
||||
@@ -15,8 +19,8 @@ public class UserEditTableButton extends TableButton {
|
||||
*/
|
||||
private static final long serialVersionUID = -886584066497429394L;
|
||||
|
||||
public UserEditTableButton(String pLabel, JTable pTable, final UserTab pPanel){
|
||||
super(pLabel, pTable);
|
||||
public UserEditTableButton(String pLabel, JTable pTable, final UserTab pPanel) throws IOException{
|
||||
super(new ImageIcon(ImageIO.read(new File("assets/icons/accessories-text-editor.png"))), pTable);
|
||||
|
||||
this.buttonE.addActionListener(new ActionListener(){
|
||||
public void actionPerformed(ActionEvent e){
|
||||
|
||||
Reference in New Issue
Block a user