Olá, estou iniciando no mundo java, e já criei 2 projeto: uma calculadora e um desenho.
O meu problema é que quando utilizo shift+F6 ele me mostra meu trabalho sem problemas. Porém quando vou compilar usando F6, ele compila sem problemas mas não me mostra a Tela do projeto compilado. O que estou fazendo errado???
Utilizo o NetBeans 7.1.2 e windows7. Desde já agradeço a todos.
setVisible(true) ?
eu já tenho o setViseble(true), setado. Segue meu código, pois já não sei mais o que fazer:
[code]/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
package calculadora;
/**
*
-
@author Usuario
*/
public class JFCalc extends javax.swing.JFrame {
char operacao;
String Temp, numeroAntes,copia;
double num1, num2, resultado;/**
- Creates new form JFCalc
*/
public JFCalc() {
initComponents();
}
private void escolheOperação(char op) throws NumberFormatException {
operacao = op;
num1 = Double.parseDouble(jTVisor.getText());
jTVisor.setText("");
}/**
-
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”)
//
private void initComponents() {jPanel1 = new javax.swing.JPanel();
jTVisor = new java.awt.TextField();
jBBsp = new javax.swing.JButton();
jB7 = new javax.swing.JButton();
jB4 = new javax.swing.JButton();
jB1 = new javax.swing.JButton();
jB0 = new javax.swing.JButton();
jBVirgula = new javax.swing.JButton();
jB2 = new javax.swing.JButton();
jB5 = new javax.swing.JButton();
jB8 = new javax.swing.JButton();
jBCe = new javax.swing.JButton();
jBClr = new javax.swing.JButton();
jB9 = new javax.swing.JButton();
jB6 = new javax.swing.JButton();
jB3 = new javax.swing.JButton();
jBIgual = new javax.swing.JButton();
jBmm = new javax.swing.JButton();
jBDivisão = new javax.swing.JButton();
jBMultiplicação = new javax.swing.JButton();
jBSubtração = new javax.swing.JButton();
jBSoma = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenu4 = new javax.swing.JMenu();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle(“Calculadora”);jTVisor.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTVisorActionPerformed(evt);
}
});jBBsp.setText(“Bsp”);
jBBsp.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBBspActionPerformed(evt);
}
});jB7.setText(“7”);
jB7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB7ActionPerformed(evt);
}
});jB4.setText(“4”);
jB4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB4ActionPerformed(evt);
}
});jB1.setText(“1”);
jB1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB1ActionPerformed(evt);
}
});jB0.setText(“0”);
jB0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB0ActionPerformed(evt);
}
});jBVirgula.setText(",");
jBVirgula.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBVirgulaActionPerformed(evt);
}
});jB2.setText(“2”);
jB2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB2ActionPerformed(evt);
}
});jB5.setText(“5”);
jB5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB5ActionPerformed(evt);
}
});jB8.setText(“8”);
jB8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB8ActionPerformed(evt);
}
});jBCe.setText(“CE”);
jBCe.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBCeActionPerformed(evt);
}
});jBClr.setText(“Clr”);
jBClr.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBClrActionPerformed(evt);
}
});jB9.setText(“9”);
jB9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB9ActionPerformed(evt);
}
});jB6.setText(“6”);
jB6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB6ActionPerformed(evt);
}
});jB3.setText(“3”);
jB3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB3ActionPerformed(evt);
}
});jBIgual.setText("=");
jBIgual.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBIgualActionPerformed(evt);
}
});jBmm.setText(“M±”);
jBmm.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBmmActionPerformed(evt);
}
});jBDivisão.setText(“÷”);
jBDivisão.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBDivisãoActionPerformed(evt);
}
});jBMultiplicação.setText(“x”);
jBMultiplicação.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBMultiplicaçãoActionPerformed(evt);
}
});jBSubtração.setText("-");
jBSubtração.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBSubtraçãoActionPerformed(evt);
}
});jBSoma.setText("+");
jBSoma.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBSomaActionPerformed(evt);
}
});javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jB4, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jB5, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jB6, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jBMultiplicação, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jB0, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jB1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jB2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jB3, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jBSubtração, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jBVirgula, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBIgual, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBSoma, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jTVisor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jBBsp, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBCe, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBClr, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBmm, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jB7, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jB8, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jB9, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBDivisão, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jB0, jB1, jB2, jB3, jB4, jB5, jB6, jB7, jB8, jB9, jBBsp, jBCe, jBClr, jBDivisão, jBIgual, jBMultiplicação, jBSoma, jBSubtração, jBVirgula, jBmm});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(20, Short.MAX_VALUE)
.addComponent(jTVisor, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBCe, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jBClr)
.addComponent(jBmm))
.addComponent(jBBsp, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jB7)
.addComponent(jB8)
.addComponent(jB9)
.addComponent(jBDivisão))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jB4)
.addComponent(jB5)
.addComponent(jB6)
.addComponent(jBMultiplicação))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jB1)
.addComponent(jB2)
.addComponent(jB3)
.addComponent(jBSubtração))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jB0)
.addComponent(jBVirgula)
.addComponent(jBIgual)
.addComponent(jBSoma))
.addContainerGap())
);jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jB0, jB1, jB2, jB3, jB4, jB5, jB6, jB7, jB8, jB9, jBBsp, jBCe, jBClr, jBDivisão, jBIgual, jBMultiplicação, jBSoma, jBSubtração, jBVirgula, jBmm});
jMenu1.setText(“Calculadora”);
jMenu1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu1ActionPerformed(evt);
}
});jMenuItem1.setText(“Sair”);
jMenu1.add(jMenuItem1);jMenuBar1.add(jMenu1);
jMenu2.setText(“Editar”);
jMenuItem2.setText(“Copiar”);
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem2);jMenuItem3.setText(“Colar”);
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem3);jMenuBar1.add(jMenu2);
jMenu3.setText(“Sobre”);
jMenuBar1.add(jMenu3);jMenu4.setText(“Sair”);
jMenu4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenu4MouseClicked(evt);
}
});
jMenuBar1.add(jMenu4);setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 2, Short.MAX_VALUE))
);pack();
}//
private void jTVisorActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}private void jBCeActionPerformed(java.awt.event.ActionEvent evt) {
num2 = 0;
jTVisor.setText(String.valueOf(num1));
}private void jB7ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“7”);
}private void jBBspActionPerformed(java.awt.event.ActionEvent evt) {
Temp = numeroAntes;
jTVisor.setText(Temp);
}private void jBmmActionPerformed(java.awt.event.ActionEvent evt) {
if(Temp.startsWith("-")){
Temp = Temp.replace(’-’,’+’);}
else if(Temp.startsWith("+")){
Temp = Temp.replace(’+’,’-’);}
else{
Temp = “-” + Temp;
}
jTVisor.setText(Temp);
}private void jB0ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“0”);}
private void numeroDigitado(String numero) {
Temp = jTVisor.getText();
numeroAntes = Temp;
Temp = Temp + numero;
jTVisor.setText(Temp);
}private void jB2ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“2”);
}private void jB3ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“3”);
}private void jB4ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“4”);
}private void jB5ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“5”);
}private void jB6ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“6”);
}private void jB8ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“8”);
}private void jB9ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“9”);
}private void jBVirgulaActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(",");
}private void jB1ActionPerformed(java.awt.event.ActionEvent evt) {
numeroDigitado(“1”);
}private void jBSomaActionPerformed(java.awt.event.ActionEvent evt) {
escolheOperação(’+’);
}private void jBIgualActionPerformed(java.awt.event.ActionEvent evt) {
num2 = Double.parseDouble(jTVisor.getText());switch (operacao){ case '+': resultado = num1 + num2; break; case '-': resultado = num1 - num2; break; case '*': resultado = num1 * num2; break; case '/': resultado = num1 / num2; break; } jTVisor.setText(String.valueOf(resultado));
}
private void jBSubtraçãoActionPerformed(java.awt.event.ActionEvent evt) {
escolheOperação(’-’);
}private void jBMultiplicaçãoActionPerformed(java.awt.event.ActionEvent evt) {
escolheOperação(’*’);
}private void jBDivisãoActionPerformed(java.awt.event.ActionEvent evt) {
escolheOperação(’/’);
}private void jBClrActionPerformed(java.awt.event.ActionEvent evt) {
num1 = 0;
num2 = 0;
jTVisor.setText(String.valueOf(""));
}private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
copia = jTVisor.getText();
}private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}private void jMenu4MouseClicked(java.awt.event.MouseEvent evt) {
System.exit(0);
}private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
jTVisor.setText(copia);
}/**
-
@param args the command line arguments
/
public static void main(String args[]) {
/- Set the Nimbus look and feel
/
//
/ - 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(JFCalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(JFCalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(JFCalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(JFCalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//
/*
-
Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {@Override
public void run() {
new JFCalc().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jB0;
private javax.swing.JButton jB1;
private javax.swing.JButton jB2;
private javax.swing.JButton jB3;
private javax.swing.JButton jB4;
private javax.swing.JButton jB5;
private javax.swing.JButton jB6;
private javax.swing.JButton jB7;
private javax.swing.JButton jB8;
private javax.swing.JButton jB9;
private javax.swing.JButton jBBsp;
private javax.swing.JButton jBCe;
private javax.swing.JButton jBClr;
private javax.swing.JButton jBDivisão;
private javax.swing.JButton jBIgual;
private javax.swing.JButton jBMultiplicação;
private javax.swing.JButton jBSoma;
private javax.swing.JButton jBSubtração;
private javax.swing.JButton jBVirgula;
private javax.swing.JButton jBmm;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JPanel jPanel1;
private java.awt.TextField jTVisor;
// End of variables declaration[/code]
- Set the Nimbus look and feel
- Creates new form JFCalc
Você está rodando esta classe (shift + F6) ou rodando o projeto (F6)?
Se eu aperto shift+F6 exibe a Tela do Projeto sem Problemas.
Mas quando dou alt+F6 ou apenas F6, mostra compilado com sucesso, porém a tela do projeto não exibe.
Gostaria que assim q eu aperta-se o F6, meu projeto compila-se e fosse exibido de forma funcional, como um programa de verdade.
Pois quando olho tutoriais, o pessoal aperta o F6 e o projeto é compilado e a tela do projeto aparece. Mas no meu isso não acontece. O que estou fazendo de errado??
[quote=Tyeska]Se eu aperto shift+F6 exibe a Tela do Projeto sem Problemas.
Mas quando dou alt+F6 ou apenas F6, mostra compilado com sucesso, porém a tela do projeto não exibe.
Gostaria que assim q eu aperta-se o F6, meu projeto compila-se e fosse exibido de forma funcional, como um programa de verdade.
Pois quando olho tutoriais, o pessoal aperta o F6 e o projeto é compilado e a tela do projeto aparece. Mas no meu isso não acontece. O que estou fazendo de errado??
[/quote]
O que acontece é que o NB cria uma classe principal, que é a classe definida por ele como sendo a main class do projeto.
Logo, ao pressionar F6, você compila e executa o jar gerado, cuja main class é a classe definida pelo NB, que, caso você não tenha alterado, irá possuir um método main vazio.
Encontre essa classe e faça algo como
public static void main(String[] args){
new JFCalc().setVisible(true);
}
Que o problema deve se resolver.
Leeegggallll!!!
Funcionou, muito obrigada. Agora finalmente meus projetos vão rodar com F6 kkkkk.
Valeu por compartilhar sua experiencia, espero que meu problema seja util para mais pessoas.