Frames



Can anyone help me please. I'm trying to set up a frame which will have two
buttons and a welcom message. Its the beginnings of a basic client server
login / registration system. For some reason though, one of the buttons I've
added onto the frame seems to expand to the size of the frame itself. The
code is below, any help would be great.

package TMA03Client;


import java.awt.*;
import com.borland.jbcl.layout.*;
import java.io.*;
import java.net.*;
import java.awt.event.*;
import java.util.*;
import java.security.*;
import blowfish.*;

public class Client extends Frame {

private Frame mainPage = new Frame();
private Frame registerPage = new Frame();
private Frame loginPage = new Frame();

private Label introText = new Label();

private TextField fullName = new TextField();
private TextField userAddress = new TextField();
private TextField userTelephone = new TextField();
private TextField userLogin = new TextField();
private TextField userPassword = new TextField();
private TextField userConfirm = new TextField();
private TextField userName = new TextField();
private TextField logPassword = new TextField();

private Button registerButton = new Button();
private Button loginButton = new Button();
private Button sumbitRegister = new Button();
private Button sumbitLogin = new Button();

private int totalBuys = 0;

private Socket s = null;
private InputStream is = null;
private OutputStream os = null;
private PrintWriter pw = null;
private BufferedReader bf = null;
private ClientCommandSet cSet = null;
private ClientResponseSet rSet = null;

public Client() {
try {
jbInit();
setup();
} catch (Exception e) {
e.printStackTrace();
}
}

private void jbInit() throws Exception {
registerButton.setLabel("Register Details");
registerButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e) {
registerButton_actionPerformed(e);
}
});

loginButton.setLabel("Login");
loginButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
loginButton_actionPerformed(e);
}
});

mainPage.g
introText.setText("Welcome to the OU TMA03 System");
introText.setSize(100,100);
introText.setLocation(0,0);
mainPage.add(registerButton);
registerButton.setSize(100,100);
registerButton.setLocation(100,100);
mainPage.add(loginButton);
loginButton.setSize(100,100);
loginButton.setLocation(100,100);
mainPage.setSize(500,500);
mainPage.setLocation(100,100);
mainPage.setVisible(true);
mainPage.setResizable(true);
registerPage.setVisible(false);
loginPage.setVisible(false);
mainPage.pack();


}



public void setup() {
try {
s = new Socket("127.0.0.1", 3000);
is = s.getInputStream();
os = s.getOutputStream();
pw = new PrintWriter(os, true);

bf = new BufferedReader
(new InputStreamReader(is));
cSet = new ClientCommandSet(pw);
} catch (Exception e) {
System.out.println("Trouble contacting the server " + e);
}
}

void loginButton_actionPerformed(ActionEvent e) {

if (cSet != null) {
cSet.loginCommand();
}
try {

pw.close();
bf.close();
is.close();
os.close();
s.close();
} catch (Exception ex) {};
System.exit(0);
}

void registerButton_actionPerformed(ActionEvent e) {

if (cSet != null) {
cSet.registerCommand();
}
try {

pw.close();
bf.close();
is.close();
os.close();
s.close();
} catch (Exception ex) {};
System.exit(0);
}

public static void main(String[] args){

Client cl = new Client();
}
}


--
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-setup/200509/1
.



Relevant Pages

  • Tom Millers Skeletal Animation Problems, Please Help
    ... I know the mesh viewer works from DirectX SDK, ... private AnimationRootFrame rootFrame; ... private void CreateAnimation ... /// Draw a frame and all child and sibling frames ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: NonStatic erorr
    ... public void PrintName() ... private void button1_Click ... So for example you need to expose it from inside the Frame1 class ... class Frame1: Frame ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: NonStatic erorr
    ... private void button1_Click ... public dialog(config myConfigs) ... So for example you need to expose it from inside the Frame1 class ... class Frame1: Frame ...
    (microsoft.public.dotnet.languages.csharp)
  • Problem while resizing JInternalFrame Modal + Solution to get Modal Floating Component
    ... Here is teh code I made to get Floating Modal Components on a Frame, ... private JFrame frame; ... * @param desiredLocation is the prefered Location on this container ... (Component c,Component origin,Point delta) ...
    (comp.lang.java.gui)
  • Re: Test Driven Development Sample
    ... > knows how many rolls it uses as scoring rolls (from the instance ... The previous impl logic computed a total or per frame score on a throw ...
    (comp.object)