package surface;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.AbstractAction;
import java.awt.event.ActionEvent;
import javax.swing.Action;
import javax.swing.JMenu;
import javax.swing.JPopupMenu;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Label;
import java.awt.GridLayout;
import java.awt.Window;
import javax.swing.BoxLayout;
import java.awt.event.ActionListener;
import javax.swing.JTabbedPane;
import java.awt.CardLayout;
import javax.swing.JPanel;
import java.awt.Color;
import javax.swing.SwingConstants;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JScrollBar;
import javax.swing.table.DefaultTableModel;
import javax.swing.AbstractListModel;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import java.awt.Button;
import javax.swing.JTree;
import javax.swing.JEditorPane;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
public class Main {
private JFrame frmCleanArtillery;
private final Action action = new SwingAction();
private final Action action_1 = new SwingAction_1();
private JTextField tfname;
int y = 0;
private JTextField[] fieldname;
private JButton btnSpeichern;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Main window = new Main();
window.frmCleanArtillery.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public Main() {
initialize();
}
private void initialize() {
frmCleanArtillery = new JFrame();
frmCleanArtillery.setTitle("Clean Artillery");
frmCleanArtillery.setBounds(100, 100, 690, 442);
frmCleanArtillery.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmCleanArtillery.getContentPane().setLayout(new CardLayout(0, 0));
JPanel home = new JPanel();
home.setBackground(new Color(153, 204, 255));
frmCleanArtillery.getContentPane().add(home, "name_902001608085318");
home.setLayout(null);
JLabel lblCleanArtillary = new JLabel(
" Clean Artillery");
lblCleanArtillary.setBackground(Color.WHITE);
lblCleanArtillary.setFont(new Font("Comic Sans MS", Font.BOLD
| Font.ITALIC, 20));
lblCleanArtillary.setForeground(Color.BLACK);
lblCleanArtillary.setBounds(0, 11, 674, 50);
home.add(lblCleanArtillary);
JButton btnNeuesAlbum = new JButton("Neues Album");
btnNeuesAlbum.setBackground(Color.LIGHT_GRAY);
btnNeuesAlbum.setFont(new Font("Comic Sans MS",
Font.BOLD | Font.ITALIC, 13));
btnNeuesAlbum.setBounds(55, 89, 121, 23);
home.add(btnNeuesAlbum);
JButton btnBibliothek = new JButton("Bibliothek");
btnBibliothek.setBackground(Color.LIGHT_GRAY);
btnBibliothek.setFont(new Font("Comic Sans MS",
Font.BOLD | Font.ITALIC, 13));
btnBibliothek.setBounds(55, 123, 121, 23);
home.add(btnBibliothek);
home.setVisible(true);
JPanel nalbum = new JPanel();
nalbum.setBackground(new Color(0, 153, 255));
frmCleanArtillery.getContentPane().add(nalbum, "name_901860942996594");
nalbum.setLayout(null);
JLabel lblName = new JLabel("Name:");
lblName.setFont(new Font("Comic Sans MS", Font.BOLD | Font.ITALIC, 15));
lblName.setBounds(10, 26, 64, 41);
nalbum.add(lblName);
JLabel lblNewLabel = new JLabel("Titelanzahl:");
lblNewLabel.setFont(new Font("Comic Sans MS", Font.BOLD | Font.ITALIC,
15));
lblNewLabel.setBounds(10, 59, 94, 41);
nalbum.add(lblNewLabel);
tfname = new JTextField();
tfname.setBounds(125, 26, 137, 35);
nalbum.add(tfname);
tfname.setColumns(10);
Button btnhome = new Button("Home");
btnhome.setFont(new Font("Comic Sans MS", Font.BOLD | Font.ITALIC, 14));
btnhome.setBounds(0, 0, 70, 22);
nalbum.add(btnhome);
JButton btnNeuesAlbumErstellen = new JButton("Neues Album erstellen");
btnNeuesAlbumErstellen.setFont(new Font("Comic Sans MS", Font.BOLD
| Font.ITALIC, 15));
btnNeuesAlbumErstellen.setBounds(10, 230, 214, 23);
nalbum.add(btnNeuesAlbumErstellen);
JMenu titelname = new JMenu("Titelname");
titelname.setFont(new Font("Comic Sans MS", Font.BOLD | Font.ITALIC, 15));
titelname.setBounds(0, 111, 104, 41);
nalbum.add(titelname);
JSpinner sptanz = new JSpinner();
sptanz.setFont(new Font("Comic Sans MS", Font.BOLD | Font.ITALIC, 13));
sptanz.setModel(new SpinnerNumberModel(new Integer(0), new Integer(0), null, new Integer(1)));
sptanz.setBounds(125, 64, 49, 35);
nalbum.add(sptanz);
btnSpeichern = new JButton("speichern");
btnSpeichern.setBounds(173, 70, 89, 23);
nalbum.add(btnSpeichern);
JPanel bib = new JPanel();
bib.setBackground(new Color(153, 51, 51));
frmCleanArtillery.getContentPane().add(bib, "name_901630806780487");
bib.setLayout(null);
Button btnhome2 = new Button("Home");
btnhome2.setBackground(new Color(255, 255, 255));
btnhome2.setFont(new Font("Comic Sans MS", Font.BOLD | Font.ITALIC, 14));
btnhome2.setBounds(0, 0, 70, 22);
bib.add(btnhome2);
bib.setVisible(false);
btnhome.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
home.setVisible(true);
bib.setVisible(false);
nalbum.setVisible(false);
}
});
btnhome2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
home.setVisible(true);
bib.setVisible(false);
nalbum.setVisible(false);
}
});
btnSpeichern.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int anzt = (int)sptanz.getValue();
System.out.println(anzt);
for (int i = 0; i < 5; i++) {
fieldname[i] = new JTextField();
titelname.add(fieldname[i]);
}
}
});
btnNeuesAlbum.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
home.setVisible(false);
bib.setVisible(false);
nalbum.setVisible(true);
}
});
btnBibliothek.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
home.setVisible(false);
bib.setVisible(true);
nalbum.setVisible(false);
}
});
}
private class SwingAction extends AbstractAction {
public SwingAction() {
putValue(NAME, "SwingAction");
putValue(SHORT_DESCRIPTION, "Some short description");
}
public void actionPerformed(ActionEvent e) {
}
}
private class SwingAction_1 extends AbstractAction {
public SwingAction_1() {
putValue(NAME, "SwingAction_1");
putValue(SHORT_DESCRIPTION, "Some short description");
}
public void actionPerformed(ActionEvent e) {
}
}
private static void addPopup(Component component, final JPopupMenu popup) {
component.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger()) {
showMenu(e);
}
}
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
showMenu(e);
}
}
private void showMenu(MouseEvent e) {
popup.show(e.getComponent(), e.getX(), e.getY());
}
});
}
}