Indique moi un truc en java si c'est possible
ylleria
Messages postés
25
Date d'inscription
Statut
Membre
Dernière intervention
-
mhd -
mhd -
public void button_18_actionPerformed(ActionEvent e) {
int j;
String e_1=textfield_1.getText();
String n=scrollpane_3.getText();
String textev=scrollpane_6.getText();
int E=Integer.parseInt(e_1);
int N=Integer.parseInt(n);
int taillev=textev.codePointCount(0, textev.length());
String [] tabl=new String[taillev];
String []tabll=new String[taillev];
int num=0;
int jj=taillev-1;
for(j=0;j<taillev-1;j=j+1){
char elem=textev.charAt(j);
String ee=""+elem;
tabl[j]=ee;
}
int po = 0;
for(j=jj;j>=0;j=j-N-1){
int co=1;
int sto=0;
int i=0;
if(j-N-2>=0){
sto=j-N+2;
}else{
sto=0;
}
for( i=j;i>sto-1;j=j-1){
po=po+(Integer.parseInt(tabl[i])*co);
co=co*10;
}
tabll[jj]=Integer.toString(po);
jj=jj-1;
num=num+1;
}
po=0;
for(int i=taillev-1;i>taillev-num;i=i-1){
int r=1;
po=Integer.parseInt(tabll[i]);
for(int l=1;l<=E;i=i+1){
r=po*r;
}
scrollpane_2.append(""+po%N);
}
}
quand j'execute sa m'affiche ça:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at RSA.button_18_actionPerformed(RSA.java:785)
at RSA$RSA_button_18_actionAdapter.actionPerformed(RSA.java:814)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
aidez moi SVP
int j;
String e_1=textfield_1.getText();
String n=scrollpane_3.getText();
String textev=scrollpane_6.getText();
int E=Integer.parseInt(e_1);
int N=Integer.parseInt(n);
int taillev=textev.codePointCount(0, textev.length());
String [] tabl=new String[taillev];
String []tabll=new String[taillev];
int num=0;
int jj=taillev-1;
for(j=0;j<taillev-1;j=j+1){
char elem=textev.charAt(j);
String ee=""+elem;
tabl[j]=ee;
}
int po = 0;
for(j=jj;j>=0;j=j-N-1){
int co=1;
int sto=0;
int i=0;
if(j-N-2>=0){
sto=j-N+2;
}else{
sto=0;
}
for( i=j;i>sto-1;j=j-1){
po=po+(Integer.parseInt(tabl[i])*co);
co=co*10;
}
tabll[jj]=Integer.toString(po);
jj=jj-1;
num=num+1;
}
po=0;
for(int i=taillev-1;i>taillev-num;i=i-1){
int r=1;
po=Integer.parseInt(tabll[i]);
for(int l=1;l<=E;i=i+1){
r=po*r;
}
scrollpane_2.append(""+po%N);
}
}
quand j'execute sa m'affiche ça:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at RSA.button_18_actionPerformed(RSA.java:785)
at RSA$RSA_button_18_actionAdapter.actionPerformed(RSA.java:814)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
aidez moi SVP
A voir également:
- Indique moi un truc en java si c'est possible
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages
- Waptrick java voiture - Télécharger - Jeux vidéo
6 réponses
pas trop de gestion d'erreurs dans ce code là.
L'erreur, mal traduite en français, signifie que tu as une erreur de format de nombre, sûrement due à ta fonction parseInt. Je suppose que tu dois convertir une chaine de caractère qui ne se "parse" pas. (Comme du texte).
Avant de faire ton parseInt, tu devrais essayer de mettre un bloc try catch ou de vérifier si la zone de texte ne contient que des caractères numériques.
L'erreur, mal traduite en français, signifie que tu as une erreur de format de nombre, sûrement due à ta fonction parseInt. Je suppose que tu dois convertir une chaine de caractère qui ne se "parse" pas. (Comme du texte).
Avant de faire ton parseInt, tu devrais essayer de mettre un bloc try catch ou de vérifier si la zone de texte ne contient que des caractères numériques.
mais c'esl quelle ne contien que des caractaire numerique elle ne dois contenir que sa et je veux les crypter avec le system RSA
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Un détail que je fais d'habitude, quand je fais des getText(), je rajoute un toString() après, pour être certains qu'il est vraiment en format string
ex :
ton code semble étrangement correct, tu devrais quand même utiliser un bloc try/catch pour gérer les erreurs qui pourraient survenir.
Sinon, je ne vois pas trop la cause de l'erreur. Est-ce qu'il est incrit quelque part la ligne ou l'erreur arrive ?
ex :
String e_1=textfield_1.getText().toString();
ton code semble étrangement correct, tu devrais quand même utiliser un bloc try/catch pour gérer les erreurs qui pourraient survenir.
Sinon, je ne vois pas trop la cause de l'erreur. Est-ce qu'il est incrit quelque part la ligne ou l'erreur arrive ?
c'est bon j'ai pus corriger voila mais.................quand je clixk sur le button18 l'application block c quoi
le probleme encore !!!!!!!!!!!!!!!!!!!!au mon dieu aidez moi
public void button_18_actionPerformed(ActionEvent e) {
try{int j;
String e_1=textfield_1.getText().toString();
String n=scrollpane_3.getText().toString();
String textev=scrollpane_6.getText().toString();
int E=Integer.parseInt(e_1);
int N=Integer.parseInt(n);
int taillev=textev.length();
String [] tabl=new String[taillev];
int jj=taillev-1;
for(j=0;j<taillev;j=j+1){
char elem=textev.charAt(j);
String ee=""+elem;
tabl[j]=ee;
}
for(j=jj;j>=0;j=j-N+1){
int co=1;
int po = 0;
int r=1;
int sto=0;
int i=0;
if(j-N+2>=0){
sto=j-N+2;
}else{
sto=0;
}
for( i=j;i>=sto;j=j-1){
po=po+(Integer.parseInt(tabl[i])*co);
co=co*10;
}
for(int l=1;l<=E;i=i+1){
r=po*r;
}
int yr=po%N;
scrollpane_2.append(Integer.toString(yr));
}
}catch (Exception IOEP) {
javax.swing.JOptionPane.showConfirmDialog(null,
"Erreur !!",
"Entrée incorrecte.",
javax.swing.JOptionPane.PLAIN_MESSAGE);
return;
}
}
le probleme encore !!!!!!!!!!!!!!!!!!!!au mon dieu aidez moi
public void button_18_actionPerformed(ActionEvent e) {
try{int j;
String e_1=textfield_1.getText().toString();
String n=scrollpane_3.getText().toString();
String textev=scrollpane_6.getText().toString();
int E=Integer.parseInt(e_1);
int N=Integer.parseInt(n);
int taillev=textev.length();
String [] tabl=new String[taillev];
int jj=taillev-1;
for(j=0;j<taillev;j=j+1){
char elem=textev.charAt(j);
String ee=""+elem;
tabl[j]=ee;
}
for(j=jj;j>=0;j=j-N+1){
int co=1;
int po = 0;
int r=1;
int sto=0;
int i=0;
if(j-N+2>=0){
sto=j-N+2;
}else{
sto=0;
}
for( i=j;i>=sto;j=j-1){
po=po+(Integer.parseInt(tabl[i])*co);
co=co*10;
}
for(int l=1;l<=E;i=i+1){
r=po*r;
}
int yr=po%N;
scrollpane_2.append(Integer.toString(yr));
}
}catch (Exception IOEP) {
javax.swing.JOptionPane.showConfirmDialog(null,
"Erreur !!",
"Entrée incorrecte.",
javax.swing.JOptionPane.PLAIN_MESSAGE);
return;
}
}