basically, in my 'TeacherServer class i run the typical Frame.setVisible(true) method as is implemented many times in my program'
public static void Listen() throws IOException, SQLException
{
//Creates a server socket to listen to the DutyTeacher
ServerSocket mySS = new ServerSocket(5001);
Socket ss_accept = mySS.accept();
BufferedReader ss_BF = new BufferedReader(new InputStreamReader(ss_accept.getInputStream()));
String Attending = ss_BF.readLine();
//Checks content of Duty Messafe
if(Attending.contentEquals("Attending"))
{
//If they leave the box blank, they are attending, open JoptionPane
JOptionPane.showMessageDialog(null, "The Duty Teacher is attending");
mySS.close();
ss_accept.close();
ss_BF.close();
System.exit(1);
}else
//If the box is full a conversation is started, opens conversation box
{if(Attending.contentEquals("Conversation"))
{
new ConversationTeacher().setVisible(true); <--------------------------------------------------
mySS.close();
ss_accept.close();
ss_BF.close();
Listen();
}else{
//If neither of the others, it is a new convo message, conversation updated
ConversationTeacher.UpdateConversation();
mySS.close();
ss_accept.close();
ss_BF.close();
Listen();
}}
}
however i simply get a frame with a blank interior. it runs fine if i run the frame on it's own, but won't open from this teacher server class.
public class ConversationTeacher extends javax.swing.JFrame {
/** Creates new form Conversation */
public ConversationTeacher() throws SQLException {
initComponents();
//Sets the conversation box with the first message from the duty teacher
ConversationConversation.setText("Hey");
}
ConversationConversation is a text field
Thanks in advance
Ben
Edit: ConversationConversation is being set to hey but would usually search a sql server database for the conversation details.
Any comments on my general code structure etc is also much appreciated :c-^_^:


Sign In
Create Account

Back to top









