package GUIPanels;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Label;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class NeuBuecherAdmin extends JFrame{
public JFrame frame, Dateiauswahl;
private Label lblFoto;
private JLabel lblBuecher,lblTitel, lblAutor, lblJahr, lblGenre, lblLink;
private JTextField txtAutor,txtTitel,txtJahr,txtGenre,txtLink ;
private JTextPane txtBeschreibung;
private JButton btnSpeichern, btnZurueck, btnBrowse;
private JFileChooser FotoDatei;
private FileNameExtensionFilter Fotofilter;
public NeuBuecherAdmin() {
// Frame
frame = new JFrame();
frame.getContentPane().setLayout(null);
//ContentPane FARBE + Layout
getContentPane().setBackground(new Color(255, 255, 255));
getContentPane().setLayout(null);
// Foto Platzhalter
lblFoto = new Label("");
lblFoto.setBackground(new Color(230, 230, 250));
lblFoto.setBounds(399, 66, 128, 165);
getContentPane().add(lblFoto);
btnBrowse = new JButton("Browse");
btnBrowse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
FotoDatei = new JFileChooser();
FotoDatei.showOpenDialog(null);
File Foto = FotoDatei.getSelectedFile();
}
});
btnBrowse.setBounds(419, 237, 89, 23);
getContentPane().add(btnBrowse);
// Alles zum FileChooser---------------------------------------------------------------------------
//Filter
Fotofilter = new FileNameExtensionFilter("Bilder", "gif", "png", "jpg");
FotoDatei.addChoosableFileFilter(Fotofilter);
// Erzeugung eines neuen Frames mit dem Titel "Dateiauswahl"
Dateiauswahl = new JFrame("Dateiauswahl");
Dateiauswahl.setSize(450,300);
Dateiauswahl.getContentPane().add(FotoDatei);
Dateiauswahl.setVisible(true);
//-------------------------------------------------------------------------------------------------
// Überschrift
lblBuecher = new JLabel("B\u00FCcher");
lblBuecher.setFont(new Font("Tahoma", Font.BOLD, 14));
lblBuecher.setBounds(10, 11, 89, 14);
getContentPane().add(lblBuecher);
// Beschreibungsfeld
txtBeschreibung = new JTextPane();
txtBeschreibung.setBackground(new Color(230, 230, 250));
txtBeschreibung.setBounds(10, 288, 535, 152);
getContentPane().add(txtBeschreibung);
// Buttons Speichern und Zurück
btnSpeichern = new JButton("Speichern");
btnSpeichern.setBounds(10, 468, 104, 23);
getContentPane().add(btnSpeichern);
btnZurueck = new JButton("Zur\u00FCck");
btnZurueck.setBounds(441, 468, 104, 23);
getContentPane().add(btnZurueck);
// Textfelder zum reinschreiben
txtAutor = new JTextField();
txtAutor.setBounds(73, 100, 146, 23);
getContentPane().add(txtAutor);
txtAutor.setColumns(20);
txtTitel = new JTextField();
txtTitel.setBounds(73, 66, 146, 23);
getContentPane().add(txtTitel);
txtTitel.setColumns(10);
txtJahr = new JTextField();
txtJahr.setColumns(10);
txtJahr.setBounds(73, 134, 146, 23);
getContentPane().add(txtJahr);
txtGenre = new JTextField();
txtGenre.setColumns(10);
txtGenre.setBounds(73, 168, 146, 23);
getContentPane().add(txtGenre);
txtLink = new JTextField();
txtLink.setColumns(10);
txtLink.setBounds(73, 202, 146, 23);
getContentPane().add(txtLink);
// JLabels, was rein kommt
lblTitel = new JLabel("Titel:");
lblTitel.setBounds(10, 66, 46, 14);
getContentPane().add(lblTitel);
lblAutor = new JLabel("Autor:");
lblAutor.setBounds(10, 104, 58, 14);
getContentPane().add(lblAutor);
lblJahr = new JLabel("Jahr:");
lblJahr.setBounds(10, 138, 46, 14);
getContentPane().add(lblJahr);
lblGenre = new JLabel("Genre:");
lblGenre.setBounds(10, 172, 46, 14);
getContentPane().add(lblGenre);
lblLink = new JLabel("Link:");
lblLink.setBounds(10, 206, 46, 14);
getContentPane().add(lblLink);
}
}
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Label;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class NeuBuecherAdmin extends JFrame{
public JFrame frame, Dateiauswahl;
private Label lblFoto;
private JLabel lblBuecher,lblTitel, lblAutor, lblJahr, lblGenre, lblLink;
private JTextField txtAutor,txtTitel,txtJahr,txtGenre,txtLink ;
private JTextPane txtBeschreibung;
private JButton btnSpeichern, btnZurueck, btnBrowse;
private JFileChooser FotoDatei;
private FileNameExtensionFilter Fotofilter;
public NeuBuecherAdmin() {
// Frame
frame = new JFrame();
frame.getContentPane().setLayout(null);
//ContentPane FARBE + Layout
getContentPane().setBackground(new Color(255, 255, 255));
getContentPane().setLayout(null);
// Foto Platzhalter
lblFoto = new Label("");
lblFoto.setBackground(new Color(230, 230, 250));
lblFoto.setBounds(399, 66, 128, 165);
getContentPane().add(lblFoto);
btnBrowse = new JButton("Browse");
btnBrowse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
FotoDatei = new JFileChooser();
FotoDatei.showOpenDialog(null);
File Foto = FotoDatei.getSelectedFile();
}
});
btnBrowse.setBounds(419, 237, 89, 23);
getContentPane().add(btnBrowse);
// Alles zum FileChooser---------------------------------------------------------------------------
//Filter
Fotofilter = new FileNameExtensionFilter("Bilder", "gif", "png", "jpg");
FotoDatei.addChoosableFileFilter(Fotofilter);
// Erzeugung eines neuen Frames mit dem Titel "Dateiauswahl"
Dateiauswahl = new JFrame("Dateiauswahl");
Dateiauswahl.setSize(450,300);
Dateiauswahl.getContentPane().add(FotoDatei);
Dateiauswahl.setVisible(true);
//-------------------------------------------------------------------------------------------------
// Überschrift
lblBuecher = new JLabel("B\u00FCcher");
lblBuecher.setFont(new Font("Tahoma", Font.BOLD, 14));
lblBuecher.setBounds(10, 11, 89, 14);
getContentPane().add(lblBuecher);
// Beschreibungsfeld
txtBeschreibung = new JTextPane();
txtBeschreibung.setBackground(new Color(230, 230, 250));
txtBeschreibung.setBounds(10, 288, 535, 152);
getContentPane().add(txtBeschreibung);
// Buttons Speichern und Zurück
btnSpeichern = new JButton("Speichern");
btnSpeichern.setBounds(10, 468, 104, 23);
getContentPane().add(btnSpeichern);
btnZurueck = new JButton("Zur\u00FCck");
btnZurueck.setBounds(441, 468, 104, 23);
getContentPane().add(btnZurueck);
// Textfelder zum reinschreiben
txtAutor = new JTextField();
txtAutor.setBounds(73, 100, 146, 23);
getContentPane().add(txtAutor);
txtAutor.setColumns(20);
txtTitel = new JTextField();
txtTitel.setBounds(73, 66, 146, 23);
getContentPane().add(txtTitel);
txtTitel.setColumns(10);
txtJahr = new JTextField();
txtJahr.setColumns(10);
txtJahr.setBounds(73, 134, 146, 23);
getContentPane().add(txtJahr);
txtGenre = new JTextField();
txtGenre.setColumns(10);
txtGenre.setBounds(73, 168, 146, 23);
getContentPane().add(txtGenre);
txtLink = new JTextField();
txtLink.setColumns(10);
txtLink.setBounds(73, 202, 146, 23);
getContentPane().add(txtLink);
// JLabels, was rein kommt
lblTitel = new JLabel("Titel:");
lblTitel.setBounds(10, 66, 46, 14);
getContentPane().add(lblTitel);
lblAutor = new JLabel("Autor:");
lblAutor.setBounds(10, 104, 58, 14);
getContentPane().add(lblAutor);
lblJahr = new JLabel("Jahr:");
lblJahr.setBounds(10, 138, 46, 14);
getContentPane().add(lblJahr);
lblGenre = new JLabel("Genre:");
lblGenre.setBounds(10, 172, 46, 14);
getContentPane().add(lblGenre);
lblLink = new JLabel("Link:");
lblLink.setBounds(10, 206, 46, 14);
getContentPane().add(lblLink);
}
}