小编Abr*_*ujo的帖子

将文件转换为字符串

如何在新的类文件中将文件转换为我的代码中的字符串?我现在迷失了,我试图将文件转换为字符串,但是,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)

java string class file

3
推荐指数
1
解决办法
2万
查看次数

向jframe添加更多容器

我怎么能在我的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)

java swing containers clock jframe

1
推荐指数
1
解决办法
2740
查看次数

标签 统计

java ×2

class ×1

clock ×1

containers ×1

file ×1

jframe ×1

string ×1

swing ×1