🌐
Replit
replit.com › @replit › Java-Swing
Java (Swing) - Replit
Java is a popular object-oriented language. Swing is a graphical user interface (GUI) toolkit for creating interactive applications in Java.
🌐
YouTube
youtube.com › watch
replit Java Swing GUI example - YouTube
Using the repl.it online IDE with java swing to make a GUI interfaceTable of Contents:01:19 - Popup window03:47 - Basic JFrame05:02 - Custom JFrame class07:4...
Published   September 16, 2019
🌐
Replit
replit.com › @BerylHoffman › Java-Swing-Turtle
Java-Swing-Turtle - Replit
Run Java (Swing) code live in your browser. Write and run code in 50+ languages online with Replit, a powerful IDE, compiler, & interpreter.
🌐
Replit
replit.com › talk › learn › Java-Swing-Tutorial-Day-2-LEARN-HOW-TO-MAKE-A-GUI › 46109
Java Swing Tutorial Day 2. LEARN HOW TO MAKE A GUI
Run code live in your browser. Write and run code in 50+ languages online with Replit, a powerful IDE, compiler, & interpreter.
🌐
YouTube
youtube.com › watch
Repl.it: Embedding Images in Java Swing - YouTube
This video shows how to upload and use image files in Repl.it and how to create a framework for showing these images in Java Swing.
Published   February 8, 2021
🌐
Stack Overflow
stackoverflow.com › questions › 65321407 › why-does-my-repl-java-swing-application-doesnt-work
Why does my repl java swing application doesn't work - Stack Overflow
I've created a java swing repl program. You can check it out at this link: https://repl.it/@Tomervx/MazeGame#Main.java It worked pretty well before, but for some reason when I try to run it now, it...
🌐
Replit
replit.com › community › javaswing
Community - Replit
Remote Desktop Manager (Java RMI) (ControlWiz)A Java Swing Application using RMI (Remote Method Invocation) to Connect two Machines via the network. Check out the Github page for accurate output images and code: https://github.com/04xRaynal/RemoteDesktopManagerJavaRMI--Control_Wiz--.git ... heewoonkim2020 The Repl did not respond after waking up, this is a Replit ...
🌐
Replit
replit.com › @BerylHoffman › Java-Swing-Input-Form
Java-Swing-Input-Form - Replit
Run Java code live in your browser. Write and run code in 50+ languages online with Replit, a powerful IDE, compiler, & interpreter.
🌐
Replit
replit.com › template › java-swing
Java (Swing) Template - Online Compiler - Replit - Replit
Java (Swing) Online Compiler and IDE. Run code live in your browser. Write and run code in 50+ languages online with Replit, the collaborative browser based IDE.
Find elsewhere
🌐
replit
staging.replit.com › languages › java_swing
Java Swing Online Compiler & Interpreter - Replit
Write and run Java Swing code using our Java Swing online compiler & interpreter. You can build, share, and host applications right from your browser!
🌐
Reddit
reddit.com › r/replit › repl.it alternative: java swing with codespace
r/replit on Reddit: Repl.it alternative: Java swing with codespace
September 15, 2023 - This is a community-run subreddit and not officially associated with Replit. For Replit's official help and feedback channel, visit ask.replit.com. ... I made a tutorial to get Java Swing with Graphics working for my students and other teachers as a desperately needed alternative to repl.it .
🌐
Replit
replit.com › talk › learn › HOW-TO-MAKE-A-GUI-DAY-3-or-JAVA-SWING-or-CROSS-PLATFORM › 46985
HOW TO MAKE A GUI DAY 3 || JAVA SWING || CROSS ...
Run code live in your browser. Write and run code in 50+ languages online with Replit, a powerful IDE, compiler, & interpreter.
🌐
Replit
replit.com › talk › learn › How-to-load-HTML-in-a-Java-Swing-Project › 48218
How to load HTML in a Java Swing Project
Run code live in your browser. Write and run code in 50+ languages online with Replit, a powerful IDE, compiler, & interpreter.
Top answer
1 of 2
1

Use System.in for your input and System.out for the output like in this example:

  • https://repl.it/@KarimBonnaa/Java-Calculator-App

You can't use the swing GUI classes: JTextField or JTextArea in headless java repl.it.

As Matt mentioned you can use the special https://repl.it/languages/java_swing

This will at least compile but misses the file of course:

import java.io.File;
import java.util.Scanner;

import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class Main extends JFrame {

    // Typing Area:
    private JTextField txtEnter = new JTextField();

    // Chat Area:
    private JTextArea txtChat = new JTextArea();

    public Main(String name) {
        // Frame Attributes:
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setSize(600, 600);
        this.setVisible(true);
        this.setResizable(false);
        this.setLayout(null);
        this.setTitle("name");

        // txtChat Attributes:
        txtChat.setLocation(15, 5);
        txtChat.setSize(560, 510);

        this.add(txtChat);

        try {
            File f = new File(name = ".txt");
            Scanner scan = new Scanner(f);
            txtChat.append("File name: " + f.getName() + "\n");
            txtChat.append("File Size in Bytes: " + f.length() + " bytes\n");
            txtChat.append("\nFile Contents:\n\n");

            while (scan.hasNext()) {
                txtChat.append(scan.nextLine() + "\n");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        // creating instance of JFrame
        Main f = new Main("test");

        f.setSize(400, 500);
        f.setLayout(null);
        // make the frame visible
        f.setVisible(true);
    }
}
2 of 2
0

Small errors:

  • You forgot: scan.close(); at the end.
  • txtChat should not be static but a field of Window.

Somewhere there probably is:

public static void main(String[] args) {
    SwingUtilities.invokeLater(() -> new Window("x.txt").setVisible(true));
}

The error? Maybe the repl is headless (=only console)?

Maybe you run in a Docker container or such. Which would be my first guess.

🌐
Reddit
reddit.com › r/cseducation › repl.it alternative: java swing with github codespaces
r/CSEducation on Reddit: Repl.it alternative: Java swing with GitHub Codespaces
March 24, 2024 -

Due to the limitation recently imposed by repl.it, I had to find another alternative for a web interface developing Java Swing applications in my class. Many of my students only have Chromebooks. I made a tutorial to get a working Java Swing development environment for my students using GitHub CodeSpaces. Thought, I'll share this. I hope this helps! https://apps.mvhs.io/resources/codespaces/

🌐
Replit
ask.replit.com › t › what-should-i-use-to-learn-java-swing › 47583
What should I use to learn Java (Swing)?
XGet updates on feature launches, events, and other Replit news. EventsJoin us for virtual and in-person events, hack nights, workshops and more. YouTubeTune into livestreams, learn with tutorials, and enjoy the show. AI PodcastHear from leading experts about how AI is shaping the future of code ... Intro to PostgreSQLAccess all the power of a modern, serverless relational database management system in a couple clicks. Intro to JavaScriptThe basics of JavaScript, an essential language for web development.
🌐
YouTube
youtube.com › watch
How to Setup and Run from a Replit Java Workspace - YouTube
How to Setup and Run from a Replit Java Workspace
Published   July 1, 2020
Views   28K