problem z closeButton

0

Witam!
Chciałbym prosić lepszych programistów o pomoc.
Po kompilacji w Netbeans pokazuje sie 9 błędów i nie wiem w czym rzecz, co jest źle:
package zaliczenie;

import org.jdesktop.application.Action;

public class ZaliczenieAboutBox extends javax.swing.JDialog {

public ZaliczenieAboutBox(java.awt.Frame parent) {
    super(parent);
    initComponents();
    getRootPane().setDefaultButton(closeButton);
}

@Action public void closeAboutBox() {
    setVisible(false);
}

/** 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.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">                          
private void initComponents() {

    closeButton = new javax.swing.JButton();
    javax.swing.JLabel appTitleLabel = new javax.swing.JLabel();
    javax.swing.JLabel versionLabel = new javax.swing.JLabel();
    javax.swing.JLabel appVersionLabel = new javax.swing.JLabel();
    javax.swing.JLabel vendorLabel = new javax.swing.JLabel();
    javax.swing.JLabel appVendorLabel = new javax.swing.JLabel();
    javax.swing.JLabel appHomepageLabel = new javax.swing.JLabel();
    javax.swing.JLabel appDescLabel = new javax.swing.JLabel();
    javax.swing.JLabel imageLabel = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle(org.jdesktop.application.Application.getInstance(zaliczenie.ZaliczenieApp.class).getContext().getResourceMap(ZaliczenieAboutBox.class).getString("title")); // NOI18N
    setModal(true);
    setName("aboutBox"); // NOI18N
    setResizable(false);

   <b> closeButton.setAction(???);
    closeButton.setName("closeButton"); // NOI18N
</b> appTitleLabel.setFont(appTitleLabel.getFont().deriveFont(appTitleLabel.getFont().getStyle() | java.awt.Font.BOLD, appTitleLabel.getFont().getSize()+4)); appTitleLabel.setText(org.jdesktop.application.Application.getInstance(zaliczenie.ZaliczenieApp.class).getContext().getResourceMap(ZaliczenieAboutBox.class).getString("Application.title")); // NOI18N appTitleLabel.setName("appTitleLabel"); // NOI18N
    versionLabel.setFont(versionLabel.getFont().deriveFont(versionLabel.getFont().getStyle() | java.awt.Font.BOLD));
    versionLabel.setText(org.jdesktop.application.Application.getInstance(zaliczenie.ZaliczenieApp.class).getContext().getResourceMap(ZaliczenieAboutBox.class).getString("versionLabel.text")); // NOI18N
    versionLabel.setName("versionLabel"); // NOI18N

    appVersionLabel.setText(org.jdesktop.application.Application.getInstance(zaliczenie.ZaliczenieApp.class).getContext().getResourceMap(ZaliczenieAboutBox.class).getString("Application.version")); // NOI18N
    appVersionLabel.setName("appVersionLabel"); // NOI18N

    vendorLabel.setFont(vendorLabel.getFont().deriveFont(vendorLabel.getFont().getStyle() | java.awt.Font.BOLD));
    vendorLabel.setText(org.jdesktop.application.Application.getInstance(zaliczenie.ZaliczenieApp.class).getContext().getResourceMap(ZaliczenieAboutBox.class).getString("vendorLabel.text")); // NOI18N
    vendorLabel.setName("vendorLabel"); // NOI18N

    appVendorLabel.setText(org.jdesktop.application.Application.getInstance(zaliczenie.ZaliczenieApp.class).getContext().getResourceMap(ZaliczenieAboutBox.class).getString("Application.vendor")); // NOI18N
    appVendorLabel.setName("appVendorLabel"); // NOI18N

    appHomepageLabel.setText(org.jdesktop.application.Application.getInstance(zaliczenie.ZaliczenieApp.class).getContext().getResourceMap(ZaliczenieAboutBox.class).getString("Application.homepage")); // NOI18N
    appHomepageLabel.setName("appHomepageLabel"); // NOI18N

    appDescLabel.setText(org.jdesktop.application.Application.getInstance(zaliczenie.ZaliczenieApp.class).getContext().getResourceMap(ZaliczenieAboutBox.class).getString("appDescLabel.text")); // NOI18N
    appDescLabel.setName("appDescLabel"); // NOI18N

    imageLabel.setIcon(org.jdesktop.application.Application.getInstance(zaliczenie.ZaliczenieApp.class).getContext().getResourceMap(ZaliczenieAboutBox.class).getIcon("imageLabel.icon")); // NOI18N
    imageLabel.setName("imageLabel"); // NOI18N

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addComponent(imageLabel)
            .addGap(18, 18, 18)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(versionLabel)
                        .addComponent(vendorLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(appVersionLabel)
                        .addComponent(appVendorLabel)
                        .addComponent(appHomepageLabel)))
                .addComponent(appTitleLabel, javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(appDescLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE)
                .addComponent(closeButton))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(imageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(appTitleLabel)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(appDescLabel)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(versionLabel)
                .addComponent(appVersionLabel))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(vendorLabel)
                .addComponent(appVendorLabel))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(appHomepageLabel)
            .addGap(45, 45, Short.MAX_VALUE)
            .addComponent(closeButton)
            .addContainerGap())
    );

    pack();
}// </editor-fold>                        

// Variables declaration - do not modify                     
private javax.swing.JButton closeButton;
// End of variables declaration

a oto błędy:

Compiling 3 source files to E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\build\classes
E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\src\zaliczenie\ZaliczenieAboutBox.java:45: illegal start of expression
closeButton.setAction(???);
E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\src\zaliczenie\ZaliczenieAboutBox.java:45: illegal start of expression
closeButton.setAction(???);
E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\src\zaliczenie\ZaliczenieAboutBox.java:45: illegal start of expression
closeButton.setAction(???);
E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\src\zaliczenie\ZaliczenieAboutBox.java:45: illegal start of expression
closeButton.setAction(???);
E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\src\zaliczenie\ZaliczenieAboutBox.java:45: illegal start of expression
closeButton.setAction(???);
E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\src\zaliczenie\ZaliczenieAboutBox.java:45: : expected
closeButton.setAction(???);
E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\src\zaliczenie\ZaliczenieAboutBox.java:46: illegal start of expression
closeButton.setName("closeButton"); // NOI18N
E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\src\zaliczenie\ZaliczenieAboutBox.java:46: : expected
closeButton.setName("closeButton"); // NOI18N
E:\Test_Zaliczenie_Java_1.0_src\Zaliczenie\src\zaliczenie\ZaliczenieAboutBox.java:46: ')' expected
closeButton.setName("closeButton"); // NOI18N
9 errors
BUILD FAILED (total time: 0 seconds)

Bardzo proszę o pomoc w rozwiązaniu problemu!!!

0

Problem rozwiązany.
Tylko mam jeszce pytanie:
Program to test w którym zapisujemy pytania i odpowiedzi w pliku .txt ( 1pytanie i 3 odpowiedzi w jednej lini)
chciałbym żeby mozna było dac przycisk który posortuje nam losowo pytania i drugi który skasuje zawartośc pliku z pytaniami?
Jak to zrobić

0

Tak naprawdę, to jest to tylko jeden błąd. Chodzi o te nieszczęsne "???". Coś Ci się musiało pomerdać w formatce ponieważ kod produkowany przez NB zasadniczo nigdy nie ma błędów. Zamiast ??? powinna tam być referencja do obiektu klasy implementującej interfejs Action.
Nie wiem jak to naprawić ponieważ do tego kodu nigdy nie powinieneś mieć dostępu. Można go normalnie jedynie odczytywać i kopiować.
Spróbuj na nowo stworzyć taką samą formatkę.

1 użytkowników online, w tym zalogowanych: 0, gości: 1