Hey Leute,
ich bin hier neu im Forum und auch relativ neu bei Java. Ich kann zwar PHP programmieren, aber zurzeit verusche ich mich mal in Java^^
Ich würde behaupten die Basics kann ich so einigermaßen und wenn was fehlt les ichs nach^^
Derzeit arbeite ich mit NetBeans.
Zu meinem Problem, ich habe ein neues JFrame Formular erstellt. Der Code davon sieht wie folgt aus (ist nat. mit dem GUI Builder gemacht):
Wenn ich Umschalten + F6 drücke wird das Fenster auch angezeigt. Nun habe ich in meinem kleinen Projekt die Main Klasse:
aber wenn ich hier jetzt das komplette Projekt ausführen möchte wirds auch ausgeführt, aber es wird einfach kein Frame angezeigt und ich weiß einfach nicht woran das liegt. Vielleicht kann mir da jemand helfen und erklären worans liegt.
Grüße
Daniel
ich bin hier neu im Forum und auch relativ neu bei Java. Ich kann zwar PHP programmieren, aber zurzeit verusche ich mich mal in Java^^
Ich würde behaupten die Basics kann ich so einigermaßen und wenn was fehlt les ichs nach^^
Derzeit arbeite ich mit NetBeans.
Zu meinem Problem, ich habe ein neues JFrame Formular erstellt. Der Code davon sieht wie folgt aus (ist nat. mit dem GUI Builder gemacht):
Java:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* disclaimer.java
*
* Created on 28.04.2010, 16:36:17
*/
package template;
/**
*
* @author Daniel
*/
public class Disclaimer extends javax.swing.JFrame {
/** Creates new form disclaimer */
public Disclaimer() {
initComponents();
}
/** 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() {
jScrollPane1 = new javax.swing.JScrollPane();
jEditorPane1 = new javax.swing.JEditorPane();
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jEditorPane1.setEditable(false);
jEditorPane1.setText("LALA");
jScrollPane1.setViewportView(jEditorPane1);
jLabel1.setText("Ich habe den Disclaimer gelesen und akzeptiert.");
jButton1.setText("Fortfahren");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(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)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
.addComponent(jButton1))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
System.out.print("Weiter gehts!");
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Disclaimer().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JEditorPane jEditorPane1;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration
}
Wenn ich Umschalten + F6 drücke wird das Fenster auch angezeigt. Nun habe ich in meinem kleinen Projekt die Main Klasse:
Java:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package core;
import template.*;
/**
*
* @author Daniel
*/
public class Main {
public Main() {
/** Display Disclaimer **/
Disclaimer form = new Disclaimer();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Main core = new Main();
}
}
aber wenn ich hier jetzt das komplette Projekt ausführen möchte wirds auch ausgeführt, aber es wird einfach kein Frame angezeigt und ich weiß einfach nicht woran das liegt. Vielleicht kann mir da jemand helfen und erklären worans liegt.
Grüße
Daniel