Imgflip Logo Icon

It's starting off pretty well

It's starting off pretty well | So after like 10 imports or so, I've finally made a window (JFrame) to send messages. There's still a LOT of things to add/fix. But I'll comment some of the code so you see what I mean. It's very basic, but it's working. Take that, school admins. | made w/ Imgflip meme maker
126 views 1 upvote Made by anonymous 3 years ago in MS_memer_group
8 Comments
[deleted] M
1 up, 3y
make sure to add @ mentions
1 up, 3y
wow
1 up, 3y,
1 reply
but how do you use
[deleted]
0 ups, 3y,
1 reply
It's still in it's primitive stage.
I just made this like half an hour ago, so it'll take me a few days to make it work properly.
1 up, 3y
oh cool
[deleted]
0 ups, 3y,
1 reply
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class WindowAccess {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "Welcome, to ########## beta by Asriel_Lalonde.");

JFrame frame = new JFrame("Pester Room");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 400);

JTextArea chatArea = new JTextArea();
chatArea.setEditable(false);
JScrollPane chatScrollPane = new JScrollPane(chatArea);
frame.add(chatScrollPane, BorderLayout.CENTER);

JPanel inputPanel = new JPanel(new BorderLayout());
JTextField inputField = new JTextField();
inputPanel.add(inputField, BorderLayout.CENTER);
JButton sendButton = new JButton("Send");
inputPanel.add(sendButton, BorderLayout.EAST);
frame.add(inputPanel, BorderLayout.SOUTH);

sendButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String message = inputField.getText();
if (!message.isEmpty()) {
chatArea.append(message + "\n");
inputField.setText("");
}
}
});

frame.setVisible(true);
}
}
1 up, 3y,
1 reply
Did you just comment the whole code infront of our ass?
[deleted]
0 ups, 3y
This is just the code to make the mainframe.
Not the entire code, silly.
Created with the Imgflip Meme Generator
IMAGE DESCRIPTION:
So after like 10 imports or so, I've finally made a window (JFrame) to send messages. There's still a LOT of things to add/fix. But I'll comment some of the code so you see what I mean. It's very basic, but it's working. Take that, school admins.