Java.awt.Container.add(Container.java:345) how can i handle this

dear all,
i want to design an outlook for a chat applet. but this seems to tough as i am getting a run time error
my code is:
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import javax.swing.*;
* the import that are required for this class
public class outer extends Frame //implements ActionListener, Runnable
private TextField txtusername,txtpassword,txtroomname;
private Label lblusername,lblpassword,lblroomname,lbllistofrooms;
Button okBtn,exitBut;
Color backColor=null,btnBackClr=null,btnForeClr=null;
String[] roomsavailable = {" one ", " two ", " three", " four"};
private JList rooms = new JList(roomsavailable);
/** the costructor*/
public outer()
{ // super(st);
backColor=new Color(200,200,255);
btnBackClr=new Color(225,240,255);
btnForeClr=new Color(205,205,205);
setBackground(backColor);
setLayout(null);
lblusername = new Label("Username");
lblusername.reshape(insets().left+5,insets().top+10,60,20);
add(lblusername);
txtusername=new TextField();
txtusername.reshape(insets().left+75,insets().top+10,60,20);
add(txtusername);
lblpassword = new Label("Password");
lblpassword.reshape(insets().left+5,insets().top+30,60,20);
add(lblpassword);
txtpassword=new TextField();
txtpassword.reshape(insets().left+75,insets().top+30,60,20);
add(txtpassword);
lblroomname = new Label("Select Room");
lblroomname.reshape(insets().left+5,insets().top+50,60,20);
add(lblroomname);
txtroomname=new TextField();
txtroomname.reshape(insets().left+75,insets().top+50,60,20);
add(txtroomname);
okBtn=new Button("Login");
okBtn.reshape(insets().left+25,insets().top+80,60,20);
add(okBtn);
// okBtn.addActionListener(this);
exitBut=new Button("EXIT");
exitBut.reshape(insets().left+50,insets().top+80,60,20);
add(exitBut);
// exitBut.addActionListener(this);
public static void main(String[] args)
// Create a JFrame
JFrame frame = new JFrame("client side");
// Create a outer class object
outer outerobj = new outer();
// Add the outer to the JFrame
frame.getContentPane().add(outerobj, BorderLayout.WEST);
// Set Jframe size
frame.setSize(800, 400);
//set resizable true
frame.setResizable(true);
// Set JFrame to visible
frame.setVisible(true);
// set the close operation so that the Application terminates when closed
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
when i compile it it compiles but gives run time error like this
RUN TIME error:
Exception in thread "main" java.lang.IllegalArgumentException: adding a window
to a container
at java.awt.Container.addImpl(Container.java:434)
at java.awt.Container.add(Container.java:345)
at outer.main(outer.java:75)
Press any key to continue...
i know erroe in this line
frame.getContentPane().add(outerobj, BorderLayout.WEST);
but how shall i add to get the proper layout by getting benifit of insets method
reply soon
please

You can't add a frame to a frame.
Try chaing the class definition from
public class outer extends Frameto
public class outer extends PanelPlease note to format your code (you'll get a faster response) use [ code]
Object names should always start with a capital letter. outer --> Outer

Similar Messages

  • We have a requirement to print the w2 forms for employees using java application, how can i implement this. Please give some suggestion.

    We have a requirement to print the w2 forms for employees using java application, how can i implement this. Please give some suggestion.

    Anyone any ideas to help please?

  • I am using Numbers on my iPhone5 and cannot get the app to do a simple (SUM) calculation.  It shows the formula correctly in the cell, but all I get for my long list of numbers to add is 0.  How can I get this to work?

    I am using Numbers on my iPhone5 and cannot get the app to do a simple (SUM) calculation.  It shows the formula correctly in the cell, but all I get for my long list of numbers to add is 0.  How can I get this to work?

    Oaky, at least we got that far.  Next step is to determine if all those "numbers" are really numbers.  Changing the format to "number" doesn't necessarily change the string to a number. The string has to be in the form of a number.  Some may appear to you and me as numbers but will not turn into "numbers" when you change the formatting from Text to Number. Unless you've manually formatted the cells to be right justified, one way to tell if it is text or a number is the justification. Text will be justified to the left, numbers will be justified to the right.
    Here are some that will remain as strings:
    +123
    123 with a space after it.
    .123

  • I want to rent an unit For Items How Can I Handle This cycle ??

    i want to rent an unit For Items How Can I Handle This Cycle ??

    If you type :
    <p>some text here <img src="some_image.jpg">and more text here</p>
    then it will be displayed as in :
    some text here
    <some_image.jpg>
    and more text here
    It splits all the sentence !.. no need to give you an URL example... it's logic ! please try...

  • I don't have a user acount password but need to delete it. How can I handle this?

    I don't have a user acount password but need to delete it.
    How can I do this?

    You can't delete something that does not exist.

  • My brother owned my MacBook before me. So his name and email add appears everywhere. How can I fix this ?

    I can´t download anything and my Apple account is not bound to my MacBook but my brothers Apple account is! Again, how can I fix it ?

    MBP = Macbook Pro 
    Care to share which OS you are using?  Or which one was pre-installed when purchased? 
    =============== 
    Preparing an old Mac for sale 
    http://www.thesafemac.com/how-to-prepare-your-mac-for-saleHow to prepare your Mac for sale
    Clicky click--—> Erasing disks securely 
    ================
    Start up from your install disc, go to Disk Utility and select the disk and click erase - to securely erase data click Security Options and Erase Free Space which will entirely wipe your disk, overwriting it with zeros so that no data is recoverable.
    See KB Article:  http://support.apple.com/kb/PH10727 OS X Mountain Lion: Restore your computer’s software
    http://support.apple.com/kb/ph11273 OS X Mountain Lion: Erase and reinstall OS X
    http://support.apple.com/kb/PH6817 Mac OS X 10.6: Restoring your computer’s software
    http://support.apple.com/kb/PH3840 OS X Lion: Restore your computer’s software

  • Multiple where lexcial parameters (how can i handle this situation?)

    hi, I am new to reports can someone help me to solve my problem how can i use multiple lexical parameters for WHERE clause, i am using sample OE (Order Entry) schema
    User Parameters
    EID_FROM
    EID_TO
    EID_WHERE_CLAUSE
    SAL_FROM
    SAL_TO
    SAL_WHERE_CLAUSE
    QUERY
    select EMPLOYEE_ID,FIRST_NAME,LAST_NAME,HIRE_DATE,SALARY,MANAGER_ID,DEPARTMENT_ID
    from employees
    &EID_WHERE_CLAUSE &Sal_where_clause
    AFTER PARAMETER FROM
    function AfterPForm return boolean is
    begin
    if :EID_FROM is NULL or :EID_TO is NULL
         then :EID_WHERE_CLAUSE := 'WHERE 1=1';
    ELSE
         :EID_WHERE_CLAUSE := 'WHERE EMPLOYEE_ID BETWEEN '||:EID_FROM||' AND '||:EID_TO;
    END IF;     
    if :SAL_FROM is Null or :sal_to is Null
         then :SAL_WHERE_CLAUSE := 'WHERE 1=1';
    ELSE
         :SAL_WHERE_CLAUSE :='AND SALARY BETWEEN '||:SAL_FROM||' AND '||:SAL_TO;
         END IF;
    return (TRUE);
    end;

    Thank you sir, it really helped me to solve my problem, now it looks like this and working fine, i hope now there is no logical error in my code, please suggest.
    i am really surprised by such a rapid response, i hope i will learn soon from GURUZz
    PARAMETERS_
    EID_FROM
    EID_TO
    H_DATE_FROM
    H_DATE_TO
    SAL_FROM
    SAL_TO
    L_CLAUSE
    QUERY_
    select e.employee_id, e.first_name, e.hire_date, j.job_title, d.department_name, e.salary
    from employees e, jobs j, departments d
    where e.job_id = j.job_id
    and e.department_id = d.department_id
    &L_CLAUSE
    order by e.employee_id
    AFTERPARAMETERFORM_
    function AfterPForm return boolean is
    begin
    IF :EID_FROM is NULL or :EID_TO is NULL
         THEN NULL;
    ELSE
         :L_CLAUSE := 'AND EMPLOYEE_ID BETWEEN :EID_FROM AND :EID_TO';
    END IF;
    IF :SAL_FROM is NULL OR :SAL_TO IS NULL
         THEN NULL;
    ELSE
         :L_CLAUSE := :L_CLAUSE||' AND SALARY BETWEEN :SAL_FROM AND :SAL_TO';
    END IF;
    IF :H_DATE_FROM is NULL OR :H_DATE_TO IS NULL
         THEN NULL;
    ELSE
    :L_CLAUSE := :L_CLAUSE||' AND HIRE_DATE BETWEEN ' || '''' || :H_DATE_FROM || '''' || ' and ' ||'''' || :H_DATE_TO || '''';
    END IF;
    return (TRUE);
    end;
    Edited by: M. Khurram Khurshid on Jan 4, 2012 8:44 PM

  • HT1349 Itunes freezes when I add a folder. How can I fix this?

    Itunes is freezing when I try to add a folder of music (many songs)

    Hey Missm0331,
    When experiencing unexpected freeze issues with iTunes for Windows, the following article provides some great information and troubleshooting steps:
    iTunes for Windows Vista or Windows 7: Troubleshooting unexpected quits, freezes, or launch issues
    http://support.apple.com/kb/TS1717
    Or if you are running Windows XP:
    iTunes for Windows XP: Troubleshooting unexpected quits, freezes, or launch issues
    http://support.apple.com/kb/TS1421
    Thanks,
    Matt M.

  • How can you handle Third Party Payment in Oracle Payroll

    People I hope you all are at your Good Health!
    I have a question and that is i would like to know how i can restrict a dependent from getting an Insurance benefit after he has crossed the Age =18 Also the To date must be calculated and populated automatically.
    Also, how can we handle this third party payment in the Oracle Payroll.
    All comments are welcomed.
    Chetan

    For the payment piece, create a payment method on the person record as a third party. you would need to have setup the recieving party as a third party organization before setting up at employee level.
    During normal payroll processing, you may run Third party check writer to generate a check .
    Ankur thank you for the response i have understood that we must create a Payment Method and Check the Check box for Third party Payment on Payment Method window.But how will that be handled for case where an employee has taken a Loan from a Bank and he has to be deducted every month from his salary how can we handle such a requiremet.
    I did not understand when you said :
    "you would need to have setup the recieving party as a third party organization before setting up at employee level.
    During normal payroll processing, you may run Third party check writer to generate a check ."
    Could you please explain me.
    Regards,
    Chetan

  • How can I handle exception? - to give user more friendly notification

    Hi!
    User gets an error:
    'Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum =...'
    How can I handle this exception (when two users want to modify the same set of data at the same time)? I would like to hide the above error message and give user more friendly notification.
    Thanks in advance,
    Tom

    Thanks Vikas for your answer.
    These workarounds are really creative and I want to use one of them. BUT my problem is to 'catch' the exception/error when two users want to modify the same set of data at the same time.
    Those solutions which we can read about in this link you gave me describe handling exceptions in pl/sql processes. How can I catch the error I am talking about in pl/sql code?
    Code would be like this:
    DECLARE
    two_users EXCEPTION;
    BEGIN
    IF --catch the error
    THEN RAISE two_users;
    END IF;
    EXCEPTION WHEN two_users
    THEN :HIDDEN_ITEM := 'Error Message';
    END;
    What should I put in a place where there is '--catch the error' ??
    Thanks in advance,
    Tom

  • How can we handle Dead lines

    Hi friends,
       When a work item is created. The User hasn't Approved / Rejected  (hasnt taken any Action on that workflow) for 2 days, 4 days and 6 days an Escalation mail has to sent to respective concerend persons.
    How can we handle this. The holidays are only Saturday and Sunday.
    Client doesnt want to consider the factory calender.
    Please suggest me step by step
    Thanks in Advance
    Ganesh

    You need to make use of "Modelled Deadline Monitoring" to achieve ur requirement.
    Trust me... Search this forum and you will find answer how to make use of different steps to achieve it....
    Regards,
    PR.

  • How can i  apply this  java program for  a jsp page?

    import java.io.*;
    import java.util.*;
    public class FileProcessing
      //create a vector container  for the input variables
         Vector variables = new Vector();
      //create a vector container for the constants
         Vector constants = new Vector();
      /*create a string expression container for the equation
         as read from the file */
         String expression = " ";
      //create double result container for the final result
         double result = 0;
         public boolean processFile(String filename,String delim)
          //index for values vector
              int num_values = 0;
          //index for constants vector
              int num_constants = 0;
          //current line being read from the external file.
              String curline = " ";
          //start reading from the external file
              try
                   FileReader fr = new FileReader(filename);
                   BufferedReader br = new BufferedReader(fr);
                   while(true)
                        curline = br.readLine();
                        if(curline == null)
                             break;
                    //determine the type of current interaction
                        boolean variable = curline.startsWith("input");
                        boolean constant = curline.startsWith("constant");
                        boolean equation = curline.startsWith("equation");
                        boolean output = curline.startsWith("result");
                   //on input variables
                        if(variable)
                          StringTokenizer st = new StringTokenizer(curline,delim);
                          int num = st.countTokens();
                          int count=0;
                          while(st.hasMoreTokens())
                               String temp = st.nextToken();
                               if(count==1)
                                    byte b[]= new byte[100];
                                    System.out.println(temp);
                                    System.in.read(b);
                                    String inputval = (new String(b)).trim();
                                    variables.add(num_values,inputval);
                                    num_values++;
                               count++;
                        // on constant values
                        if(constant)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==1)
                                       byte b[]= new byte[100];
                                       System.out.println(temp);
                                       System.in.read(b);
                                       String cons = (new String(b)).trim();
                                       constants.add(num_constants,cons);
                                       num_constants++;
                                  count++;
                        // on equation
                        if(equation)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==2)
                                       this.expression = temp;
                                  count++;
              // now we are ready to evaluate the expression
                       if(output)
                          org.nfunk.jep.JEP  myparser= new org.nfunk.jep.JEP();
                          myparser.setAllowAssignment(true);
                          for(int i=1;i<variables.size()+1;i++)
                             String name = "arg"+Integer.toString(i);
                             myparser.addVariable(name,new Double(variables.get(i-1)
                                                .toString()).doubleValue());
                          for(int i=1;i<constants.size()+1;i++)
                               String name = "arg" +Integer.
                                         toString(i+variables.size());
                               myparser.addConstant(name,new Double(constants.get(i-1).toString()));
                   //output is obtained as follows
                          myparser.parseExpression(expression);
                          result = myparser.getValue();
                          System.out.println("Assay value: "+result);
              catch(Exception e)
                   System.out.println(e.toString());
              return true;
         public static void main(String[] args)
              FileProcessing fp = new FileProcessing();
              fp.processFile("input.eqn",":");
    }//my text file name is: "input.eqn" (given below)
    input:Enter Value1:arg1
    input:Enter Value2:arg2
    input:Enter Value3:arg3
    constant:arg4
    constant:arg5
    Equation:arg1+arg2+arg3
    result:

    how can i apply this java program for a jsp pagewhy do you want to do this ?
    Your program reads from a file on the disk and formats based on a patterm.
    Jsp is not intended for such stuff.
    ram.

  • When an email contains multiple attachments how can I forward just one of the attachments in a new email?

    I am new to IPAD use and need to forward one attachment from an original email that contains multiple attachments - how can I isolate and forward only one of the attachments?

    Aha! I have been doing just that. However, what has been tripping me up is that I am also used to clicking the Go Online/Go Offline toggle button on the top menu bar when I manually check for messages on Cox. Apparently when you take one inbox offline, that button switches to Off even though the other inbox is still online. If I just ignore that button and go on or off via the cox mailbox listing, it keeps comcast from being reactivated.
    Thanks so much for helping me think this through.
    Edited to add: I removed that dang button from my menu so I can stop clicking it.

  • How can i rewrite this code into java?

    How can i rewrite this code into a java that has a return value?
    this code is written in vb6
    Private Function IsOdd(pintNumberIn) As Boolean
        If (pintNumberIn Mod 2) = 0 Then
            IsOdd = False
        Else
            IsOdd = True
        End If
    End Function   
    Private Sub cmdTryIt_Click()
              Dim intNumIn  As Integer
              Dim blnNumIsOdd     As Boolean
              intNumIn = Val(InputBox("Enter a number:", "IsOdd Test"))
              blnNumIsOdd = IsOdd(intNumIn)
              If blnNumIsOdd Then
           Print "The number that you entered is odd."
        Else
           Print "The number that you entered is not odd."
        End If
    End Sub

    873221 wrote:
    I'm sorry I'am New to Java.Are you new to communication? You don't have to know anything at all about Java to know that "I have an error," doesn't say anything useful.
    I'm just trying to get you to think about what your post actually says, and what others will take from it.
    what does this error mean? what code should i replace and add? thanks for all response
    C:\EvenOdd.java:31: isOdd(int) in EvenOdd cannot be applied to ()
    isOdd()=true;
    ^
    C:\EvenOdd.java:35: isOdd(int) in EvenOdd cannot be applied to ()
    isOdd()=false;
    ^
    2 errors
    Telling you "what code to change it to" will not help you at all. You need to learn Java, read the error message, and think about what it says.
    It's telling you exactly what is wrong. At line 31 of EvenOdd.java, you're calling isOdd(), with no arguments, but the isOdd() method requires an int argument. If you stop ant think about it, that should make perfect sense. How can you ask "is it odd?" without specifying what "it" is?
    So what is this all about? Is this homework? You googled for even odd, found a solution in some other language, and now you're just trying to translate it to Java rather than actually learning Java well enough to simply write this trivial code yourself?

  • How can I handle runtime errors in Java

    Please some one tell me what are runtime errors and How can I handle them using java code
    This is important
    Thanks in Advance
    Chowdary AK

    The java equivalent of function pointers is the one-instance class, as used to pass handlers to swing components, for example. Often an anonymous class is used.
    Put your function signature in an interface, and pass an object that implements that interface:
    public Class1 {
      public interface CallBack {
        void myMethod(String arg1);
      CallBack callb;
      public Class1(CallBack callb) {
       this.callb = callb;
      callb.myMethod("A string");
    class2 {
       first = new Class1(new Class1.CallBack() {
         public void myMethod(String arg1) {
           ... do something ...

Maybe you are looking for

  • Can i use iCloud for connecting a mac mini with a macbook?

    I want to know if the connection between mac mini and a macbook is possible. Or do i have to use an i phone as well?

  • UNIX Executable Files - Additional Info Needed About Zipped Files

    I've tried to go through all of the questions posted so far but each link leads me back to the same three or four discussions.  I have downloaded zipped folders of sound samples.  When they are unzipped the files all have an extra space added just af

  • Error in Verifying Livecycle Server in LCM

    Hi I am getting the following error while I try to verify the Livecycle server settings. Please help me in this regard. ALC-LCM-200-001 Failed to connect to LiveCycle ES service container. Service container information or login information may be inv

  • Default hostnameverifier always returns false ...

    Hi, I am trying to run wsdl2java by supplying an https URL. The JVM args that I am using are: javax.net.ssl.trustStore=E:/Romil/projects/AirDeccanPlugin/localhost.ks java.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol On running wsdl2jav

  • The Regular Expressions and GUID.

    Hello gurus, I hope you can help me! I am needing to select GUIDS from a table and for this, I need the Regular Expression. My Perl is not good and not good Regular Expression. My database is Oralce 11.2.0.2.0 and the Operating System of the Machine