这是发生在我身上的新事物。我为我的阿姨做了一个非常简单的计算器,由于某种原因主要的方法不能与JFrame连接。
第1行和第5行有错误的主要代码都说类接口或枚举。
public static void main(String args[]) {
Interface i = new Interface();
i.setVisible(true);
}
第二个代码(Jframe)我删除了样式以及下面的所有内容,因为它是在netbeans中自动生成的。
package kalkulator;
public class Interface extends javax.swing.JFrame {
String vse;
String procenti;
double pro = Double.parseDouble(procenti);
double cel = Double.parseDouble(vse);
public Interface() {
this.vse= celota.getText();
this.procenti = procent.getText();
}
String rezult = String.valueOf(cel*pro);
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){
rezultat.setText(rezult);
}
/**
* @param args the command line arguments
*/
// Variables declaration - do not modify
private javax.swing.JTextField celota;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField procent;
private javax.swing.JTextField rezultat;
// End of variables declaration
}
第二个代码(JFrame)显示没有错误。两者都在同一文件夹Error screen中。我已经很长时间没有编码,所以这可能只是一个非常愚蠢的错误。
答案 0 :(得分:0)
您的/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
struct curl_slist *slist1;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "depth:1");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_URL, "https://www.url.fr/to/webdav/number/folder/");
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
curl_easy_setopt(hnd, CURLOPT_PROXY, "http://proxyurl:80");
curl_easy_setopt(hnd, CURLOPT_PROXYUSERPWD, ":");
curl_easy_setopt(hnd, CURLOPT_PROXYAUTH, (long)CURLAUTH_NTLM);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/7.52.1");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_2TLS);
curl_easy_setopt(hnd, CURLOPT_KEYPASSWD, "tempcertificat.pem:certifPassword");
curl_easy_setopt(hnd, CURLOPT_SSLCERT, "C");
curl_easy_setopt(hnd, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(hnd, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PROPFIND");
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may select to either not use them or implement
them yourself.
CURLOPT_WRITEDATA set to a objectpointer
CURLOPT_INTERLEAVEDATA set to a objectpointer
CURLOPT_WRITEFUNCTION set to a functionpointer
CURLOPT_READDATA set to a objectpointer
CURLOPT_READFUNCTION set to a functionpointer
CURLOPT_SEEKDATA set to a objectpointer
CURLOPT_SEEKFUNCTION set to a functionpointer
CURLOPT_ERRORBUFFER set to a objectpointer
CURLOPT_STDERR set to a objectpointer
CURLOPT_HEADERFUNCTION set to a functionpointer
CURLOPT_HEADERDATA set to a objectpointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
return (int)ret;
}
/**** End of sample code ****/
方法需要一个班级才能入住。
首先,类应该以大写字母开头,因此应该定义它们的main
文件名。因此,将.java
重命名为kalkulator.java
并添加类定义围绕它:
Kalkulator.java