Click here to Skip to main content
15,892,674 members
Home / Discussions / Java
   

Java

 
AnswerRe: Is it a bug of featuer Pin
TorstenH.18-Aug-12 3:22
TorstenH.18-Aug-12 3:22 
AnswerRe: Is it a bug or featuere Pin
Gowtham Gutha15-Nov-12 7:25
Gowtham Gutha15-Nov-12 7:25 
Questionproblem while updating a file Pin
Namdeo Badhe17-Aug-12 7:07
Namdeo Badhe17-Aug-12 7:07 
Answerdouble post Pin
TorstenH.17-Aug-12 9:00
TorstenH.17-Aug-12 9:00 
Generalproblem while updating a text file in java Pin
Namdeo Badhe17-Aug-12 6:45
Namdeo Badhe17-Aug-12 6:45 
GeneralRe: problem while updating a text file in java Pin
Richard MacCutchan17-Aug-12 6:59
mveRichard MacCutchan17-Aug-12 6:59 
QuestionMessage Removed Pin
16-Aug-12 6:53
Member 936232116-Aug-12 6:53 
QuestionSwing Pin
Joshua Waring15-Aug-12 23:53
Joshua Waring15-Aug-12 23:53 
First lets give some context, I've just created a client and server but they don't work without using console So I've decided to create a GUI on top they'll communicate though the Stack, but that's all for a later date, right now I get a error on the Even listener which says that the JTextField is empty upon .getText() even though it's not. I've looked though it, but since I'm quite new to the whole Swing field, it's a challenge for me to fix the problem. It really is a simple GUI.

Java
import java.awt.Button;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Stack;

import javax.swing.*;
public class GUI extends JFrame implements ActionListener{
	Stack<String> incoming = null;
	Stack<String> outgoing = null;
	JTextField input;
	JTextArea output;
	Button button;
	public GUI(){
		
		setTitle("Satire v1.0.1");
		setSize(320,360);
		setLocationRelativeTo(null);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		JPanel panel = new JPanel();
		panel.setLayout(null);
		
		output = new JTextArea();
		output.setBounds(0, 0, 300, 300);
		output.setEditable(false);
		
		input = new JTextField();
		input.setBounds(0, 300, 260, 20);
		
		button = new Button("SEND");
		button.setBounds(250, 300, 50, 20);
		button.addActionListener(this);
		
		getContentPane().add(panel);
		panel.add(button);
		panel.add(input);
		panel.add(output);
	}
	public void actionPerformed(ActionEvent e) { 
		GUI gui = new GUI();
		try{
			String out = gui.input.getText();
			gui.input.selectAll();
			outgoing.add(out);
		}catch(NullPointerException e3){}
		gui.output.append(outgoing.pop());
	}
	
	public static void main(String[] args){
		 SwingUtilities.invokeLater(new Runnable() {
			 public void run(){
				 GUI cGUI = new GUI();
				 cGUI.setVisible(true);
			 }
		 });
	}
}

AnswerRe: Swing Pin
pasztorpisti16-Aug-12 0:28
pasztorpisti16-Aug-12 0:28 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 0:45
Joshua Waring16-Aug-12 0:45 
AnswerRe: Swing Pin
pasztorpisti16-Aug-12 0:55
pasztorpisti16-Aug-12 0:55 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 1:22
Joshua Waring16-Aug-12 1:22 
GeneralRe: Swing Pin
pasztorpisti16-Aug-12 1:50
pasztorpisti16-Aug-12 1:50 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 2:02
Joshua Waring16-Aug-12 2:02 
GeneralRe: Swing Pin
pasztorpisti16-Aug-12 2:12
pasztorpisti16-Aug-12 2:12 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 3:57
Joshua Waring16-Aug-12 3:57 
GeneralRe: Swing Pin
pasztorpisti16-Aug-12 4:08
pasztorpisti16-Aug-12 4:08 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 4:11
Joshua Waring16-Aug-12 4:11 
SuggestionRe: Swing Pin
pasztorpisti16-Aug-12 4:24
pasztorpisti16-Aug-12 4:24 
GeneralRe: Swing Pin
Joshua Waring16-Aug-12 2:13
Joshua Waring16-Aug-12 2:13 
SuggestionRe: Swing Pin
pasztorpisti16-Aug-12 1:00
pasztorpisti16-Aug-12 1:00 
AnswerRe: Swing Pin
Gowtham Gutha15-Nov-12 7:31
Gowtham Gutha15-Nov-12 7:31 
QuestionMutual SSL Setup Pin
balarayala12-Aug-12 23:16
balarayala12-Aug-12 23:16 
AnswerRe: Mutual SSL Setup Pin
Richard MacCutchan13-Aug-12 0:42
mveRichard MacCutchan13-Aug-12 0:42 
GeneralRe: Mutual SSL Setup Pin
balarayala13-Aug-12 16:32
balarayala13-Aug-12 16:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.