Hallo,
ich schaffe es nicht den Quelltext ohne das es Fehler gibt zu programmieren. Woran diese Fehler liegen erkenne ich nicht. Bei meinem ersten Fehler bei A="Geben Sie ihren "+j+"ten Tipp ab kommt die Nachricht incompatible types required: lotto.Auswertung und found:java.lang.String.
Der Zweite Fehler bei A="Sie haben+Z.getRes etc. lautet die selbe Nachricht wie beim ersten Fehler nur noch `;`expected.
Fehler 3 ist wieder incompatible types und required: lotto.Toto found: java.lang.String. Der Fehler 4 ist connot find symbol symbol: method sort(java.lang.String) location: class java.util.Arrays. Fehler 5 ist incompatible types required: lotto.Toto found: java.lang.String und array required but java.lang.String found.
Ich hoffe ihr könnt mir helfen ich vezweifle an diesen Fehlermeldungen.
Vielen Dank im Vorraus
ich schaffe es nicht den Quelltext ohne das es Fehler gibt zu programmieren. Woran diese Fehler liegen erkenne ich nicht. Bei meinem ersten Fehler bei A="Geben Sie ihren "+j+"ten Tipp ab kommt die Nachricht incompatible types required: lotto.Auswertung und found:java.lang.String.
Der Zweite Fehler bei A="Sie haben+Z.getRes etc. lautet die selbe Nachricht wie beim ersten Fehler nur noch `;`expected.
Fehler 3 ist wieder incompatible types und required: lotto.Toto found: java.lang.String. Der Fehler 4 ist connot find symbol symbol: method sort(java.lang.String) location: class java.util.Arrays. Fehler 5 ist incompatible types required: lotto.Toto found: java.lang.String und array required but java.lang.String found.
Ich hoffe ihr könnt mir helfen ich vezweifle an diesen Fehlermeldungen.
Vielen Dank im Vorraus
Java:
package lotto;
import java.awt.Component;
import java.util.Arrays;
import java.awt.Graphics;
import java.util.*;
import javax.swing.*;
public class Lotto3 extends javax.swing.JDialog {
private int i;
private String j;
/** Creates new form Lotto3 */
public Lotto3(java.awt.Frame parent, boolean modal) {
super(parent, modal);
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() {
P1 = new javax.swing.JOptionPane();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
P1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
P1MouseClicked(evt);
}
});
jButton1.setText("Start");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(67, 67, 67)
.addComponent(P1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(158, 158, 158)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(71, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(P1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(67, 67, 67)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(70, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
public void paintIcon(Component c, Graphics g, int x, int y) {
throw new UnsupportedOperationException("Not supported yet.");
}
public int getIconWidth() {
throw new UnsupportedOperationException("Not supported yet.");
}
public int getIconHeight() {
throw new UnsupportedOperationException("Not supported yet.");
}
Icon ic=new ImageIcon ("C:\\Lotto.jpg");
private void P1MouseClicked(java.awt.event.MouseEvent evt) {
String res,b,m,n;
String []Zahlen;
int j = 0;
int n1=Integer.parseInt(JOptionPane.showInputDialog(P1,"Geben Sie die Gesamtzahl der Kugeln an!","Gesamtanzahl der Kugeln",
P1.INFORMATION_MESSAGE));
Zahlen=new String[n1];
Arrays.fill(Zahlen,"");
int m1=Integer.parseInt(P1.showInputDialog(P1,"Geben Sie die Gesamtzahl der gezogenen Kugeln an!","Gesamtanzahl der gezogenen Kugeln",
P1.INFORMATION_MESSAGE));
Z=new Toto(n1,m1);
int[] tipp = new int[m1];
for (int i=0; i<m1; i++){
int i=i+1;
A="Geben Sie ihren"+j+"ten Tipp ab!";
b=(String)P1.showInputDialog(P1,A,"Wäheln Sie",P1.PLAIN_MESSAGE,ic,Zahlen,Zahlen[0]);
P1.showMessageDialog(P1,"Wählen Sie nocheinmal!");}
A="Sie haben"+Z.getRes()"Richtig!";
int k=Integer.parseInt(P1.showInputDialog(P1,A, "Tippen!",P1.INFORMATION_MESSAGE));
tipp[i]=k;
A= new Auswertung (n1,m1);
Z="Es wurden gezogen";
Arrays.sort(A.getPrice());
for (int i=0, i, i<m1, i++);{
Z=Z+""+A.getPrice()[i];
}
P1.showMessageDialog(P1,Z,"Ziehungsergebnis",P1.PLAIN_MESSAGE);
A="Sie haben"+Z.getRes()+"Richtige";
P1.showMessageDialog(P1,A,"Glückwunsch",P1.PLAIN_MESSAGE);
}
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
Lotto3 dialog = new Lotto3(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
Toto Z;
Auswertung A;
// Variables declaration - do not modify
private javax.swing.JOptionPane P1;
private javax.swing.JButton jButton1;
// End of variables declaration
}
Zuletzt bearbeitet von einem Moderator: