Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Gui; /** * * @author user */ import History.History; import ConnectDB.ConnectDatabase; import javax.swing.JOptionPane; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import java.awt.*; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.Connection; import java.sql.Statement; import javafx.scene.chart.NumberAxis; import org.jfree.chart.ChartFrame; import org.jfree.chart.ChartPanel; import org.jfree.chart.plot.Plot; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.ui.ApplicationFrame; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.data.jdbc.JDBCCategoryDataset; public class HistoryAdminGUINew extends javax.swing.JFrame { History history = new History(); /** * Creates new form HistoryAdminGUINew */ public HistoryAdminGUINew() { initComponents(); showStatHistory(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanelHistoryGuiUser = new javax.swing.JPanel(); jPanelNotic = new javax.swing.JPanel(); jSeparatorHistoryUser = new javax.swing.JSeparator(); jLabelNoticNumber = new javax.swing.JLabel(); jLabelNoticIcon = new javax.swing.JLabel(); jLabelNoticNumber1 = new javax.swing.JLabel(); jPanelHeaderHistory = new javax.swing.JPanel(); jLabelSociety = new javax.swing.JLabel(); jTFSearch = new javax.swing.JTextField(); jSeparatorUnderSearch = new javax.swing.JSeparator(); jLabelGreen = new javax.swing.JLabel(); jBTSearch = new javax.swing.JButton(); jPanelUserProFile = new javax.swing.JPanel(); jLabelNameSurnameUser = new javax.swing.JLabel(); jLabelPositionuser = new javax.swing.JLabel(); jLabelIconUser = new javax.swing.JLabel(); jPanelSideBarUserIconMenu = new javax.swing.JPanel(); jLabelIconProfile = new javax.swing.JLabel(); jLabelIconBike = new javax.swing.JLabel(); jLabelIconMenu = new javax.swing.JLabel(); jPanelUserProbileLightBule = new javax.swing.JPanel(); jPanelSideBarLightBule = new javax.swing.JPanel(); jPanelSideBarBule = new javax.swing.JPanel(); jPanelSideBarMenu = new javax.swing.JPanel(); jLabelNewMenuHistory = new javax.swing.JLabel(); jLabelRepairingMenuHistory = new javax.swing.JLabel(); jLabelCanCounterMenuHistory = new javax.swing.JLabel(); jLabelBikeSharingMenuHistory = new javax.swing.JLabel(); jLabelHistoryMenuHistory = new javax.swing.JLabel(); jLabelProfileMenuHistory = new javax.swing.JLabel(); jLabelTimerMenuHistory = new javax.swing.JLabel(); jLabelSupportMenuHistory = new javax.swing.JLabel(); jLabelMenuHistory = new javax.swing.JLabel(); jLabelIconDownHistory = new javax.swing.JLabel(); jLabelDotBuleHistory = new javax.swing.JLabel(); jPanelHeadHistory = new javax.swing.JPanel(); jLabelHistoryText = new javax.swing.JLabel(); jPanelHistory = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jPanelShowGraph = new javax.swing.JPanel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanelHistoryGuiUser.setBackground(new java.awt.Color(25, 41, 65)); jPanelHistoryGuiUser.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanelNotic.setBackground(new java.awt.Color(13, 24, 35)); jPanelNotic.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jSeparatorHistoryUser.setBackground(new java.awt.Color(55, 200, 255)); jSeparatorHistoryUser.setOrientation(javax.swing.SwingConstants.VERTICAL); jPanelNotic.add(jSeparatorHistoryUser, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 0, 10, 60)); jLabelNoticNumber.setFont(new java.awt.Font("Leelawadee", 0, 11)); // NOI18N jLabelNoticNumber.setForeground(new java.awt.Color(255, 255, 255)); jLabelNoticNumber.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelNoticNumber.setText("1"); jPanelNotic.add(jLabelNoticNumber, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 0, 20, 30)); jLabelNoticIcon.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelNoticIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gui/notifications-button.png"))); // NOI18N jPanelNotic.add(jLabelNoticIcon, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 70, 60)); jLabelNoticNumber1.setFont(new java.awt.Font("Leelawadee", 0, 11)); // NOI18N jLabelNoticNumber1.setForeground(new java.awt.Color(255, 255, 255)); jLabelNoticNumber1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelNoticNumber1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gui/circle.png"))); // NOI18N jPanelNotic.add(jLabelNoticNumber1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 0, 20, 30)); jPanelHistoryGuiUser.add(jPanelNotic, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 480, 730, 60)); jPanelHeaderHistory.setBackground(new java.awt.Color(13, 24, 35)); jPanelHeaderHistory.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabelSociety.setBackground(new java.awt.Color(0, 0, 0)); jLabelSociety.setFont(new java.awt.Font("Leelawadee", 0, 28)); // NOI18N jLabelSociety.setForeground(new java.awt.Color(255, 255, 255)); jLabelSociety.setText("SOCIETY"); jLabelSociety.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelHeaderHistory.add(jLabelSociety, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 10, 140, 50)); jTFSearch.setBackground(new java.awt.Color(13, 24, 35)); jTFSearch.setFont(new java.awt.Font("Leelawadee UI", 0, 20)); // NOI18N jTFSearch.setForeground(new java.awt.Color(255, 255, 255)); jTFSearch.setHorizontalAlignment(javax.swing.JTextField.CENTER); jTFSearch.setText("Search"); jTFSearch.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { jTFSearchFocusGained(evt); } }); jTFSearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTFSearchActionPerformed(evt); } }); jPanelHeaderHistory.add(jTFSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(720, 10, 120, 30)); jPanelHeaderHistory.add(jSeparatorUnderSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(720, 40, 120, 40)); jLabelGreen.setBackground(new java.awt.Color(0, 0, 0)); jLabelGreen.setFont(new java.awt.Font("Leelawadee", 0, 28)); // NOI18N jLabelGreen.setForeground(new java.awt.Color(255, 255, 255)); jLabelGreen.setText("GREEN"); jLabelGreen.setToolTipText(""); jLabelGreen.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelHeaderHistory.add(jLabelGreen, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 10, 130, 50)); jBTSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gui/magnifying-glass.png"))); // NOI18N jBTSearch.setContentAreaFilled(false); jBTSearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBTSearchActionPerformed(evt); } }); jPanelHeaderHistory.add(jBTSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(650, 10, -1, -1)); jPanelHistoryGuiUser.add(jPanelHeaderHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 0, 860, 60)); jPanelUserProFile.setBackground(new java.awt.Color(19, 175, 248)); jPanelUserProFile.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabelNameSurnameUser.setBackground(new java.awt.Color(0, 0, 0)); jLabelNameSurnameUser.setFont(new java.awt.Font("Leelawadee", 0, 16)); // NOI18N jLabelNameSurnameUser.setForeground(new java.awt.Color(13, 24, 35)); jLabelNameSurnameUser.setText("NAME SURNAME"); jLabelNameSurnameUser.setToolTipText(""); jLabelNameSurnameUser.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelUserProFile.add(jLabelNameSurnameUser, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 10, 130, 50)); jLabelPositionuser.setBackground(new java.awt.Color(0, 0, 0)); jLabelPositionuser.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelPositionuser.setForeground(new java.awt.Color(255, 255, 255)); jLabelPositionuser.setText("Student"); jLabelPositionuser.setToolTipText(""); jLabelPositionuser.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelUserProFile.add(jLabelPositionuser, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 30, 130, 50)); jLabelIconUser.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelIconUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gui/man.png"))); // NOI18N jPanelUserProFile.add(jLabelIconUser, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 60, 60)); jPanelHistoryGuiUser.add(jPanelUserProFile, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 480, 200, 60)); jPanelSideBarUserIconMenu.setBackground(new java.awt.Color(19, 175, 248)); jPanelSideBarUserIconMenu.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabelIconProfile.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelIconProfile.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gui/profile-user.png"))); // NOI18N jPanelSideBarUserIconMenu.add(jLabelIconProfile, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 330, 50, 40)); jLabelIconBike.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelIconBike.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gui/bike.png"))); // NOI18N jPanelSideBarUserIconMenu.add(jLabelIconBike, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 10, 50, 40)); jLabelIconMenu.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelIconMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gui/menu.png"))); // NOI18N jPanelSideBarUserIconMenu.add(jLabelIconMenu, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 70, 50, 30)); jPanelHistoryGuiUser.add(jPanelSideBarUserIconMenu, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 50, 540)); jPanelUserProbileLightBule.setBackground(new java.awt.Color(55, 200, 255)); jPanelUserProbileLightBule.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanelHistoryGuiUser.add(jPanelUserProbileLightBule, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 480, 210, 60)); jPanelSideBarLightBule.setBackground(new java.awt.Color(55, 200, 255)); jPanelSideBarLightBule.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanelHistoryGuiUser.add(jPanelSideBarLightBule, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 60, 540)); jPanelSideBarBule.setBackground(new java.awt.Color(22, 31, 39)); jPanelSideBarMenu.setBackground(new java.awt.Color(13, 24, 35)); jPanelSideBarMenu.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabelNewMenuHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelNewMenuHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelNewMenuHistory.setForeground(new java.awt.Color(19, 175, 248)); jLabelNewMenuHistory.setText(" News"); jLabelNewMenuHistory.setToolTipText(""); jLabelNewMenuHistory.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelSideBarMenu.add(jLabelNewMenuHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 110, 140, 20)); jLabelRepairingMenuHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelRepairingMenuHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelRepairingMenuHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelRepairingMenuHistory.setText(" Bike Repairing"); jLabelRepairingMenuHistory.setToolTipText(""); jLabelRepairingMenuHistory.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelSideBarMenu.add(jLabelRepairingMenuHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 140, 140, 20)); jLabelCanCounterMenuHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelCanCounterMenuHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelCanCounterMenuHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelCanCounterMenuHistory.setText(" Can Counter"); jLabelCanCounterMenuHistory.setToolTipText(""); jLabelCanCounterMenuHistory.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelSideBarMenu.add(jLabelCanCounterMenuHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 170, 140, 20)); jLabelBikeSharingMenuHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelBikeSharingMenuHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelBikeSharingMenuHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelBikeSharingMenuHistory.setText(" Bike Sharing"); jLabelBikeSharingMenuHistory.setToolTipText(""); jLabelBikeSharingMenuHistory.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelSideBarMenu.add(jLabelBikeSharingMenuHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 200, 140, 20)); jLabelHistoryMenuHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelHistoryMenuHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelHistoryMenuHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelHistoryMenuHistory.setText(" History"); jLabelHistoryMenuHistory.setToolTipText(""); jLabelHistoryMenuHistory.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelSideBarMenu.add(jLabelHistoryMenuHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 230, 140, 20)); jLabelProfileMenuHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelProfileMenuHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelProfileMenuHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelProfileMenuHistory.setText(" PROFILE"); jLabelProfileMenuHistory.setToolTipText(""); jPanelSideBarMenu.add(jLabelProfileMenuHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 330, 140, 30)); jLabelTimerMenuHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelTimerMenuHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelTimerMenuHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelTimerMenuHistory.setText(" Timer"); jLabelTimerMenuHistory.setToolTipText(""); jLabelTimerMenuHistory.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelSideBarMenu.add(jLabelTimerMenuHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 260, 140, 20)); jLabelSupportMenuHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelSupportMenuHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelSupportMenuHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelSupportMenuHistory.setText(" Support"); jLabelSupportMenuHistory.setToolTipText(""); jLabelSupportMenuHistory.setVerticalAlignment(javax.swing.SwingConstants.TOP); jPanelSideBarMenu.add(jLabelSupportMenuHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 290, 140, 20)); jLabelMenuHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelMenuHistory.setFont(new java.awt.Font("Leelawadee", 0, 18)); // NOI18N jLabelMenuHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelMenuHistory.setText("MENU"); jLabelMenuHistory.setToolTipText(""); jPanelSideBarMenu.add(jLabelMenuHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 50, 30)); jLabelIconDownHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelIconDownHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelIconDownHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelIconDownHistory.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelIconDownHistory .setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gui/chevron-arrow-down.png"))); // NOI18N jLabelIconDownHistory.setToolTipText(""); jPanelSideBarMenu.add(jLabelIconDownHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 70, 40, 30)); jLabelDotBuleHistory.setBackground(new java.awt.Color(0, 0, 0)); jLabelDotBuleHistory.setFont(new java.awt.Font("Leelawadee", 0, 14)); // NOI18N jLabelDotBuleHistory.setForeground(new java.awt.Color(255, 255, 255)); jLabelDotBuleHistory.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Gui/circle_mini.png"))); // NOI18N jLabelDotBuleHistory.setToolTipText(""); jPanelSideBarMenu.add(jLabelDotBuleHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 100, 40, 40)); javax.swing.GroupLayout jPanelSideBarBuleLayout = new javax.swing.GroupLayout(jPanelSideBarBule); jPanelSideBarBule.setLayout(jPanelSideBarBuleLayout); jPanelSideBarBuleLayout.setHorizontalGroup(jPanelSideBarBuleLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 150, Short.MAX_VALUE) .addGroup(jPanelSideBarBuleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelSideBarBuleLayout.createSequentialGroup() .addComponent(jPanelSideBarMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()))); jPanelSideBarBuleLayout.setVerticalGroup(jPanelSideBarBuleLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 480, Short.MAX_VALUE) .addGroup(jPanelSideBarBuleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanelSideBarMenu, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE))); jPanelHistoryGuiUser.add(jPanelSideBarBule, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 0, 150, 480)); jPanelHeadHistory.setBackground(new java.awt.Color(76, 81, 86)); jPanelHeadHistory.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabelHistoryText.setFont(new java.awt.Font("Leelawadee", 0, 22)); // NOI18N jLabelHistoryText.setForeground(new java.awt.Color(255, 255, 255)); jLabelHistoryText.setText("History"); jPanelHeadHistory.add(jLabelHistoryText, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 0, 180, 50)); jPanelHistoryGuiUser.add(jPanelHeadHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 60, 740, 50)); jPanelHistory.setBackground(new java.awt.Color(25, 41, 65)); jPanelHistory.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanelHistory.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 20, -1, -1)); jPanelHistory.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(570, 20, -1, -1)); jPanelHistory.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 20, -1, -1)); jPanelHistory.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 80, -1, 40)); jPanelHistory.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 20, -1, -1)); jPanelHistory.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 80, -1, 40)); jPanelHistory.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 80, -1, 40)); jPanelHistory.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 80, -1, 40)); jPanelShowGraph.setBackground(new java.awt.Color(25, 41, 65)); jPanelShowGraph.setLayout(new java.awt.BorderLayout()); jPanelHistory.add(jPanelShowGraph, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 60, 690, 260)); jPanelHistoryGuiUser.add(jPanelHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 110, 730, 370)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 940, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addComponent(jPanelHistoryGuiUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 540, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addComponent(jPanelHistoryGuiUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)))); pack(); }// </editor-fold>//GEN-END:initComponents private void jTFSearchFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTFSearchFocusGained // TODO add your handling code here: jTFSearch.setText(""); }//GEN-LAST:event_jTFSearchFocusGained private void jTFSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTFSearchActionPerformed }//GEN-LAST:event_jTFSearchActionPerformed private void jBTSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTSearchActionPerformed // TODO add your handling code here: // whatToSearch = jTFSearch.getText(); // SupportGUI spGUI = new SupportGUI(whatToSearch); // spGUI.setVisible(true); }//GEN-LAST:event_jBTSearchActionPerformed public void showStatHistory() { // method statGreensociety...... History int tempRepair = history.statGreensocietyRepair(); int tempBorrow = history.statGreensocietyBorrow(); int tempReturn = history.statGreensocietyReturn(); DefaultCategoryDataset barchartData = new DefaultCategoryDataset(); barchartData.setValue(tempRepair, "0", "RepairHistory"); barchartData.setValue(tempBorrow, "1", "BorrowHistory"); barchartData.setValue(tempReturn, "2", "ReturnHistory"); JFreeChart chart = ChartFactory.createBarChart("History Statictics", "History", "Times", barchartData, PlotOrientation.HORIZONTAL, false, true, false); // chart.getTitle().setPaint(Color.WHITE); //?? //--------SET FONT-------------- try { File f = new File("leelawad.ttf"); Font customFont = Font.createFont(Font.TRUETYPE_FONT, f); customFont = customFont.deriveFont(16f); chart.getTitle().setFont(customFont); System.out.println(customFont.getFontName()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (FontFormatException | IOException e) { e.printStackTrace(); } //------------------------------ chart.setBackgroundPaint(new Color(19, 175, 248)); //setBackground ? CategoryPlot barchartPlot = chart.getCategoryPlot(); barchartPlot.setRangeGridlinePaint(Color.BLACK); //set ?? //Customize renderer BarRenderer renderer = (BarRenderer) barchartPlot.getRenderer(); java.awt.Paint paint1 = new Color(255, 0, 0); java.awt.Paint paint2 = new Color(0, 0, 255); java.awt.Paint paint3 = new Color(255, 255, 0); renderer.setSeriesPaint(0, paint1); //Color for RepairGraph renderer.setSeriesPaint(1, paint2); //Color for BorrowGraph renderer.setSeriesPaint(2, paint3); //Color for ReturnGraph ChartPanel barPanel = new ChartPanel(chart); jPanelShowGraph.removeAll(); jPanelShowGraph.add(barPanel, BorderLayout.CENTER); jPanelShowGraph.validate(); } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(HistoryAdminGUINew.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(HistoryAdminGUINew.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(HistoryAdminGUINew.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(HistoryAdminGUINew.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new HistoryAdminGUINew().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jBTSearch; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JLabel jLabelBikeSharingMenuHistory; private javax.swing.JLabel jLabelCanCounterMenuHistory; private javax.swing.JLabel jLabelDotBuleHistory; private javax.swing.JLabel jLabelGreen; private javax.swing.JLabel jLabelHistoryMenuHistory; private javax.swing.JLabel jLabelHistoryText; private javax.swing.JLabel jLabelIconBike; private javax.swing.JLabel jLabelIconDownHistory; private javax.swing.JLabel jLabelIconMenu; private javax.swing.JLabel jLabelIconProfile; private javax.swing.JLabel jLabelIconUser; private javax.swing.JLabel jLabelMenuHistory; private javax.swing.JLabel jLabelNameSurnameUser; private javax.swing.JLabel jLabelNewMenuHistory; private javax.swing.JLabel jLabelNoticIcon; private javax.swing.JLabel jLabelNoticNumber; private javax.swing.JLabel jLabelNoticNumber1; private javax.swing.JLabel jLabelPositionuser; private javax.swing.JLabel jLabelProfileMenuHistory; private javax.swing.JLabel jLabelRepairingMenuHistory; private javax.swing.JLabel jLabelSociety; private javax.swing.JLabel jLabelSupportMenuHistory; private javax.swing.JLabel jLabelTimerMenuHistory; private javax.swing.JPanel jPanelHeadHistory; private javax.swing.JPanel jPanelHeaderHistory; private javax.swing.JPanel jPanelHistory; private javax.swing.JPanel jPanelHistoryGuiUser; private javax.swing.JPanel jPanelNotic; private javax.swing.JPanel jPanelShowGraph; private javax.swing.JPanel jPanelSideBarBule; private javax.swing.JPanel jPanelSideBarLightBule; private javax.swing.JPanel jPanelSideBarMenu; private javax.swing.JPanel jPanelSideBarUserIconMenu; private javax.swing.JPanel jPanelUserProFile; private javax.swing.JPanel jPanelUserProbileLightBule; private javax.swing.JSeparator jSeparatorHistoryUser; private javax.swing.JSeparator jSeparatorUnderSearch; private javax.swing.JTextField jTFSearch; // End of variables declaration//GEN-END:variables }