I want to know how to make a very simple java button that works in console (i'm using crimson editor to do java in class) Im looking for something that when you click it it starts a game.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
First off, you'll want to start with a JFrame, not console:
Then, use Charles' code to help you get started on a JButton.
Then for an action to fire, add a listener, again from Charles' post.
Well in Java you generally create buttons using
Then
But you're going to be more specific about what you mean by "in a console".
If you want to create a user interface with Java, you may want to take a look at Swing or any GUI tool for Java.
As the others said, buttons and consoles are not meant for each other.