import java.sql.Date;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
public class PanelCategory extends JPanel{
//Attribute
private JLabel date;
private JLabel catg = new JLabel();
private JScrollPane scrPane;
private JTextField txt;
private JComboBox <String> Boxcatg;
private Timer dateTimer;
private TimerTask timerTask;
// int catgNo;
PanelCategory() {
this.setLayout(null);
this.setOpaque(true);
this.setBackground(FinanzGlueck_GUI.PANEL_BACKGR);
//Methode ausführen
addContent();
this.add(date);
this.add(catg);
this.add(Boxcatg);
this.add(scrPane);
this.setVisible(true);
}
public void addContent() {
//Date
date = new JLabel();
date.setBounds(10, 80, 110, 20);
date.setText("");
date.setFont(FinanzGlueck_GUI.ARIAL_BOLD_20);
//Date TimerTask & Timer
timerTask = new TimerTask() {
@Override
public void run() {
GregorianCalendar gCal = new GregorianCalendar();
date.setText(gCal.get(Calendar.DATE) + "." + (gCal.get(Calendar.MONTH) + 1) + "."+ gCal.get(Calendar.YEAR));
}
};
dateTimer = new Timer();
dateTimer.schedule(timerTask,0,60000);
//Categories
catg.setText("Kategorie: ");
catg.setBounds(10,30,150,25);
catg.setBackground(FinanzGlueck_GUI.COMP_BACKGR);
catg.setFont(FinanzGlueck_GUI.ARIAL_BOLD_20);
//ComboBox
String[] catArray = {"Nahrungsmittel", "Freizeit","Miete", "Gesundheit", "Bildung", "Auto", "Haus", "Versicherung", "Gehalt", "Geschenke","Sonstiges"};
Boxcatg = new JComboBox<String>(catArray);
Boxcatg.setBackground(FinanzGlueck_GUI.COMP_BACKGR);
Boxcatg.setFont(FinanzGlueck_GUI.ARIAL_12);
Boxcatg.setBounds(120, 30, 150, 20);
//ScrollPane
txt = new JTextField();
txt.add(new JLabel("HAJJHJHFVKJHVKJHK"));
// JPanel panel = new JPanel();
txt.setBounds(80, 80, 80, 80);
// panel.add(new JLabel("viel zu langer Textt"));
scrPane = new JScrollPane(txt);
scrPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
scrPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
}