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 com.josescalia.tumblr.form; import com.josescalia.tumblr.app.BaseForm; import com.josescalia.tumblr.app.Bootstrap; import com.josescalia.tumblr.app.MainFrame; import com.josescalia.tumblr.form.dialog.LookAndFeelDialog; import com.josescalia.tumblr.util.ApplicationConstants; import com.josescalia.tumblr.util.FileUtility; import com.josescalia.tumblr.util.model.CacheFile; import com.josescalia.tumblr.util.net.ProxyConnection; import com.josescalia.tumblr.util.net.ReadWritePropertyFile; import com.josescalia.tumblr.util.swing.LabelValue; import com.josescalia.tumblr.util.swing.UIAlert; import org.apache.log4j.Logger; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import javax.swing.*; import java.awt.*; import java.io.File; import java.util.concurrent.ExecutionException; /** * * @author josescalia */ @Component @Scope("prototype") public class PreferenceForm extends BaseForm { static Logger logger = Logger.getLogger(PreferenceForm.class.getName()); private ProxyConnection proxyConnection; private boolean bUseProxyAuth; private String defaultDownloadPath; private String defaultFolderViewer; private String defaultLookAndFeel; private CacheFile logFile; private CacheFile cacheFile; private String logFileData; private MainFrame frame; public void showForm() { initComponents(); getProxyConfig(); getAllConfig(); getCacheFileInfo(); setupLogFileInfo(); } private void getCacheFileInfo() { setCacheFile(FileUtility.getCacheFile(new File(".cache"))); } private void getAllConfig() { setDefaultDownloadPath(ReadWritePropertyFile.readAppProperty(ApplicationConstants.APP_PROPERTY_FILE, "default.download.dir")); setDefaultFolderViewer(ReadWritePropertyFile.readAppProperty(ApplicationConstants.APP_PROPERTY_FILE, "default.folder.viewer")); //look and feel setDefaultLookAndFeel(ReadWritePropertyFile.readAppProperty(ApplicationConstants.APP_PROPERTY_FILE, "application.look-and-feel")); } private void getProxyConfig() { setProxyConnection(ReadWritePropertyFile.readProxyConnectionConfig(ApplicationConstants.APP_PROPERTY_FILE)); if (proxyConnection.getUseProxy()) { connUseProxy(true); rbUseProxy.setSelected(true); rbNoProxy.setSelected(false); } else { connUseProxy(false); rbUseProxy.setSelected(false); rbNoProxy.setSelected(true); } } private void setupLogFileInfo() { String logFileToRead = ""; setLogFile(FileUtility.getCacheFile(new File("log"))); if (System.getProperty("os.name").startsWith("Windows")) logFileToRead = "log" + "\\" + Bootstrap.applicationLog; else logFileToRead = "log" + "/" + Bootstrap.applicationLog; setLogFileData(FileUtility.readFile(logFileToRead)); if (logFileData.length() > 0) { txtLogContent.setCaretPosition(txtLogContent.getDocument().getLength()); } } /** * Creates new form PreferenceForm */ public PreferenceForm() { proxyConnection = null; //initComponents(); } /** * 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() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); rbGroupUseProxy = new ButtonGroup(); folderChooser = new JFileChooser(); jTabbedPane1 = new JTabbedPane(); jPanel1 = new JPanel(); jPanel10 = new JPanel(); jLabel29 = new JLabel(); jLabel26 = new JLabel(); jLabel25 = new JLabel(); jLabel24 = new JLabel(); jLabel28 = new JLabel(); jLabel27 = new JLabel(); jPanel12 = new JPanel(); txtProxyPort = new JTextField(); rbUseProxy = new JRadioButton(); jLabel2 = new JLabel(); rbNoProxy = new JRadioButton(); txtProxyPassword = new JPasswordField(); jLabel3 = new JLabel(); txtProxyUsername = new JTextField(); btnSaveProxyConfig = new JButton(); jLabel1 = new JLabel(); jLabel4 = new JLabel(); txtProxyHost = new JTextField(); checkProxyNeedAuth = new JCheckBox(); jPanel2 = new JPanel(); jPanel11 = new JPanel(); jLabel35 = new JLabel(); jLabel30 = new JLabel(); jLabel33 = new JLabel(); jLabel32 = new JLabel(); jLabel31 = new JLabel(); jLabel34 = new JLabel(); jPanel14 = new JPanel(); txtDefaultFolderPath1 = new JTextField(); jLabel6 = new JLabel(); txtDefaultFolderPath = new JTextField(); jLabel7 = new JLabel(); btnChooseFolder = new JButton(); btnSaveAppConfig = new JButton(); jPanel7 = new JPanel(); jPanel9 = new JPanel(); jLabel18 = new JLabel(); jLabel23 = new JLabel(); jLabel19 = new JLabel(); jLabel21 = new JLabel(); jLabel20 = new JLabel(); jLabel22 = new JLabel(); jPanel13 = new JPanel(); jLabel8 = new JLabel(); btnOpenOtherCacheFolder = new JButton(); btnDeleteCache = new JButton(); jLabel9 = new JLabel(); txtTotalFileSize1 = new JTextField(); txtTotalFileSize = new JTextField(); jPanel3 = new JPanel(); jPanel5 = new JPanel(); txtTotalLogSize = new JTextField(); jLabel11 = new JLabel(); txtTotalLog = new JTextField(); btnCleanLog = new JButton(); jLabel13 = new JLabel(); jPanel6 = new JPanel(); jLabel12 = new JLabel(); jScrollPane1 = new JScrollPane(); txtLogContent = new JTextArea(); jPanel8 = new JPanel(); jLabel17 = new JLabel(); jLabel16 = new JLabel(); jLabel15 = new JLabel(); jLabel14 = new JLabel(); jPanel4 = new JPanel(); jPanel15 = new JPanel(); txtAppLookAndFeel = new JTextField(); jLabel10 = new JLabel(); btnSaveLF = new JButton(); btnSelectLF = new JButton(); jPanel16 = new JPanel(); jLabel41 = new JLabel(); jLabel36 = new JLabel(); jLabel40 = new JLabel(); jLabel37 = new JLabel(); jLabel38 = new JLabel(); jLabel39 = new JLabel(); jLabel5 = new JLabel(); jPanel1.setBorder(BorderFactory.createEtchedBorder()); jPanel10.setBackground(Color.white); jPanel10.setBorder(BorderFactory.createEtchedBorder()); jLabel29.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel29.setText("set up this Proxy Connection."); jLabel26.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel26.setText("if this application need to connect to the internet. The setting of this "); jLabel25.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel25.setText("The Proxy Connection is a set of configuration which will be applied"); jLabel24.setFont(new Font("Liberation Sans", 1, 12)); // NOI18N jLabel24.setText("Info :"); jLabel28.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel28.setText("configuration. Contact Computer Network Administrator to correctly"); jLabel27.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel27.setText("Proxy Connection should be match with the computer network"); GroupLayout jPanel10Layout = new GroupLayout(jPanel10); jPanel10.setLayout(jPanel10Layout); jPanel10Layout.setHorizontalGroup(jPanel10Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel10Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel28).addComponent(jLabel25).addComponent(jLabel24) .addComponent(jLabel26).addComponent(jLabel27).addComponent(jLabel29)) .addContainerGap())); jPanel10Layout.setVerticalGroup(jPanel10Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup().addContainerGap().addComponent(jLabel24) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel25) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel26) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel27) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel28) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel29) .addContainerGap())); jPanel12.setBorder(BorderFactory.createEtchedBorder()); txtProxyPort.setEnabled(false); org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${proxyConnection.proxyPort}"), txtProxyPort, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); rbGroupUseProxy.add(rbUseProxy); rbUseProxy.setText("Use Proxy"); rbUseProxy.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rbUseProxyActionPerformed(evt); } }); jLabel2.setText("Proxy Port"); rbGroupUseProxy.add(rbNoProxy); rbNoProxy.setText("No Proxy"); rbNoProxy.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rbNoProxyActionPerformed(evt); } }); txtProxyPassword.setEnabled(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${proxyConnection.proxyPassword}"), txtProxyPassword, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); jLabel3.setText("Username "); txtProxyUsername.setEnabled(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${proxyConnection.proxyUsername}"), txtProxyUsername, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); btnSaveProxyConfig.setIcon(new ImageIcon(getClass().getResource("/icons/edit.png"))); // NOI18N btnSaveProxyConfig.setText("Save"); btnSaveProxyConfig.setHorizontalTextPosition(SwingConstants.CENTER); btnSaveProxyConfig.setVerticalTextPosition(SwingConstants.BOTTOM); btnSaveProxyConfig.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveProxyConfigActionPerformed(evt); } }); jLabel1.setText("Proxy Host"); jLabel4.setText("Password"); txtProxyHost.setEnabled(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${proxyConnection.proxyHost}"), txtProxyHost, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); checkProxyNeedAuth.setText("Proxy Need Authentication"); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${bUseProxyAuth}"), checkProxyNeedAuth, org.jdesktop.beansbinding.BeanProperty.create("selected")); bindingGroup.addBinding(binding); checkProxyNeedAuth.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { checkProxyNeedAuthActionPerformed(evt); } }); GroupLayout jPanel12Layout = new GroupLayout(jPanel12); jPanel12.setLayout(jPanel12Layout); jPanel12Layout.setHorizontalGroup(jPanel12Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap().addGroup(jPanel12Layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addComponent(rbNoProxy) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(rbUseProxy)) .addGroup(jPanel12Layout.createSequentialGroup().addGroup(jPanel12Layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3).addComponent(jLabel4)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel12Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(txtProxyPort, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE) .addComponent(txtProxyHost, GroupLayout.PREFERRED_SIZE, 297, GroupLayout.PREFERRED_SIZE) .addGroup(jPanel12Layout .createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent(txtProxyPassword, GroupLayout.Alignment.LEADING) .addComponent(txtProxyUsername, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 227, GroupLayout.PREFERRED_SIZE)))) .addComponent(checkProxyNeedAuth).addComponent(btnSaveProxyConfig, GroupLayout.PREFERRED_SIZE, 89, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jPanel12Layout.setVerticalGroup(jPanel12Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel12Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(rbNoProxy).addComponent(rbUseProxy)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel12Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel1).addComponent(txtProxyHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel12Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel2).addComponent(txtProxyPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(4, 4, 4).addComponent(checkProxyNeedAuth) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel12Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(txtProxyUsername, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel12Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(txtProxyPassword, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnSaveProxyConfig) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); GroupLayout jPanel1Layout = new GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(jPanel12, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(286, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(11, 11, 11) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jPanel12, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jPanel10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(165, Short.MAX_VALUE))); jTabbedPane1.addTab("Proxy Connection", jPanel1); jPanel2.setBorder(BorderFactory.createEtchedBorder()); jPanel11.setBackground(Color.white); jPanel11.setBorder(BorderFactory.createEtchedBorder()); jLabel35.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel35.setText("the application is trigger to open a folder."); jLabel30.setFont(new Font("Liberation Sans", 1, 12)); // NOI18N jLabel30.setText("Info :"); jLabel33.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel33.setText("application downloading stuff from the internet."); jLabel32.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel32.setText("Default Download Path is the default folder location when the "); jLabel31.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel31.setText("This is the set of configuration will be used by this application."); jLabel34.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel34.setText("Default Folder Viewer is the default of computer programs when "); GroupLayout jPanel11Layout = new GroupLayout(jPanel11); jPanel11.setLayout(jPanel11Layout); jPanel11Layout.setHorizontalGroup(jPanel11Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel11Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel11Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel30).addComponent(jLabel31).addComponent(jLabel32) .addComponent(jLabel33).addComponent(jLabel34).addComponent(jLabel35)) .addContainerGap())); jPanel11Layout.setVerticalGroup(jPanel11Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel11Layout.createSequentialGroup().addContainerGap().addComponent(jLabel30) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel31) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel32) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel33) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel34) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel35) .addContainerGap())); jPanel14.setBorder(BorderFactory.createEtchedBorder()); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${defaultFolderViewer}"), txtDefaultFolderPath1, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); jLabel6.setText("Default Download Path"); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${defaultDownloadPath}"), txtDefaultFolderPath, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); jLabel7.setText("Default Folder Viewer"); btnChooseFolder.setText("Change"); btnChooseFolder.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnChooseFolderActionPerformed(evt); } }); btnSaveAppConfig.setIcon(new ImageIcon(getClass().getResource("/icons/edit.png"))); // NOI18N btnSaveAppConfig.setText("Save"); btnSaveAppConfig.setHorizontalTextPosition(SwingConstants.CENTER); btnSaveAppConfig.setVerticalTextPosition(SwingConstants.BOTTOM); btnSaveAppConfig.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveAppConfigActionPerformed(evt); } }); GroupLayout jPanel14Layout = new GroupLayout(jPanel14); jPanel14.setLayout(jPanel14Layout); jPanel14Layout.setHorizontalGroup(jPanel14Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap().addGroup(jPanel14Layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 161, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtDefaultFolderPath1, GroupLayout.PREFERRED_SIZE, 258, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel14Layout.createSequentialGroup() .addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 161, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtDefaultFolderPath, GroupLayout.PREFERRED_SIZE, 346, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnChooseFolder)) .addComponent(btnSaveAppConfig, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jPanel14Layout.setVerticalGroup(jPanel14Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel14Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(txtDefaultFolderPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnChooseFolder)) .addGap(4, 4, 4) .addGroup(jPanel14Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel7).addComponent(txtDefaultFolderPath1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnSaveAppConfig).addContainerGap())); GroupLayout jPanel2Layout = new GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout .setHorizontalGroup( jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addComponent(jPanel14, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel11, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(jPanel11, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel14, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(285, Short.MAX_VALUE))); jTabbedPane1.addTab("Application Config", jPanel2); jPanel9.setBackground(Color.white); jPanel9.setBorder(BorderFactory.createEtchedBorder()); jLabel18.setFont(new Font("Liberation Sans", 1, 12)); // NOI18N jLabel18.setText("Info :"); jLabel23.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel23.setText("make the application processing faster."); jLabel19.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel19.setText("Cache Info contains a summary of how much space in hard drive"); jLabel21.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel21.setText("hard drive space by this application, but if the application need to"); jLabel20.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel20.setText("used by this application. Deleting cache will reduce the usage of"); jLabel22.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel22.setText("fetch the data from internet, this cache will be used in order to"); GroupLayout jPanel9Layout = new GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout.setHorizontalGroup(jPanel9Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel9Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel18).addComponent(jLabel19).addComponent(jLabel20) .addComponent(jLabel21).addComponent(jLabel22).addComponent(jLabel23)) .addContainerGap())); jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup().addContainerGap().addComponent(jLabel18) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel19) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel20) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel21) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel22) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel23) .addContainerGap())); jPanel13.setBorder(BorderFactory.createEtchedBorder()); jLabel8.setText("Total Cache File Size"); btnOpenOtherCacheFolder.setIcon(new ImageIcon(getClass().getResource("/icons/folder_open.png"))); // NOI18N btnOpenOtherCacheFolder.setText("Open Dir"); btnOpenOtherCacheFolder.setHorizontalTextPosition(SwingConstants.CENTER); btnOpenOtherCacheFolder.setVerticalTextPosition(SwingConstants.BOTTOM); btnOpenOtherCacheFolder.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnOpenOtherCacheFolderActionPerformed(evt); } }); btnDeleteCache.setIcon(new ImageIcon(getClass().getResource("/icons/cross2.png"))); // NOI18N btnDeleteCache.setText("Delete Cache"); btnDeleteCache.setHorizontalTextPosition(SwingConstants.CENTER); btnDeleteCache.setVerticalTextPosition(SwingConstants.BOTTOM); btnDeleteCache.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnDeleteCacheActionPerformed(evt); } }); jLabel9.setText("Total Cache File"); txtTotalFileSize1.setEditable(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${cacheFile.fileListSize}"), txtTotalFileSize1, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); txtTotalFileSize.setEditable(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${cacheFile.totalFolderSize}"), txtTotalFileSize, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); GroupLayout jPanel13Layout = new GroupLayout(jPanel13); jPanel13.setLayout(jPanel13Layout); jPanel13Layout.setHorizontalGroup(jPanel13Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel13Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel8).addComponent(jLabel9).addComponent(btnDeleteCache)) .addGap(18, 18, 18) .addGroup(jPanel13Layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent(txtTotalFileSize1, GroupLayout.Alignment.LEADING) .addComponent(btnOpenOtherCacheFolder, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE) .addComponent(txtTotalFileSize)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel13Layout.setVerticalGroup(jPanel13Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel13Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel8).addComponent(txtTotalFileSize, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel13Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel9).addComponent(txtTotalFileSize1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel13Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(btnDeleteCache, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnOpenOtherCacheFolder)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); GroupLayout jPanel7Layout = new GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup(jPanel7Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap() .addComponent(jPanel13, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel9, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(443, Short.MAX_VALUE))); jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel7Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(jPanel9, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel13, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(289, Short.MAX_VALUE))); jTabbedPane1.addTab("Cache Info", jPanel7); jPanel5.setBorder(BorderFactory.createEtchedBorder()); txtTotalLogSize.setEditable(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${logFile.totalFolderSize}"), txtTotalLogSize, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); jLabel11.setText("Total File on Log Folder"); txtTotalLog.setEditable(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${logFile.fileListSize}"), txtTotalLog, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); btnCleanLog.setIcon(new ImageIcon(getClass().getResource("/icons/cross2.png"))); // NOI18N btnCleanLog.setText("Clean Log File"); btnCleanLog.setHorizontalTextPosition(SwingConstants.CENTER); btnCleanLog.setVerticalTextPosition(SwingConstants.BOTTOM); btnCleanLog.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCleanLogActionPerformed(evt); } }); jLabel13.setText("Total Size on Log Folder "); GroupLayout jPanel5Layout = new GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel5Layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent(btnCleanLog, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel5Layout.createSequentialGroup() .addGroup(jPanel5Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel13).addComponent(jLabel11)) .addGap(18, 18, 18) .addGroup(jPanel5Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(txtTotalLog, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE) .addComponent(txtTotalLogSize, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)))) .addContainerGap(22, Short.MAX_VALUE))); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel5Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(txtTotalLog, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel5Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel13).addComponent(txtTotalLogSize, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnCleanLog, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel6.setBorder(BorderFactory.createEtchedBorder()); jLabel12.setText("Log File Data :"); txtLogContent.setEditable(false); txtLogContent.setColumns(20); txtLogContent.setLineWrap(true); txtLogContent.setRows(5); txtLogContent.setWrapStyleWord(true); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${logFileData}"), txtLogContent, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); jScrollPane1.setViewportView(txtLogContent); GroupLayout jPanel6Layout = new GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup(jPanel6Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel6Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE) .addGroup(jPanel6Layout.createSequentialGroup().addComponent(jLabel12).addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); jPanel6Layout .setVerticalGroup(jPanel6Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap().addComponent(jLabel12) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 339, GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel8.setBackground(Color.white); jPanel8.setBorder(BorderFactory.createEtchedBorder()); jLabel17.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel17.setText("application use it as a log tracker."); jLabel16.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel16.setText("These 2 log files cannot be delete, because the"); jLabel15.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel15.setText("Minimal log files is 2 files."); jLabel14.setFont(new Font("Liberation Sans", 1, 12)); // NOI18N jLabel14.setText("Info :"); GroupLayout jPanel8Layout = new GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup(jPanel8Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel8Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel14).addComponent(jLabel15).addComponent(jLabel16) .addComponent(jLabel17)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap().addComponent(jLabel14) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel15) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel16) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel17) .addContainerGap())); GroupLayout jPanel3Layout = new GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(jPanel5, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel6, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addGap(20, 20, 20) .addGroup(jPanel3Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jPanel6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jPanel5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel8, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap(41, Short.MAX_VALUE))); jTabbedPane1.addTab("Log Monitor", jPanel3); jPanel15.setBorder(BorderFactory.createEtchedBorder()); txtAppLookAndFeel.setEditable(false); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${defaultLookAndFeel}"), txtAppLookAndFeel, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); jLabel10.setText("Look And Feel "); btnSaveLF.setIcon(new ImageIcon(getClass().getResource("/icons/edit.png"))); // NOI18N btnSaveLF.setText("Save"); btnSaveLF.setHorizontalTextPosition(SwingConstants.CENTER); btnSaveLF.setVerticalTextPosition(SwingConstants.BOTTOM); btnSaveLF.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveLFActionPerformed(evt); } }); btnSelectLF.setText("Change Look and Feel"); btnSelectLF.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSelectLFActionPerformed(evt); } }); GroupLayout jPanel15Layout = new GroupLayout(jPanel15); jPanel15.setLayout(jPanel15Layout); jPanel15Layout.setHorizontalGroup(jPanel15Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup().addContainerGap().addComponent(jLabel10) .addGap(4, 4, 4) .addGroup(jPanel15Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(btnSaveLF, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE) .addComponent(txtAppLookAndFeel, GroupLayout.PREFERRED_SIZE, 395, GroupLayout.PREFERRED_SIZE) .addComponent(btnSelectLF, GroupLayout.PREFERRED_SIZE, 176, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel15Layout.setVerticalGroup(jPanel15Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel15Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel10).addComponent(txtAppLookAndFeel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnSelectLF) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnSaveLF) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel16.setBackground(Color.white); jPanel16.setBorder(BorderFactory.createEtchedBorder()); jLabel41.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel41.setText("to be restarted."); jLabel36.setFont(new Font("Liberation Sans", 1, 12)); // NOI18N jLabel36.setText("Info :"); jLabel40.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel40.setText("System. Changing Look and Feel requires application"); jLabel37.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel37.setText("Changing the Look and Feel means changing this"); jLabel38.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel38.setText("application theme, the theme provided by it's installed"); jLabel39.setFont(new Font("Liberation Sans", 0, 12)); // NOI18N jLabel39.setText("Look and Feel class in the Java Runtime Environment"); GroupLayout jPanel16Layout = new GroupLayout(jPanel16); jPanel16.setLayout(jPanel16Layout); jPanel16Layout.setHorizontalGroup(jPanel16Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel16Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel36).addComponent(jLabel37).addComponent(jLabel38) .addComponent(jLabel39).addComponent(jLabel40).addComponent(jLabel41)) .addContainerGap())); jPanel16Layout.setVerticalGroup(jPanel16Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel16Layout.createSequentialGroup().addContainerGap().addComponent(jLabel36) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel37) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel38) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel39) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel40) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel41) .addContainerGap())); GroupLayout jPanel4Layout = new GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout .setHorizontalGroup( jPanel4Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap() .addComponent(jPanel15, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel16, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(261, Short.MAX_VALUE))); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(jPanel16, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel15, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(289, Short.MAX_VALUE))); jTabbedPane1.addTab("Look And Feel", jPanel4); jLabel5.setFont(new Font("DejaVu Sans", 1, 18)); // NOI18N jLabel5.setHorizontalAlignment(SwingConstants.CENTER); jLabel5.setText("System Configuration"); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane1).addComponent(jLabel5, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(jLabel5) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jTabbedPane1))); bindingGroup.bind(); }// </editor-fold>//GEN-END:initComponents private void rbUseProxyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbUseProxyActionPerformed connUseProxy(true); }//GEN-LAST:event_rbUseProxyActionPerformed private void rbNoProxyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbNoProxyActionPerformed connUseProxy(false); }//GEN-LAST:event_rbNoProxyActionPerformed private void checkProxyNeedAuthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkProxyNeedAuthActionPerformed if (checkProxyNeedAuth.isSelected()) { connUseProxyAuth(true); } else { connUseProxyAuth(false); } }//GEN-LAST:event_checkProxyNeedAuthActionPerformed private void btnSaveProxyConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveProxyConfigActionPerformed writeProxyConfiguration(); }//GEN-LAST:event_btnSaveProxyConfigActionPerformed private void btnSaveAppConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveAppConfigActionPerformed writeApplicationConfiguration(); }//GEN-LAST:event_btnSaveAppConfigActionPerformed private void btnChooseFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChooseFolderActionPerformed folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnValue = folderChooser.showOpenDialog(this); if (returnValue == JFileChooser.APPROVE_OPTION) { setDefaultDownloadPath(folderChooser.getSelectedFile().getPath()); } }//GEN-LAST:event_btnChooseFolderActionPerformed private void btnCleanLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanLogActionPerformed frame = (MainFrame) this.getTopLevelAncestor(); if (UIAlert.showConfirm(this, "Are you sure ?") == JOptionPane.OK_OPTION) { logger.info("deleting log file"); //busy cursor and progress bar frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); frame.startProgressBar("Deleting"); //background process new SwingWorker<String, String>() { @Override protected String doInBackground() throws Exception { int successDeleteCount = 0; int failedDeleteCount = 0; for (File file : logFile.getFileList()) { logger.info(file.getName()); if (!file.getName().equalsIgnoreCase(Bootstrap.applicationLog) && !file.getName().equalsIgnoreCase(Bootstrap.applicationErrorLog)) { if (file.delete()) { successDeleteCount++; } else { failedDeleteCount++; } } } return "Done\n " + successDeleteCount + " log file(s) deleted\n" + failedDeleteCount + " log file(s) not deleted"; } @Override protected void done() { try { UIAlert.showInformation(null, get()); } catch (InterruptedException e) { logger.error(e); } catch (ExecutionException e) { logger.error(e); } setupLogFileInfo(); frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); frame.stopProgressBar(""); } }.execute(); } }//GEN-LAST:event_btnCleanLogActionPerformed private void btnSelectLFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectLFActionPerformed this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); LookAndFeelDialog dlg = new LookAndFeelDialog(null, true); dlg.showDialog(); dlg.setVisible(true); this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); String lAndF = dlg.getLookAndFeel().getLookAndFeelValue(); if (lAndF != null) { txtAppLookAndFeel.setText(lAndF); } }//GEN-LAST:event_btnSelectLFActionPerformed private void btnSaveLFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveLFActionPerformed writeLookAndFeelConfiguration(); }//GEN-LAST:event_btnSaveLFActionPerformed private void btnDeleteCacheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteCacheActionPerformed frame = (MainFrame) this.getTopLevelAncestor(); if (UIAlert.showConfirm(this, "Are you sure ?") == JOptionPane.OK_OPTION) { logger.info("deleting cache"); //busy cursor and frame progress bar frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); frame.startProgressBar("Deleting"); new SwingWorker<String, String>() { @Override protected String doInBackground() throws Exception { int successDeleteCount = 0; int failedDeleteCount = 0; for (File file : cacheFile.getFileList()) { if (!file.getName().contains("ImageNotFound")) { logger.info("deleting file " + file.getName()); if (file.delete()) { successDeleteCount++; } else { failedDeleteCount++; } } } return "Done\n " + successDeleteCount + " cache file(s) deleted\n" + failedDeleteCount + " cache file(s) not deleted"; } @Override protected void done() { try { UIAlert.showInformation(null, get()); getCacheFileInfo(); } catch (InterruptedException e) { logger.error(e); } catch (ExecutionException e) { logger.error(e); } frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); frame.stopProgressBar(""); } }.execute(); } }//GEN-LAST:event_btnDeleteCacheActionPerformed private void btnOpenOtherCacheFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenOtherCacheFolderActionPerformed FileUtility.openFolder(new File(cacheFile.getFolderName())); }//GEN-LAST:event_btnOpenOtherCacheFolderActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private JButton btnChooseFolder; private JButton btnCleanLog; private JButton btnDeleteCache; private JButton btnOpenOtherCacheFolder; private JButton btnSaveAppConfig; private JButton btnSaveLF; private JButton btnSaveProxyConfig; private JButton btnSelectLF; private JCheckBox checkProxyNeedAuth; private JFileChooser folderChooser; private JLabel jLabel1; private JLabel jLabel10; private JLabel jLabel11; private JLabel jLabel12; private JLabel jLabel13; private JLabel jLabel14; private JLabel jLabel15; private JLabel jLabel16; private JLabel jLabel17; private JLabel jLabel18; private JLabel jLabel19; private JLabel jLabel2; private JLabel jLabel20; private JLabel jLabel21; private JLabel jLabel22; private JLabel jLabel23; private JLabel jLabel24; private JLabel jLabel25; private JLabel jLabel26; private JLabel jLabel27; private JLabel jLabel28; private JLabel jLabel29; private JLabel jLabel3; private JLabel jLabel30; private JLabel jLabel31; private JLabel jLabel32; private JLabel jLabel33; private JLabel jLabel34; private JLabel jLabel35; private JLabel jLabel36; private JLabel jLabel37; private JLabel jLabel38; private JLabel jLabel39; private JLabel jLabel4; private JLabel jLabel40; private JLabel jLabel41; private JLabel jLabel5; private JLabel jLabel6; private JLabel jLabel7; private JLabel jLabel8; private JLabel jLabel9; private JPanel jPanel1; private JPanel jPanel10; private JPanel jPanel11; private JPanel jPanel12; private JPanel jPanel13; private JPanel jPanel14; private JPanel jPanel15; private JPanel jPanel16; private JPanel jPanel2; private JPanel jPanel3; private JPanel jPanel4; private JPanel jPanel5; private JPanel jPanel6; private JPanel jPanel7; private JPanel jPanel8; private JPanel jPanel9; private JScrollPane jScrollPane1; private JTabbedPane jTabbedPane1; private ButtonGroup rbGroupUseProxy; private JRadioButton rbNoProxy; private JRadioButton rbUseProxy; private JTextField txtAppLookAndFeel; private JTextField txtDefaultFolderPath; private JTextField txtDefaultFolderPath1; private JTextArea txtLogContent; private JTextField txtProxyHost; private JPasswordField txtProxyPassword; private JTextField txtProxyPort; private JTextField txtProxyUsername; private JTextField txtTotalFileSize; private JTextField txtTotalFileSize1; private JTextField txtTotalLog; private JTextField txtTotalLogSize; private org.jdesktop.beansbinding.BindingGroup bindingGroup; // End of variables declaration//GEN-END:variables private void writeLookAndFeelConfiguration() { ReadWritePropertyFile.writeAppProperty(ApplicationConstants.APP_PROPERTY_FILE, new LabelValue(defaultLookAndFeel, "application.look-and-feel")); getAllConfig(); UIAlert.showInformation(this, "You need to restart the application to see changes"); } private void writeApplicationConfiguration() { ReadWritePropertyFile.writeAppProperty(ApplicationConstants.APP_PROPERTY_FILE, new LabelValue(defaultDownloadPath, "default.download.dir")); ReadWritePropertyFile.writeAppProperty(ApplicationConstants.APP_PROPERTY_FILE, new LabelValue(defaultFolderViewer, "default.folder.viewer")); UIAlert.showInformation(this, "Configuration Saved"); getAllConfig(); } private void writeProxyConfiguration() { logger.info("Configuration to Write "); logger.info(proxyConnection); ReadWritePropertyFile.writeProxyConnectionConfig("config.properties", proxyConnection); setProxyConnection(ReadWritePropertyFile.readProxyConnectionConfig("config.properties")); UIAlert.showInformation(this, "Configuration Saved"); //setProxyConnection(); } public ProxyConnection getProxyConnection() { return proxyConnection; } public void setProxyConnection(ProxyConnection proxyConnection) { ProxyConnection old = this.proxyConnection; this.proxyConnection = proxyConnection; firePropertyChange("proxyConnection", old, proxyConnection); if (proxyConnection != null) { setbUseProxyAuth(proxyConnection.getProxyUseAuth()); if (proxyConnection.getUseProxy()) { rbUseProxy.setSelected(true); } else { rbUseProxy.setSelected(false); } } } public boolean isbUseProxyAuth() { return bUseProxyAuth; } public void setbUseProxyAuth(boolean bUseProxyAuth) { boolean old = this.bUseProxyAuth; this.bUseProxyAuth = bUseProxyAuth; firePropertyChange("bUseProxyAuth", old, bUseProxyAuth); } private void connUseProxy(Boolean useProxy) { if (useProxy) { proxyConnection.setUseProxy(true); txtProxyHost.setEnabled(true); txtProxyPort.setEnabled(true); checkProxyNeedAuth.setEnabled(true); if (checkProxyNeedAuth.isSelected()) { connUseProxyAuth(true); } else { connUseProxyAuth(false); } } else { proxyConnection.setUseProxy(false); txtProxyHost.setEnabled(false); txtProxyPort.setEnabled(false); checkProxyNeedAuth.setEnabled(false); txtProxyUsername.setEnabled(false); txtProxyPassword.setEnabled(false); //connUseProxyAuth(false); } } private void connUseProxyAuth(Boolean useProxyAuth) { if (useProxyAuth) { txtProxyUsername.setEnabled(true); txtProxyPassword.setEnabled(true); proxyConnection.setProxyUseAuth(true); } else { txtProxyUsername.setEnabled(false); txtProxyPassword.setEnabled(false); proxyConnection.setProxyUseAuth(false); } } public String getDefaultDownloadPath() { return defaultDownloadPath; } public void setDefaultDownloadPath(String defaultDownloadPath) { String old = this.defaultDownloadPath; this.defaultDownloadPath = defaultDownloadPath; firePropertyChange("defaultDownloadPath", old, defaultDownloadPath); } public CacheFile getLogFile() { return logFile; } public void setLogFile(CacheFile logFile) { CacheFile old = this.logFile; this.logFile = logFile; firePropertyChange("logFile", old, logFile); } public String getLogFileData() { return logFileData; } public void setLogFileData(String logFileData) { String old = this.logFileData; this.logFileData = logFileData; firePropertyChange("logFileData", old, logFileData); } public String getDefaultLookAndFeel() { return defaultLookAndFeel; } public void setDefaultLookAndFeel(String defaultLookAndFeel) { String old = this.defaultLookAndFeel; this.defaultLookAndFeel = defaultLookAndFeel; firePropertyChange("defaultLookAndFeel", old, defaultLookAndFeel); } public String getDefaultFolderViewer() { return defaultFolderViewer; } public void setDefaultFolderViewer(String defaultFolderViewer) { String old = this.defaultFolderViewer; this.defaultFolderViewer = defaultFolderViewer; firePropertyChange("defaultFolderViewer", old, defaultFolderViewer); } public CacheFile getCacheFile() { return cacheFile; } public void setCacheFile(CacheFile cacheFile) { CacheFile old = this.cacheFile; this.cacheFile = cacheFile; firePropertyChange("cacheFile", old, cacheFile); } }