Java gui没有';不出现

Java gui没有';不出现,java,user-interface,netbeans,Java,User Interface,Netbeans,我不知道为什么gui没有出现 /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package anagramword; /** * * @author teteh */ public class gui extends javax.swing.JFrame { /** * Creates new form gui

我不知道为什么gui没有出现

  /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package anagramword;

/**
 *
 * @author teteh
 */
public class gui extends javax.swing.JFrame {

    /**
     * Creates new form gui
     */
    public String textword;
    public char[] temp;
    static int size;
    public gui() {
        initComponents();
        //setVisible(true);
    }

    /**
     * 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">                          
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        word = new javax.swing.JTextField();
        btnSubmit = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        hasil = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("Masukkan Kata");

        btnSubmit.setText("Acak");
        btnSubmit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSubmitActionPerformed(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel2.setText("Anagram Word");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel2)
                .addGap(99, 99, 99))
            .addGroup(layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(jLabel1)
                .addGap(62, 62, 62)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnSubmit, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(word, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(hasil, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(word, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnSubmit, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(hasil, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(22, Short.MAX_VALUE))
        );

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

    private void btnSubmitActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        Anagramword ana = new Anagramword();

        textword=word.getText();
        size = textword.length();
        temp = textword.toCharArray();

        if (size <= 2) {
            System.out.println("Maaf Minimal 3 Huruf");
        } else {
            ana.acak(textword, size);
            ana.runAnagram(size);
            ana.display();
        }
    }                                         

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<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 http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        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(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new gui().setVisible(true);
            }
        });

        //new gui().setVisible(true);
    }
    // Variables declaration - do not modify                     
    private javax.swing.JButton btnSubmit;
    private javax.swing.JLabel hasil;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JTextField word;
    // End of variables declaration                   
}
/*
*要更改此模板,请选择工具|模板
*然后在编辑器中打开模板。
*/
包装阿纳格拉姆福德;
/**
*
*@作者泰特
*/
公共类gui扩展了javax.swing.JFrame{
/**
*创建新表单gui
*/
公共字符串文本字;
公共字符[]临时;
静态整数大小;
公共图形用户界面(){
初始化组件();
//setVisible(真);
}
/**
*从构造函数中调用此方法来初始化表单。
*警告:不要修改此代码。此方法的内容始终为
*由表单编辑器重新生成。
*/
@抑制警告(“未选中”)
//                           
私有组件(){
jLabel1=newjavax.swing.JLabel();
word=newjavax.swing.JTextField();
btnSubmit=newjavax.swing.JButton();
jLabel2=newjavax.swing.JLabel();
hasil=newjavax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText(“Masukkan Kata”);
btnSubmit.setText(“Acak”);
btnSubmit.addActionListener(新的java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt){
BtnSubmitionPerformed(evt);
}
});
jLabel2.setFont(新的java.awt.Font(“Tahoma”,0,24));//NOI18N
jLabel2.setText(“字谜词”);
javax.swing.GroupLayout=newjavax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(布局);
layout.setHorizontalGroup(
createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT\u SIZE,Short.MAX\u值)
.addComponent(jLabel2)
.addGap(99,99,99))
.addGroup(layout.createSequentialGroup()
.addGap(37,37,37)
.addComponent(jLabel1)
.addGap(62,62,62)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnSubmit,javax.swing.GroupLayout.PREFERRED\u SIZE,81,javax.swing.GroupLayout.PREFERRED\u SIZE)
.addComponent(word,javax.swing.GroupLayout.PREFERRED_SIZE,178,javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hasil,javax.swing.GroupLayout.PREFERRED_SIZE,170,javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT\u SIZE,Short.MAX\u VALUE))
);
layout.setVerticalGroup(
createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24,24,24)
.addComponent(jLabel2,javax.swing.GroupLayout.PREFERRED\u SIZE,58,javax.swing.GroupLayout.PREFERRED\u SIZE)
.addGap(31,31,31)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(word,javax.swing.GroupLayout.PREFERRED\u SIZE,javax.swing.GroupLayout.DEFAULT\u SIZE,javax.swing.GroupLayout.PREFERRED\u SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnSubmit,javax.swing.GroupLayout.PREFERRED\u SIZE,65,javax.swing.GroupLayout.PREFERRED\u SIZE)
.addGap(18,18,18)
.addComponent(hasil,javax.swing.GroupLayout.PREFERRED\u SIZE,51,javax.swing.GroupLayout.PREFERRED\u SIZE)
.addContainerGap(22,简称最大值))
);
包装();
}//                         
私有void BtnSubmitionPerformed(java.awt.event.ActionEvent evt){
//TODO在此处添加您的处理代码:
Anagramword ana=新Anagramword();
textword=word.getText();
size=textword.length();
temp=textword.toCharArray();

如果(size可能当您按下netbeans中的开始按钮时,它会尝试运行另一个类…在您的类gui中,尝试右键单击->运行方式->Java应用程序


否则,右键单击Project->Run->Main Class->Browse..并选择
anagramword.gui

@user1822857在这里运行良好。您是如何运行此程序的?IDE,java版本?它向我显示。我必须在
BTBMinsutactionPerformed
中注释掉代码(因为我没有访问anagramword类的权限),但这是无关紧要的。