Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package a6036.ruimendes;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JScrollPane;
- import java.awt.BorderLayout;
- import javax.swing.JPanel;
- import javax.swing.JToolBar;
- import javax.swing.JLabel;
- import javax.swing.JMenuBar;
- import javax.swing.JMenu;
- import javax.swing.JMenuItem;
- import javax.swing.JOptionPane;
- import java.awt.CardLayout;
- import javax.swing.JTextField;
- import java.awt.Color;
- import javax.swing.SwingConstants;
- import java.awt.GridBagLayout;
- import java.awt.GridBagConstraints;
- import javax.swing.JComboBox;
- import javax.swing.JSpinner.DateEditor;
- import javax.swing.JSpinner;
- import org.jdatepicker.impl.JDatePanelImpl;
- import org.jdatepicker.impl.JDatePickerImpl;
- import org.jdatepicker.impl.UtilDateModel;
- import org.jdatepicker.util.JDatePickerUtil;
- import javax.swing.JTextPane;
- import javax.swing.DropMode;
- import javax.swing.JTable;
- import java.awt.GridLayout;
- import javax.swing.JButton;
- import javax.swing.BoxLayout;
- import java.awt.Insets;
- import java.awt.event.ActionListener;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import java.time.LocalDate;
- import java.util.Date;
- import java.util.Properties;
- import java.awt.event.ActionEvent;
- import java.awt.Container;
- public class Agenda1 {
- private JFrame frame;
- private JTextField textEvento;
- private JTextField textTipo;
- private JTextField textHoraInicio;
- private JTextField textDuracao;
- private JTextField textLocal;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- Agenda1 window = new Agenda1();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public Agenda1() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- frame.setBounds(100, 100, 450, 300);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(new CardLayout(0, 0));
- JScrollPane scrollPane = new JScrollPane();
- frame.getContentPane().add(scrollPane, "name_7610722565189");
- JPanel panelEditar = new JPanel();
- frame.getContentPane().add(panelEditar, "panelEditar");
- panelEditar.setLayout(new CardLayout(0, 0));
- JScrollPane scrollPane_1 = new JScrollPane();
- frame.getContentPane().add(scrollPane_1, "name_7610739268910");
- JMenuBar menuBar = new JMenuBar();
- frame.setJMenuBar(menuBar);
- JMenu mnConsultar = new JMenu("Consultar");
- menuBar.add(mnConsultar);
- JMenuItem mntmDia = new JMenuItem("Dia");
- mnConsultar.add(mntmDia);
- JMenu mnEvento = new JMenu("Evento");
- menuBar.add(mnEvento);
- JMenuItem mntmEditar = new JMenuItem("Editar");
- mntmEditar.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- CardLayout card=(CardLayout)frame.getContentPane().getLayout();
- card.show(frame.getContentPane(), "panelEditar");
- }
- });
- mnEvento.add(mntmEditar);
- JMenuItem mntmApagar = new JMenuItem("Apagar");
- mnEvento.add(mntmApagar);
- JMenuItem mntmInserir = new JMenuItem("Inserir");
- mntmInserir.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- CardLayout card=(CardLayout)frame.getContentPane().getLayout();
- card.show(frame.getContentPane(), "panelEvento");
- }
- });
- // mntmInserir.addActionListener(new ActionListener() {
- // public void actionPerformed(ActionEvent e) {
- // GridBagLayout panel=(GridBagLayout)frame.getContentPane().getLayout();
- // panel.add(frame.getContentPane(), "panelEvento");
- // }
- //});
- /*JMenuItem mntmConsultar = new JMenuItem("Consultar");
- mntmConsultar.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- preencheTabelaMovimentos();
- CardLayout card=(CardLayout)frame.getContentPane().getLayout();
- card.show(frame.getContentPane(), "panelConsultar");
- }
- });
- */
- mnEvento.add(mntmInserir);
- JPanel panelConsultarDia = new JPanel();
- panelConsultarDia.setBackground(new Color(245, 255, 250));
- scrollPane.setViewportView(panelConsultarDia);
- GridBagLayout gbl_panelConsultarDia = new GridBagLayout();
- gbl_panelConsultarDia.columnWidths = new int[]{0, 0, 0, 0, 53, 102, 55, 0};
- gbl_panelConsultarDia.rowHeights = new int[]{0, 0, 0, 0, 0, 0};
- gbl_panelConsultarDia.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
- gbl_panelConsultarDia.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- panelConsultarDia.setLayout(gbl_panelConsultarDia);
- UtilDateModel model = new UtilDateModel();
- LocalDate hoje=LocalDate.now();
- model.setDate(hoje.getYear(), hoje.getMonthValue()-1, hoje.getDayOfMonth());
- Properties p = new Properties();
- p.put("text.today", "Hoje");
- p.put("text.month", "Mês");
- p.put("text.year", "Ano");
- JDatePanelImpl datePanel = new JDatePanelImpl(model, p);
- JDatePickerImpl datePicker = new JDatePickerImpl(datePanel, new DateLabelFormatter1());
- GridBagConstraints gbc_datePicker = new GridBagConstraints();
- gbc_datePicker.insets = new Insets(0, 0, 5, 5);
- gbc_datePicker.gridx = 1;
- gbc_datePicker.gridy = 0;
- panelConsultarDia.add(datePicker, gbc_datePicker);
- JButton btnSelecionar = new JButton("Selecionar");
- btnSelecionar.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- Date selectedDate = (Date) datePicker.getModel().getValue();
- DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
- String reportDate = df.format(selectedDate);
- }
- });
- GridBagConstraints gbc_btnSelecionar = new GridBagConstraints();
- gbc_btnSelecionar.insets = new Insets(0, 0, 5, 5);
- gbc_btnSelecionar.gridx = 2;
- gbc_btnSelecionar.gridy = 0;
- panelConsultarDia.add(btnSelecionar, gbc_btnSelecionar);
- /* no actionPerformed
- * Date selectedDate = (Date) datePicker.getModel().getValue();
- DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
- String reportDate = df.format(selectedDate);
- */
- JPanel panelEvento = new JPanel();
- panelEvento.setBackground(Color.WHITE);
- frame.getContentPane().add(panelEvento, "panelEvento");
- GridBagLayout gbl_panelEvento = new GridBagLayout();
- gbl_panelEvento.columnWidths = new int[]{0, 92, 0, 0};
- gbl_panelEvento.rowHeights = new int[]{0, 0, 27, 27, 32, 28, 0};
- gbl_panelEvento.columnWeights = new double[]{0.0, 0.0, 1.0, Double.MIN_VALUE};
- gbl_panelEvento.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- panelEvento.setLayout(gbl_panelEvento);
- JLabel lblEvento = new JLabel("Evento");
- GridBagConstraints gbc_lblEvento = new GridBagConstraints();
- gbc_lblEvento.insets = new Insets(0, 0, 5, 5);
- gbc_lblEvento.gridx = 1;
- gbc_lblEvento.gridy = 1;
- panelEvento.add(lblEvento, gbc_lblEvento);
- textEvento = new JTextField();
- GridBagConstraints gbc_textEvento = new GridBagConstraints();
- gbc_textEvento.insets = new Insets(0, 0, 5, 0);
- gbc_textEvento.fill = GridBagConstraints.HORIZONTAL;
- gbc_textEvento.gridx = 2;
- gbc_textEvento.gridy = 1;
- panelEvento.add(textEvento, gbc_textEvento);
- textEvento.setColumns(10);
- JLabel lblTipo = new JLabel("Tipo");
- GridBagConstraints gbc_lblTipo = new GridBagConstraints();
- gbc_lblTipo.insets = new Insets(0, 0, 5, 5);
- gbc_lblTipo.gridx = 1;
- gbc_lblTipo.gridy = 2;
- panelEvento.add(lblTipo, gbc_lblTipo);
- textTipo = new JTextField();
- GridBagConstraints gbc_textTipo = new GridBagConstraints();
- gbc_textTipo.insets = new Insets(0, 0, 5, 0);
- gbc_textTipo.fill = GridBagConstraints.HORIZONTAL;
- gbc_textTipo.gridx = 2;
- gbc_textTipo.gridy = 2;
- panelEvento.add(textTipo, gbc_textTipo);
- textTipo.setColumns(10);
- JLabel lblHoraDeInicio = new JLabel("Hora de Inicio");
- GridBagConstraints gbc_lblHoraDeInicio = new GridBagConstraints();
- gbc_lblHoraDeInicio.insets = new Insets(0, 0, 5, 5);
- gbc_lblHoraDeInicio.gridx = 1;
- gbc_lblHoraDeInicio.gridy = 3;
- panelEvento.add(lblHoraDeInicio, gbc_lblHoraDeInicio);
- textHoraInicio = new JTextField();
- GridBagConstraints gbc_textHoraInicio = new GridBagConstraints();
- gbc_textHoraInicio.insets = new Insets(0, 0, 5, 0);
- gbc_textHoraInicio.fill = GridBagConstraints.HORIZONTAL;
- gbc_textHoraInicio.gridx = 2;
- gbc_textHoraInicio.gridy = 3;
- panelEvento.add(textHoraInicio, gbc_textHoraInicio);
- textHoraInicio.setColumns(10);
- JLabel lblDurao = new JLabel("Dura\u00E7\u00E3o");
- GridBagConstraints gbc_lblDurao = new GridBagConstraints();
- gbc_lblDurao.insets = new Insets(0, 0, 5, 5);
- gbc_lblDurao.gridx = 1;
- gbc_lblDurao.gridy = 4;
- panelEvento.add(lblDurao, gbc_lblDurao);
- textDuracao = new JTextField();
- GridBagConstraints gbc_textDuracao = new GridBagConstraints();
- gbc_textDuracao.insets = new Insets(0, 0, 5, 0);
- gbc_textDuracao.fill = GridBagConstraints.HORIZONTAL;
- gbc_textDuracao.gridx = 2;
- gbc_textDuracao.gridy = 4;
- panelEvento.add(textDuracao, gbc_textDuracao);
- textDuracao.setColumns(10);
- JLabel lblLocal = new JLabel("Local");
- GridBagConstraints gbc_lblLocal = new GridBagConstraints();
- gbc_lblLocal.insets = new Insets(0, 0, 0, 5);
- gbc_lblLocal.gridx = 1;
- gbc_lblLocal.gridy = 5;
- panelEvento.add(lblLocal, gbc_lblLocal);
- textLocal = new JTextField();
- GridBagConstraints gbc_textLocal = new GridBagConstraints();
- gbc_textLocal.fill = GridBagConstraints.HORIZONTAL;
- gbc_textLocal.gridx = 2;
- gbc_textLocal.gridy = 5;
- panelEvento.add(textLocal, gbc_textLocal);
- textLocal.setColumns(10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement