示例#1
0
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jTabbedPane1 = new javax.swing.JTabbedPane();
    ProfileTab = new javax.swing.JPanel();
    pro_pic_label = new javax.swing.JLabel();
    name_text = new javax.swing.JTextField();
    name_label = new javax.swing.JLabel();
    ChooseImage = new javax.swing.JButton();
    pro_pic_display = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    GeneralTab = new javax.swing.JPanel();
    Display_button = new javax.swing.JLabel();
    color_button = new javax.swing.JButton();
    jScrollPane2 = new javax.swing.JScrollPane();
    font_style_list = new javax.swing.JList();
    jScrollPane3 = new javax.swing.JScrollPane();
    font_size_list = new javax.swing.JList();
    jScrollPane4 = new javax.swing.JScrollPane();
    DisplayArea_text = new javax.swing.JTextArea();
    Font_size_label = new javax.swing.JLabel();
    Font_label = new javax.swing.JLabel();
    Font_Color_button = new javax.swing.JButton();
    ChatsTab = new javax.swing.JPanel();
    Backup_Button = new javax.swing.JLabel();
    Backup_textfield = new javax.swing.JTextField();
    backup_folder_button = new javax.swing.JButton();
    Backup_Chat_label = new javax.swing.JLabel();
    backup_chat_button = new javax.swing.JButton();
    NotificationsTab = new javax.swing.JPanel();
    Sound = new javax.swing.JCheckBox();
    jLabel1 = new javax.swing.JLabel();
    Download_Textfield = new javax.swing.JTextField();
    Download_button = new javax.swing.JButton();
    AboutTab = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTextArea1 = new javax.swing.JTextArea();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    cancel_button = new javax.swing.JButton();
    Save_Exit = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    pro_pic_label.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    pro_pic_label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    pro_pic_label.setText("Profile Picture");

    name_text.setText(xchat.my_name);
    name_text.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            name_textActionPerformed(evt);
          }
        });

    name_label.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    name_label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    name_label.setText("Name");

    ChooseImage.setText("Choose Image");
    ChooseImage.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            ChooseImageMouseClicked(evt);
          }
        });
    ChooseImage.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ChooseImageActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout pro_pic_displayLayout = new javax.swing.GroupLayout(pro_pic_display);
    pro_pic_display.setLayout(pro_pic_displayLayout);
    pro_pic_displayLayout.setHorizontalGroup(
        pro_pic_displayLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE));
    pro_pic_displayLayout.setVerticalGroup(
        pro_pic_displayLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                jLabel2,
                javax.swing.GroupLayout.Alignment.TRAILING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                100,
                Short.MAX_VALUE));

    javax.swing.GroupLayout ProfileTabLayout = new javax.swing.GroupLayout(ProfileTab);
    ProfileTab.setLayout(ProfileTabLayout);
    ProfileTabLayout.setHorizontalGroup(
        ProfileTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                ProfileTabLayout.createSequentialGroup()
                    .addGap(30, 30, 30)
                    .addGroup(
                        ProfileTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(
                                ProfileTabLayout.createSequentialGroup()
                                    .addComponent(
                                        pro_pic_label,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        121,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(
                                        pro_pic_display,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(
                                        ChooseImage,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        159,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                ProfileTabLayout.createSequentialGroup()
                                    .addComponent(
                                        name_label,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        84,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        name_text,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        303,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(188, Short.MAX_VALUE)));
    ProfileTabLayout.setVerticalGroup(
        ProfileTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                ProfileTabLayout.createSequentialGroup()
                    .addGap(33, 33, 33)
                    .addGroup(
                        ProfileTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                name_label,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                33,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                name_text,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                33,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(
                        ProfileTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                ChooseImage,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                34,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                pro_pic_display,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                pro_pic_label,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                33,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    jTabbedPane1.addTab("Profile", ProfileTab);

    Display_button.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    Display_button.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    Display_button.setText("Display");

    color_button.setText("Background Color");
    color_button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            color_buttonActionPerformed(evt);
          }
        });

    font_style_list.setModel(
        new javax.swing.AbstractListModel() {
          String[] strings = {
            "Arial",
            "Bradley Hand ITC",
            "Castellar",
            "Chiller",
            "Comic Sans MS",
            "Courier New",
            "Lucida Calligraphy",
            "Papyrus",
            "Tahoma",
            "Times New Roman"
          };

          public int getSize() {
            return strings.length;
          }

          public Object getElementAt(int i) {
            return strings[i];
          }
        });
    font_style_list.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    font_style_list.setSelectedIndex(0);
    font_style_list.addListSelectionListener(
        new javax.swing.event.ListSelectionListener() {
          public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
            font_style_listValueChanged(evt);
          }
        });
    jScrollPane2.setViewportView(font_style_list);
    font_style_list.setSelectedIndex(0);

    font_size_list.setModel(
        new javax.swing.AbstractListModel() {
          String[] strings = {"very small", "small", "medium", "huge", "vey huge"};

          public int getSize() {
            return strings.length;
          }

          public Object getElementAt(int i) {
            return strings[i];
          }
        });
    font_size_list.setSelectedIndex(1);
    font_size_list.addListSelectionListener(
        new javax.swing.event.ListSelectionListener() {
          public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
            font_size_listValueChanged(evt);
          }
        });
    jScrollPane3.setViewportView(font_size_list);

    jScrollPane4.setHorizontalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jScrollPane4.setVerticalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

    DisplayArea_text.setEditable(false);
    DisplayArea_text.setColumns(20);
    DisplayArea_text.setRows(5);
    DisplayArea_text.setText("AaBbYyZz");
    DisplayArea_text.setAutoscrolls(false);
    DisplayArea_text.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    jScrollPane4.setViewportView(DisplayArea_text);

    Font_size_label.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    Font_size_label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    Font_size_label.setText("Font size");

    Font_label.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    Font_label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    Font_label.setText("Font ");

    Font_Color_button.setText("Font Color");
    Font_Color_button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Font_Color_buttonActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout GeneralTabLayout = new javax.swing.GroupLayout(GeneralTab);
    GeneralTab.setLayout(GeneralTabLayout);
    GeneralTabLayout.setHorizontalGroup(
        GeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                GeneralTabLayout.createSequentialGroup()
                    .addGap(52, 52, 52)
                    .addGroup(
                        GeneralTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(
                                color_button,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                147,
                                Short.MAX_VALUE)
                            .addComponent(
                                Display_button,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                133,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                Font_Color_button,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addGap(36, 36, 36)
                    .addGroup(
                        GeneralTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                GeneralTabLayout.createSequentialGroup()
                                    .addComponent(
                                        jScrollPane2,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        152,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(40, 40, 40)
                                    .addComponent(
                                        jScrollPane3,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        100,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(
                                jScrollPane4,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                259,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(107, Short.MAX_VALUE))
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                GeneralTabLayout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(
                        Font_label,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        120,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(53, 53, 53)
                    .addComponent(
                        Font_size_label,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        120,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(97, 97, 97)));
    GeneralTabLayout.setVerticalGroup(
        GeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                GeneralTabLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        GeneralTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                GeneralTabLayout.createSequentialGroup()
                                    .addComponent(
                                        Font_size_label,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        27,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(8, 8, 8)
                                    .addComponent(
                                        jScrollPane3,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        84,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                GeneralTabLayout.createSequentialGroup()
                                    .addComponent(
                                        Font_label,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        27,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        GeneralTabLayout.createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(
                                                jScrollPane2,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                84,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(
                                                GeneralTabLayout.createSequentialGroup()
                                                    .addComponent(
                                                        color_button,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        36,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement
                                                            .UNRELATED)
                                                    .addComponent(
                                                        Font_Color_button,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        Short.MAX_VALUE)))))
                    .addGap(18, 18, 18)
                    .addGroup(
                        GeneralTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                jScrollPane4,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                51,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                Display_button,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                40,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    jTabbedPane1.addTab("General", GeneralTab);

    Backup_Button.setText("Backup Folder");

    Backup_textfield.setEditable(false);
    Backup_textfield.setText(xchat.path_save_chat);
    Backup_textfield.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Backup_textfieldActionPerformed(evt);
          }
        });

    backup_folder_button.setText("Choose Folder");
    backup_folder_button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            backup_folder_buttonActionPerformed(evt);
          }
        });

    Backup_Chat_label.setText("Backup Current Chat");

    backup_chat_button.setText("OK");
    backup_chat_button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            backup_chat_buttonActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout ChatsTabLayout = new javax.swing.GroupLayout(ChatsTab);
    ChatsTab.setLayout(ChatsTabLayout);
    ChatsTabLayout.setHorizontalGroup(
        ChatsTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                ChatsTabLayout.createSequentialGroup()
                    .addGap(57, 57, 57)
                    .addGroup(
                        ChatsTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(
                                Backup_Chat_label,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                114,
                                Short.MAX_VALUE)
                            .addComponent(
                                Backup_Button,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        Backup_textfield,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        227,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(30, 30, 30)
                    .addComponent(
                        backup_folder_button,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        115,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(87, Short.MAX_VALUE))
            .addGroup(
                ChatsTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(
                        ChatsTabLayout.createSequentialGroup()
                            .addGap(185, 185, 185)
                            .addComponent(
                                backup_chat_button,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                102,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(347, Short.MAX_VALUE))));
    ChatsTabLayout.setVerticalGroup(
        ChatsTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                ChatsTabLayout.createSequentialGroup()
                    .addGap(44, 44, 44)
                    .addGroup(
                        ChatsTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                Backup_Button,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                37,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                Backup_textfield,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                37,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                backup_folder_button,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                37,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
                    .addComponent(
                        Backup_Chat_label,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        37,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(59, 59, 59))
            .addGroup(
                ChatsTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(
                        javax.swing.GroupLayout.Alignment.TRAILING,
                        ChatsTabLayout.createSequentialGroup()
                            .addContainerGap(128, Short.MAX_VALUE)
                            .addComponent(
                                backup_chat_button,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                37,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(56, 56, 56))));

    jTabbedPane1.addTab("Chats ", ChatsTab);

    Sound.setSelected(true);
    Sound.setText("Sound");
    Sound.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            SoundActionPerformed(evt);
          }
        });

    jLabel1.setText("Download Folder");

    Download_Textfield.setEditable(false);
    Download_Textfield.setText(xchat.path_save_download);

    Download_button.setText("Choose Folder");
    Download_button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Download_buttonActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout NotificationsTabLayout = new javax.swing.GroupLayout(NotificationsTab);
    NotificationsTab.setLayout(NotificationsTabLayout);
    NotificationsTabLayout.setHorizontalGroup(
        NotificationsTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                NotificationsTabLayout.createSequentialGroup()
                    .addGap(36, 36, 36)
                    .addGroup(
                        NotificationsTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                NotificationsTabLayout.createSequentialGroup()
                                    .addComponent(
                                        jLabel1,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        126,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        Download_Textfield,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        291,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(
                                        Download_button,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        123,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(
                                Sound,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                146,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(36, Short.MAX_VALUE)));
    NotificationsTabLayout.setVerticalGroup(
        NotificationsTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                NotificationsTabLayout.createSequentialGroup()
                    .addGap(35, 35, 35)
                    .addComponent(
                        Sound,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        39,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        NotificationsTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(
                                Download_button,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                34,
                                Short.MAX_VALUE)
                            .addComponent(
                                jLabel1,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                Download_Textfield,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                34,
                                Short.MAX_VALUE))
                    .addContainerGap(108, Short.MAX_VALUE)));

    jTabbedPane1.addTab("Sounds & Download", NotificationsTab);

    AboutTab.setAutoscrolls(true);
    AboutTab.setEnabled(false);

    jScrollPane1.setHorizontalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jScrollPane1.setVerticalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    jScrollPane1.setOpaque(false);

    jTextArea1.setEditable(false);
    jTextArea1.setBackground(new java.awt.Color(240, 240, 240));
    jTextArea1.setColumns(20);
    jTextArea1.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
    jTextArea1.setLineWrap(true);
    jTextArea1.setRows(5);
    jTextArea1.setText(
        "XChat is based on software from JAVA, which has been doubled licensed under the Narendari Modi Development and Distribution (NMDD) and the Barack Obama License (BOL) version 9.9.9.9.9.9... with Rahul Gandhi exception. For more information, please visit http://www.google.co.in/ ");
    jTextArea1.setWrapStyleWord(true);
    jTextArea1.setBorder(null);
    jTextArea1.setOpaque(false);
    jScrollPane1.setViewportView(jTextArea1);

    jLabel3.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/xchat/Barack Obama.jpg"))); // NOI18N

    jLabel4.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/xchat/X (2).jpg"))); // NOI18N

    jLabel5.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/xchat/Narendra-Modi-In-Brown-Coat.jpg"))); // NOI18N

    javax.swing.GroupLayout AboutTabLayout = new javax.swing.GroupLayout(AboutTab);
    AboutTab.setLayout(AboutTabLayout);
    AboutTabLayout.setHorizontalGroup(
        AboutTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                AboutTabLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        AboutTabLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1)
                            .addGroup(
                                AboutTabLayout.createSequentialGroup()
                                    .addComponent(
                                        jLabel5,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        180,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(50, 50, 50)
                                    .addComponent(
                                        jLabel4,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        150,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        54,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        jLabel3,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        180,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));

    AboutTabLayout.linkSize(
        javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel3, jLabel5});

    AboutTabLayout.setVerticalGroup(
        AboutTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                AboutTabLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        AboutTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(
                                jLabel3,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                90,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jLabel5,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                90,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jLabel4,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                90,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addComponent(
                        jScrollPane1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        80,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));

    AboutTabLayout.linkSize(
        javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jLabel3, jLabel5});

    jTabbedPane1.addTab("About", AboutTab);

    cancel_button.setText("Cancel");
    cancel_button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancel_buttonActionPerformed(evt);
          }
        });

    Save_Exit.setText("Save and Exit");
    Save_Exit.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Save_ExitActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                layout
                                    .createSequentialGroup()
                                    .addGap(0, 0, Short.MAX_VALUE)
                                    .addComponent(
                                        Save_Exit,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        114,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(
                                        cancel_button,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        99,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jTabbedPane1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        230,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(
                                cancel_button,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                35,
                                Short.MAX_VALUE)
                            .addComponent(
                                Save_Exit,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addContainerGap()));

    pack();
  } // </editor-fold>//GEN-END:initComponents
示例#2
0
 private void SoundActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_SoundActionPerformed
   notification = Sound.isSelected();
 } // GEN-LAST:event_SoundActionPerformed
示例#3
0
  @Override
  protected void paintComponent(Graphics g) {
    g.clearRect(0, 0, getWidth(), getHeight());
    if (bgY == 0) // if that checks when to restart the background
    bgY = -519;
    g.drawImage(background, 0, bgY++, this);
    // Draw the space ship, shots and objects
    if (Main.state == Main.STATE.GAME) {
      if (playerMove == 0) {
        g.drawImage(player, playerX, playerY, 40, 40, this);
      }
      if (playerMove == 1) {
        g.drawImage(playerRight, playerX, playerY, 40, 40, this);
      }
      if (playerMove == 2) {
        g.drawImage(playerLeft, playerX, playerY, 40, 40, this);
      }
      if (drops != null) {
        for (int[] cosordinates : drops) {
          g.setColor(Color.RED);
          if (coordinates[2] == 0 && Main.freezeOver) {
            g.drawImage(meteor, coordinates[0], coordinates[1], 30, 50, this);
          }
          if (coordinates[2] == 0 && !Main.freezeOver) {
            g.drawImage(iceMeteor, coordinates[0], coordinates[1], 30, 50, this);
          }
          if (coordinates[2] == 1) {
            g.drawImage(heart, coordinates[0], coordinates[1], 25, 25, this);
          }
          if (coordinates[2] == 2) {
            g.drawImage(ice, coordinates[0], coordinates[1], 25, 25, this);
          }
          if (coordinates[2] == 3) {
            g.drawImage(comet, coordinates[0], coordinates[1], 30, 50, this);
          }
        }
      }
      if (shots != null) {
        for (int[] coordinates : shots) {
          g.drawImage(shot, coordinates[0], coordinates[1], 10, 25, this);
        }
      }
      g.setColor(Color.WHITE);
      g.drawString("Score: " + Main.score, 235, 13);
      g.drawString("Lives: ", 10, 13);
      for (int i = 1; i <= lives; i++) {
        g.drawImage(heart, 20 * i, 13, 20, 20, this);
      }

      if (Main.score / 1500 > levels && Main.levelTimer < 500) {

        g.drawImage(level, 80, 215, this);
        Sound.playSound("res/sounds/level.wav", false, -5.0f);
        GameObjects.bonus = 40;
        Main.levelTimer += 10;

      } else if (Main.score / 1500 > levels) {
        if (Main.freezeOver) {
          Main.speed = levels / 2 + 5;
          levels = Main.score / 1000 + 2;
          Main.levelTimer = 0;
        }
      }
    } else if (Main.state == Main.STATE.GAMEOVER) {
      g.drawImage(end, 80, 205, this);
      g.setColor(Color.WHITE);
      g.drawString("Score: " + Main.score, 120, 245);
      g.drawString("Press  [Esc]  to return to Main Menu", 60, 310);

    } else if (Main.state == Main.STATE.MENU) {
      Font fnt = new Font("arial", Font.BOLD, 34);
      g.setFont(fnt);
      g.setColor(Color.white);
      g.drawImage(logo, 30, 35, this);

      fnt = new Font("arial", Font.BOLD, 23);
      g.setFont(fnt);
      if (option == 0) {
        g.setColor(new Color(173, 255, 47));
        g.drawString("START", Main.fieldHeight / 2 - 135, 220);
        g.setColor(Color.WHITE);
        g.drawString("HIGHSCORES", Main.fieldHeight / 2 - 170, 270);
        g.drawString("QUIT", Main.fieldHeight / 2 - 120, 320);
      }
      if (option == 1) {
        g.drawString("START", Main.fieldHeight / 2 - 135, 220);
        g.setColor(new Color(173, 255, 47));
        g.drawString("HIGHSCORES", Main.fieldHeight / 2 - 170, 270);
        g.setColor(Color.WHITE);
        g.drawString("QUIT", Main.fieldHeight / 2 - 120, 320);
      }
      if (option == 2) {
        g.drawString("START", Main.fieldHeight / 2 - 135, 220);
        g.drawString("HIGHSCORES", Main.fieldHeight / 2 - 170, 270);
        g.setColor(new Color(173, 255, 47));
        g.drawString("QUIT", Main.fieldHeight / 2 - 120, 320);
        g.setColor(Color.WHITE);
      }

    } else if (Main.state == Main.STATE.HIGHSCORES) {
      Font fnt = new Font("arial", Font.BOLD, 24);
      g.setFont(fnt);
      g.setColor(Color.white);
      g.drawString("Highest score: " + Main.highestScore, Main.fieldWidth / 2 - 100, 100);
    }
  }