以下代码用于在 JAVA 中使用 FTP 上传三个 JPG 图像文件。\n文件已上传并通过“成功”消息进行确认,但文件已损坏。小缩略图文件部分可读(上四分之一)。
\n\n我尝试搜索网络并添加
\n\nsetFileType(FTPClient.BINARY_FILE_TYPE);\n
Run Code Online (Sandbox Code Playgroud)\n\n但问题仍然出现:(
\n\n有人可以看一下并给我提示或建议吗?
\n\n代码:
\n\npackage de.immozukunft.programs;\n\nimport java.io.*;\nimport java.util.Locale;\nimport java.util.ResourceBundle;\n\nimport org.apache.commons.net.ftp.FTPClient;\n\n/**\n * This class enables the ability to connect and trasfer data to the FTP server\n */\n\npublic class FtpUpDown {\n\n static Locale locale = new Locale("de"); // Locale is set to "de" for\n // Germany\n static ResourceBundle r = ResourceBundle.getBundle("Strings", locale); // ResourceBundle\n // for\n // different\n // languages\n // and\n // String\n // Management\n\n // FTP-Connection …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个 Android 应用程序,但无法找出我所犯的错误或错误。我找了4个多小时的错误。
我在使用 SharedPreferences 时遇到以下异常:
E/AndroidRuntime: FATAL EXCEPTION: main
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at android.app.SharedPreferencesImpl.getString(SharedPreferencesImpl.java:235)
at de.immozukunft.quicksteuer.QuickSteuerActivity.updateTextView(QuickSteuerActivity.java:56)
at de.immozukunft.quicksteuer.QuickSteuerActivity.onCreate(QuickSteuerActivity.java:36)
Run Code Online (Sandbox Code Playgroud)
但根据我的理解,我并没有在这方面进行演员阵容。第 36 行是updateTextView()方法的调用。
private void updateTextView() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
int legalForm = Integer.parseInt(prefs.getString("legal_form", "1"));
boolean industrialTax = prefs.getBoolean("industrial_tax", false);
boolean turnoverTax = prefs.getBoolean("turnover_tax", false);
boolean disbursal = prefs.getBoolean("disbursal", false);
String tmp = prefs.getString("capitalownership", "0"); //this is line 56
int capitalOwnership = Integer.parseInt(tmp);
int estIncome = Integer.parseInt(prefs.getString("est_income", "0"));
}
Run Code Online (Sandbox Code Playgroud)
我在 XML 文件中的偏好如下: …
我的登录屏幕有问题.不知怎的,这是不正确的......
所有对象(JLabel,JButton,JTextfield等)未正确显示.它应该是这样的:
只有在我通过拉窗边框调整屏幕尺寸时才会出现.
JFrame包含2个JPanel作为选项卡.这是代码:
Login.java
package de.immozukunft.windows;
import javax.swing.*;
import de.immozukunft.tabs.LoginTab;
import de.immozukunft.tabs.MySQLConnectionTab;
import java.awt.BorderLayout;
import java.util.Locale;
import java.util.ResourceBundle;
public class Login {
/**The Login class implements the LoginTab and the MySQLConnectionTab
* to verify the user access*/
//String management
static Locale locale = new Locale("de");
static ResourceBundle r = ResourceBundle.getBundle("Strings", locale);
JFrame window = new JFrame();
//Constructor
public Login() {
window.setTitle(r.getString("userlogin"));
frame();
}
//Frame method
private void frame() {
window.setSize(400,250);
window.setLocationRelativeTo(null);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setVisible(true);
//Tab-panel
JTabbedPane tabbedPane = new JTabbedPane(); …
Run Code Online (Sandbox Code Playgroud)