Проблемы с запуском программы - Java

Узнай цену своей работы

Формулировка задачи:

Вроде метод main не вызывает. (Это часть проги с jFrame и заполнителем этой формы, вот с заполнителем и проблема)
package copy;
 
public class Holst extends javax.swing.JFrame {
 
 public Holst() {
 initComponents();
 }
 @SuppressWarnings("unchecked")
 // <editor-fold defaultstate="collapsed" desc="Generated Code"> 
 private void initComponents() {
 
 startstop = new javax.swing.JToggleButton();
 kolvo = new javax.swing.JTextField();
 login = new javax.swing.JTextField();
 password = new javax.swing.JPasswordField();
 progress = new javax.swing.JProgressBar();
 text001 = new javax.swing.JScrollPane();
 text = new javax.swing.JTextPane();
 text002 = new javax.swing.JScrollPane();
 text0 = new javax.swing.JTextPane();
 text003 = new javax.swing.JScrollPane();
 text1 = new javax.swing.JTextPane();
 text2 = new javax.swing.JTextField();
 site = new javax.swing.JTextField();
 gotovo = new javax.swing.JTextField();
 
 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 
 startstop.setText("Старт");
 
 kolvo.setText("1000000");
 
 password.addActionListener(new java.awt.event.ActionListener() {
 public void actionPerformed(java.awt.event.ActionEvent evt) {
 passwordActionPerformed(evt);
 }
 });
 
 progress.setValue(30);
 
 text.setEditable(false);
 text.setText("Количество");
 text001.setViewportView(text);
 text.getAccessibleContext().setAccessibleName("kol-vo");
 
 text0.setEditable(false);
 text0.setText("Логин");
 text002.setViewportView(text0);
 
 text1.setEditable(false);
 text1.setText("Пароль");
 text003.setViewportView(text1);
 
 text2.setEditable(false);
 text2.setText("Сайт");
 
 site.setText("http://");
 
 gotovo.setEditable(false);
 gotovo.addActionListener(new java.awt.event.ActionListener() {
 public void actionPerformed(java.awt.event.ActionEvent evt) {
 gotovoActionPerformed(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(layout.createSequentialGroup()
 .addComponent(progress, javax.swing.GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE)
 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 .addComponent(gotovo, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)
 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 .addComponent(startstop))
 .addGroup(layout.createSequentialGroup()
 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 .addComponent(text001, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 .addComponent(text002, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
 .addComponent(text2, javax.swing.GroupLayout.Alignment.LEADING)
 .addComponent(text003, javax.swing.GroupLayout.Alignment.LEADING)))
 .addGap(110, 110, 110)
 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 .addComponent(site, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
 .addComponent(password)
 .addComponent(login)
 .addComponent(kolvo, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
 .addGap(0, 0, Short.MAX_VALUE)))
 .addContainerGap())
 );
 layout.setVerticalGroup(
 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
 .addGap(21, 21, 21)
 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 .addComponent(kolvo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 .addComponent(text001, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 .addGap(18, 18, 18)
 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 .addComponent(login, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 .addComponent(text002, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 .addGap(18, 18, 18)
 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 .addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 .addComponent(text003, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 .addGap(24, 24, 24)
 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 .addComponent(text2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 .addComponent(site, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 .addComponent(startstop, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 .addComponent(gotovo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 .addComponent(progress, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
 .addContainerGap())
 );
 
 text001.getAccessibleContext().setAccessibleName("kol-vo");
 text2.getAccessibleContext().setAccessibleName("");
 
 pack();
 }// </editor-fold> 
 
 private void passwordActionPerformed(java.awt.event.ActionEvent evt) { 
 // TODO add your handling code here:
 } 
 
 private void gotovoActionPerformed(java.awt.event.ActionEvent evt) { 
 // TODO add your handling code here:
 } 
 
 /**
 * @param args the command line arguments
 */
 public static void main(String args[]) {
 Transfer transfer = new Holst().new Transfer();
 transfer.Main();
 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
 * For details see [url]http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html[/url] 
 */
 try {
 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
 if ("Nimbus".equals(info.getName())) {
 javax.swing.UIManager.setLookAndFeel(info.getClassName());
 break;
 }
 }
 } catch (ClassNotFoundException ex) {
 java.util.logging.Logger.getLogger(Holst.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
 } catch (InstantiationException ex) {
 java.util.logging.Logger.getLogger(Holst.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
 } catch (IllegalAccessException ex) {
 java.util.logging.Logger.getLogger(Holst.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
 java.util.logging.Logger.getLogger(Holst.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
 }
 //</editor-fold>
 //</editor-fold>
 
 /* Create and display the form */
 java.awt.EventQueue.invokeLater(() -> {
 new Holst().setVisible(true);
 });
 }
 // Variables declaration - do not modify 
 private javax.swing.JTextField gotovo;
 private javax.swing.JTextField kolvo;
 private javax.swing.JTextField login;
 private javax.swing.JPasswordField password;
 private javax.swing.JProgressBar progress;
 private javax.swing.JTextField site;
 private javax.swing.JToggleButton startstop;
 private javax.swing.JTextPane text;
 private javax.swing.JTextPane text0;
 private javax.swing.JScrollPane text001;
 private javax.swing.JScrollPane text002;
 private javax.swing.JScrollPane text003;
 private javax.swing.JTextPane text1;
 private javax.swing.JTextField text2;
 // End of variables declaration 
 public class Transfer {
 public void Main() {
 int gotovoint1 = 0;
 Peremen(gotovoint1);
 }
 public void Peremen(int gotovoint) {
 gotovo.setText(Integer.toString(gotovoint));
 }
 }
}

Решение задачи: «Проблемы с запуском программы»

textual
Листинг программы
import javax.swing.*;

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

9   голосов , оценка 4.222 из 5