如何在新的类文件中将文件转换为我的代码中的字符串?我现在迷失了,我试图将文件转换为字符串,但是,eclipse一直说它不存在,并且它不会起作用.这是我的代码.
package Mover;
import java.io.*;
public class Mover {
public static void main(String[] args) throws IOException, InterruptedException {
String desktop = FindDesktop.getCurrentUserDesktopPath();
String usb = new File(".").getAbsolutePath();
File TS3S = new File(usb + "/Teamspeak 3");
File TS3D = new File(desktop + "/TS3");
File MinecraftLauncherS = new File(usb + "/Minecraft");
File MinecraftLauncherD = new File(desktop);
File ShortcutS = new File(usb + "/Shortcuts");
File ShortcutD = new File(desktop);
File FrapsS = new File(usb + "/Fraps");
File FrapsD = new File(desktop + "/Fraps"); …Run Code Online (Sandbox Code Playgroud) 我怎么能在我的Jframe中添加更多容器?继承我的代码行,我想在一个窗口中制作一个时钟,其中包含同一个jframe一侧的其他时钟,这是我的代码:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Calendar;
public class CopyOftheclock {
public static void main(String[] args) {
JFrame clock = new TextClockWindow();
clock.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
clock.setVisible(true);
}
}
@SuppressWarnings("serial")
class TextClockWindow extends JFrame {
private JTextField timeField;
public TextClockWindow() {
timeField = new JTextField(7);
timeField.setFont(new Font("sansserif", Font.PLAIN, 48));
Container content = this.getContentPane();
content.setLayout(new FlowLayout());
content.add(timeField);
this.setTitle("Norway");
this.pack();
javax.swing.Timer t = new javax.swing.Timer(1000,
new ActionListener() {
public void actionPerformed(ActionEvent e) {
String a = "";
Calendar now = Calendar.getInstance();
int h …Run Code Online (Sandbox Code Playgroud)