Results 1 to 2 of 2
- 10-24-2011, 08:49 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 2
- Rep Power
- 0
Game In progress need help with Textfield Gui
A bit new to the forums here, I thank you for your help in advance. Ok, so I have a game already a private project of mine. So far I have 1k lines of code and I'd like to redirect all the System.out lines to a gui application that i've made(its not perfect just a test) A) how would I have my current classes with output of System.out.println() output methods to a gui object created in the main engine program? Here is an example of a simple gui I made. B) Is there an alternate way or more logical one that I'm missing?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ArenaOutputGui extends JFrame{
String i="", o="";
JTextArea textarea;
JPanel panel;
public ArenaOutputGui(){
}
protected ArenaOutputGui(String in, String out){
super("game");
i=in;
o=out;
setSize(430,300);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setLayout(new FlowLayout());
textarea = new JTextArea();
panel= new JPanel();
panel.add(textarea);
add(panel);
setVisible(true);
}
public void guiOut(String i){
textarea.append(i);
}
}
- 10-25-2011, 09:32 AM #2
Member
- Join Date
- Oct 2011
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Progress bar
By Milanek in forum New To JavaReplies: 0Last Post: 10-11-2011, 04:41 PM -
Java Progress bar
By myka in forum Advanced JavaReplies: 3Last Post: 05-08-2010, 07:16 PM -
trying to use progress bar for the first time.
By IYIaster in forum New To JavaReplies: 19Last Post: 07-26-2009, 03:59 AM -
How to use Progress bar
By LankanSniper in forum AWT / SwingReplies: 3Last Post: 03-25-2009, 10:44 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks