package fr.tikione.steam.cleaner.gui.dialog; import fr.tikione.steam.cleaner.util.GraphicsUtils; import fr.tikione.steam.cleaner.util.Log; import fr.tikione.steam.cleaner.util.Translation; import fr.tikione.steam.cleaner.util.UpdateManager; import java.awt.Color; import java.awt.Cursor; import java.awt.Font; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URL; import javax.swing.BorderFactory; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.JTextArea; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.WindowConstants; /** * Informations ("About") window. */ @SuppressWarnings("serial") public class JDialogAbout extends JDialog { /** * Create new form JDialogAbout. * * @param parent the parent component. * @param modal indicates if the frame is modal. * @param translation the program language translation handler. */ @SuppressWarnings("LeakingThisInConstructor") public JDialogAbout(java.awt.Frame parent, boolean modal, Translation translation) { super(parent, modal); initComponents(); initTranslateComponents(translation); GraphicsUtils.setFrameCentered(this); try { URL url = JDialogAbout.class.getResource("/fr/tikione/steam/cleaner/gui/tikione-steam-cleaner.png"); Toolkit kit = Toolkit.getDefaultToolkit(); Image img = kit.createImage(url); jLabelAbout.setIcon(new ImageIcon(img)); setTitle(translation.getString(Translation.SEC_WABOUT, "frameTitle")); jTextAreaMessage.setText( translation.getString(Translation.SEC_WABOUT, "author") + "\r\n" + translation.getString(Translation.SEC_WABOUT, "website1") + "\r\n" + translation.getString(Translation.SEC_WABOUT, "dev") + "\r\n\r\n" + translation.getString(Translation.SEC_WABOUT, "dep1")); } catch (Exception ex) { Log.error(ex); } } private void initTranslateComponents(Translation translation) { jButtonClose.setText(translation.getString(Translation.SEC_WABOUT, "button.close")); jButtonPaypalDonation.setToolTipText("<html><body>" + translation.getString(Translation.SEC_WABOUT, "icon.donate") + "<br><font color=\"blue\">http://sourceforge.net/p/tikione/donate/</font></body></html>"); } /** * 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() { jPanel1 = new JPanel(); jTextAreaMessage = new JTextArea(); jSeparator1 = new JSeparator(); jButtonClose = new JButton(); jLabelAbout = new JLabel(); jButtonPaypalDonation = new JButton(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setResizable(false); jPanel1.setBackground(new Color(255, 255, 255)); jTextAreaMessage.setEditable(false); jTextAreaMessage.setColumns(20); jTextAreaMessage.setFont(new Font("Dialog", 0, 12)); // NOI18N jTextAreaMessage.setRows(5); jTextAreaMessage.setBorder(BorderFactory.createEmptyBorder()); jButtonClose.setFont(new Font("Dialog", 1, 11)); // NOI18N jButtonClose.setText("Close"); jButtonClose.setFocusable(false); jButtonClose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButtonCloseActionPerformed(evt); } }); jLabelAbout.setFont(new Font("Dialog", 0, 13)); // NOI18N jButtonPaypalDonation.setBackground(new Color(255, 255, 255)); jButtonPaypalDonation.setIcon(new ImageIcon(getClass().getResource("/fr/tikione/steam/cleaner/gui/icons/paypal_donate_btn.png"))); // NOI18N jButtonPaypalDonation.setToolTipText(""); jButtonPaypalDonation.setBorder(null); jButtonPaypalDonation.setBorderPainted(false); jButtonPaypalDonation.setCursor(new Cursor(Cursor.HAND_CURSOR)); jButtonPaypalDonation.setFocusable(false); jButtonPaypalDonation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButtonPaypalDonationActionPerformed(evt); } }); GroupLayout jPanel1Layout = new GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) .addComponent(jSeparator1) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jTextAreaMessage, GroupLayout.PREFERRED_SIZE, 638, GroupLayout.PREFERRED_SIZE) .addGap(0, 2, Short.MAX_VALUE)) .addGroup(Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) .addComponent(jButtonClose, Alignment.TRAILING) .addGroup(Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabelAbout, GroupLayout.PREFERRED_SIZE, 315, GroupLayout.PREFERRED_SIZE) .addGap(194, 194, 194) .addComponent(jButtonPaypalDonation))))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) .addComponent(jButtonPaypalDonation) .addComponent(jLabelAbout, GroupLayout.PREFERRED_SIZE, 267, GroupLayout.PREFERRED_SIZE)) .addGap(11, 11, 11) .addComponent(jTextAreaMessage, GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jSeparator1, GroupLayout.PREFERRED_SIZE, 10, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(jButtonClose) .addContainerGap()) ); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButtonCloseActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jButtonCloseActionPerformed this.dispose(); }//GEN-LAST:event_jButtonCloseActionPerformed private void jButtonPaypalDonationActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jButtonPaypalDonationActionPerformed UpdateManager.extBrowser("http://sourceforge.net/p/tikione/donate/"); }//GEN-LAST:event_jButtonPaypalDonationActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private JButton jButtonClose; private JButton jButtonPaypalDonation; private JLabel jLabelAbout; private JPanel jPanel1; private JSeparator jSeparator1; private JTextArea jTextAreaMessage; // End of variables declaration//GEN-END:variables }