Hello Is it possible to draw in a JPanel what the java console is returning ? have you got a tutorial to follow ? thanks sw
相关问题
- 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 read from the console. To do this use System.setOut(). Use ByteOutputStream, write there and read from their. You will get what your program prints to it system out. Now use either TextArea or JScrollPane to present the text.
The Message Console provides a few more options that might interest you.
I can't remember where I found this, but I have outputted the output stream to a JTextArea held in a JPanel using a class I call TextAreaOutputStream:
I then re-direct the standard output Stream to this object as Alex mentions in his answer above.
Create a subclass of FilterOutputStream to echo everything to a JTextArea.
and replace the standard output: