Textfield in this class

im thinkin whether i can add a textfield to this class instead of creating a TextField class and calling it from the AvatarPage class
here is my coding ------
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class AvatarPage extends JFrame
     public static void main(String[] args)
          AvatarPage myWindow = new AvatarPage();
     public AvatarPage()
          setTitle("Choose Your Avatar");
          setBackground(Color.white);
          setSize(1000,600);
          setVisible(true);
          setLocation(10,40);
     public void paint(Graphics g)
          Font fnt=new Font("Times New Roman",Font.BOLD,32);
          g.setFont(fnt);
          g.drawString("Please Choose A Character",318,80);
          Font fnt1=new Font("Times New Roman",Font.BOLD,16);
          g.setFont(fnt1);
          g.setColor(Color.black);
          g.fillRect(82,120,150,250);
          g.drawString("Great Historian",105,400);
          g.setColor(Color.cyan);
          g.fillRect(314,120,150,250);
          g.setColor(Color.black);
          g.drawString("Entertainment Updater",315,400);
          g.setColor(Color.green);
          g.fillRect(546,120,150,250);
          g.setColor(Color.black);
          g.drawString("Great Traveller",568,400);
          g.setColor(Color.magenta);
          g.fillRect(778,120,150,250);
          g.setColor(Color.black);
          g.drawString("Live Dictionary",808,400);
}

I don't understand your question. You can easily add a textfield or textarea by simply adding a JTextField or JTextArea component to your frame.
If you are new to Swing, check this:
http://java.sun.com/docs/books/tutorial/uiswing/index.html

Similar Messages

  • When i executed this class file  i am getting runtime errors

    when i executed this class file i am getting runtime errors
    code is :
    import java.awt.event.*;
    import java.awt.*;
    public class Test extends Frame
    java.awt.Window w;
         TextField t;
         Test()
         t=new TextField(20);
         add(t);
         addWindowListener(new WindowAdapter()
                             public void windowDeactivated(WindowEvent ev)                               {                    
                                  w.toFront();          
                                  System.out.println("hai");
         setSize(300,300);
         setVisible(true);
    public static void main(String args[])
    Test t =new Test();
    after executing that class i am getting this errors
    Exception occurred during event dispatching:
    java.lang.NullPointerException:
    at WindowEventDemo.windowActivated(WindowEventDemo.java:76)
    at java.awt.Window.processWindowEvent(Window.java:612)
    at java.awt.Window.processEvent(Window.java:576)
    at java.awt.Component.dispatchEventImpl(Compiled Code)
    at java.awt.Container.dispatchEventImpl(Compiled Code)
    at java.awt.Window.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.EventQueue.dispatchEvent(Compiled Code)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:68)
    if anybody know how to pls help me

    You are using w that you have not done anything with.
    Add following code to the begining of your cinstructor:
    w = this;
    Then it should work.
    //Anders ;-D

  • [JS, CS4] TextFrame.extractLabel() cannot work with instances of this class

    I have script, which has been working fine in CS3. In CS4 ( app.version = 6.0.1.532 ) however, I get an error using extractLabel, after reading out a couple of other properties from a textframe:
    frameObject.extractLabel('name')
    Error: TextFrame.extractLabel() cannot work with instances of this class
    Up until reading one of the "normal" properties, such as (frameObject.)contents I can call the frameObject.extractLabel('name') without errors, but after "looking at" (by assigning to a variable in code, or by getting the value in the javascript console), the contents propery (or as it seems any normal property) the extractLabel method results in the error above.
    It seems to work to move all of the frameObject.extractLabel calls to the beginning of the function, but I don't think I should need to do that.
    It might very well be the case that the label read by extractLabel has no contents, and has never been assigned. Is there a change in behaviour from CS3 in that sentence? If so, and if thats the reason for the error, is there then a way to determine whether the label has ever been assigned?
    Is this error familiar to anyone else?
    Best regards,
    Andreas

    Hi Andreas,
    Interesting problem!
    Your problems are caused by some peculiarities of itemByID. itemByID doesn't cast the object type properly. Dirk wrote about some aspects of this some time ago. If the scripting engine was strongly typed, this issue would probably be impossible but that would make scripting a lot more of an elitist activity!
    Your problem is that the object type is PageItem and you are accessing a TextFrame property (content). This seems to throw the object type for a loop.
    Using getElements() causes the scripting engine to rebuild the reference to the object correctly.
    Take a look at this code, which illustrates the issue quite well...
    var myDocument = app.documents.add();
    myDocument = app.activeDocument;
    myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
    myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
    var myTextFrame = myDocument.pages.item(0).textFrames.add({geometricBounds:[72, 72, 144, 288], contents:"test"});
    var myId = myTextFrame.id;
    var pgItm = myDocument.pageItems.itemByID(myId);
    alert(pgItm instanceof PageItem);
    alert(pgItm instanceof TextFrame);
    var thisBounds = pgItm.geometricBounds;
    var x = pgItm.extractLabel('mandatory');
    var pgItm = myDocument.textFrames.itemByID(myId);
    alert(pgItm instanceof PageItem);
    alert(pgItm instanceof TextFrame);
    var thisName = pgItm.extractLabel('name');
    var thisContents = pgItm.contents;
    var x = pgItm.extractLabel('mandatory');
    Harbs

  • Web Deploy error - "This method is not supported by this class"

    I have an MVC project which I am trying to deploy to one of our internally-hosted web front end servers via a TFS build process. Our server hosts the MS Deploy service, and other solutions deploy without problems to the same box. The parameters for the build
    process are as follows:
    /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=WMSVC /p:MsDeployServiceUrl=https://<server>:8172/msdeploy.axd /p:DeployIISAppPath="<internal.site.com>" /p:username=<username> /p:password=<password>
    /p:IncludeIisSettingsOnPublish=false /p:AllowUntrustedCertificate=True /p:OutputPath=bin\ /p:SkipExtraFilesOnServer=True /p:VisualStudioVersion=11.0
    The error message I receive at the point the build reaches the deployment activity is:
    Web deployment task failed. (Could not complete the request to remote agent URL 'https://<server>:8172/msdeploy.axd?site=<internal.site.com>'.)
    Could not complete the request to remote agent URL 'https://<server>:8172/msdeploy.axd?site=<internal.site.com>'.
    The request was aborted: The request was canceled.
    This method is not supported by this class.
    We've found
    this StackOverflow post which describes the same error we're experiencing, however the suggested solution is something we already do in our server configuration, so this doesn't resolve the issue for us.
    Has anyone seen this error before, or is able to make any suggestions why it is happening?

    Hi Matt,
    You have to have a look in the build log then copy the command that is under Run MSBuild node and executed it on the build agent.
    You should find something like below:
    C:\Program Files (x86)\MSBuild\12.0\bin\amd64\MSBuild.exe /nologo /noconsolelogger "C:\Builds\....sln" /nr:False /fl /flp:"logfile=C:\Builds\...log;encoding=Unicode;verbosity=normal" /p:SkipInvalidConfigurations=true /p:CreatePackageOnPublish=true /p:DeployOnBuild=true /p:SkipExtraFilesOnServer=True /m /p:OutDir="C:\Builds\...\bin\\" /p:Configuration="DEV" /p:Platform="Any CPU" /p:VCBuildOverride="C:\Builds\....sln.Any CPU.DEV.vsprops" /dl:WorkflowCentralLogger,"C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;BuildUri=vstfs:///Build/Build/31630;IgnoreDuplicateProjects=False;InformationNodeId=14;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;LogProjectNodes=True;LogWarnings=True;TFSUrl=http://...-tfs:8080/tfs/...;"*WorkflowForwardingLogger,"C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;" /p:BuildId="aa2d3857-27e9-4854-b44f-4ca625ccd786,vstfs:///Build/Build/31630" /p:BuildLabel="..._2015.02.27.2" /p:BuildTimestamp="Fri, 27 Feb 2015 11:16:41 GMT" /p:BuildDefinition="..."
    Daniel

  • In wich jar can i get this class org.apache.batik.dom.util.DOMUtilities

    please let me know in which jar file can i get this class and tell me the location for downloading
    org.apache.batik.dom.util.DOMUtilities;
    import org.w3c.dom.Document;

    Hai,
    I think you have to use the xml-apis.jar file from the batik project, which has the class org.apache.batik.dom.util.DOMUtilities.
    Yogesh.

  • Need help making this class Runnable.

    Hello,
    This class (see below) is working fine the way it is but I have a little problem, I need to execute aprox 500+ commands and each command takes between 30sec to 3 minutes to complete which translate into hours for the job to finish.
    I want to speed the process by multi-tasking and executing (possibly) all commands simultaniously by somehow making this class Threaded/Runnable (miltitasking). There must be something tricky about Runtime class and cannot figured it out.
    Your help would be highly appreciated.
    Regards,
    Ulises
    public class CmdTest {     
    public static void main(String[] args) throws java.io.IOException {
    String outFile = "./ds8300/lsvogrp.txt";
    PrintWriter bout = null;
    try {
    bout     = new PrintWriter(                         new FileWriter(new File(outFile)));     
    } catch (IOException e) {
         e.printStackTrace();
    Runtime run = Runtime.getRuntime();
    run.traceMethodCalls(true);
    Process proc2 = run.exec("cmd /c dscli -user user -passwd psw" + "lsvolgrp -l");
    BufferedWriter ot = new BufferedWriter(
    new OutputStreamWriter(proc2.getOutputStream()));
    BufferedReader br = new BufferedReader(
    new InputStreamReader(proc2.getInputStream()));
    BufferedReader er = new BufferedReader(
    new InputStreamReader(proc2.getErrorStream()));
    try {
    String s;
    while((s=br.readLine())!=null) {
         System.out.println(""+s);
         bout.println(s);
    while((s=er.readLine())!=null) System.out.println("ERR:"+s);
    bout.close();
    System.exit(0);
    }catch (Exception ie) { //catch (InterruptedException ie) {
    System.out.println("Interrupted:"+ie.getMessage());}
    }

    Seems like the same question you asked last year.
    http://forum.java.sun.com/thread.jspa?threadID=5181153&messageID=9705196#9705196
    The proper way to design software is to start at the beginning and design Classes. Not try to butcher that which is working.
    You're running work outside the JVM and this work might interfere with other, similar work (the multi-threading issue.)
    I'd start with paper and pencil and see what conflicts might arise.

  • Is this class available CL_GUI_WDR_VIEWER? Urgent Solution Needed.

    Hi Experts,
    Please check the blog below.
    /people/david.fernandespietroniro/blog/2008/06/19/web-dynpro-running-web-dynpro-applications-over-sapgui
    In this blog he used CL_GUI_WDR_VIEWER to declare lr_viewer.
    But when i tried this blog, i'm not able to locate this class.
    I checked SE24. there is no class in this name.
    My question is : Is there any other class available like CL_GUI_WDR_VIEWER.(To do the same blog).
    Expecting Reply ASAP
    Thanks & Regards
    SM Nizamudeen

    Hello Nizamudeen,
    This class was released with the version 700 of SAP_BASIS component. I'm writing a new blog that shows how to call web dynpros in later versions, but for while take a look at the program RSDEMO_HTML_VIEWER.
    Regards.

  • [svn:bz-trunk] 21285: Need to change _parent, privateCall and instance properties from private to protected in order to extend this class for another project

    Revision: 21285
    Revision: 21285
    Author:   [email protected]
    Date:     2011-05-20 07:53:23 -0700 (Fri, 20 May 2011)
    Log Message:
    Need to change _parent, privateCall and instance properties from private to protected in order to extend this class for another project
    Modified Paths:
        blazeds/trunk/apps/ds-console/console/ConsoleManager.as

    Revision: 21285
    Revision: 21285
    Author:   [email protected]
    Date:     2011-05-20 07:53:23 -0700 (Fri, 20 May 2011)
    Log Message:
    Need to change _parent, privateCall and instance properties from private to protected in order to extend this class for another project
    Modified Paths:
        blazeds/trunk/apps/ds-console/console/ConsoleManager.as

  • I created a class file , if i execute this class file it has to be always o

    i created a class file , if i execute this class file it has to be always on top if i open any other programms or applications then also this class file application has to show me on the screen top , i meas ti has to show me first and behind all applications which i opend other applications
    How to do this please help me
    bhaskar

    It sounds like you might be able to write a .bat script to run the application, create a desktop icon for that and set its properties so it runs in the background.

  • JApplet calls a Class. This Class needs Input

    I am doing something in a JApplet. After the user click in a jButton called Execute, this JApplet use a class (Processing) to process some inputs which comes meanwhile this class (Processing) is running. I need some input from the user but not in the way of JOptionPane. I would like to show some more elegant dialog with checkboxes and buttons. How can I do this? Thx for help me!

    I am doing something in a JApplet. After the user click in a jButton called Execute, this JApplet use a class (Processing) to process some inputs which comes meanwhile this class (Processing) is running. I need some input from the user but not in the way of JOptionPane. I would like to show some more elegant dialog with checkboxes and buttons. How can I do this? Thx for help me!

  • "cannot find this class" erro while creating Background Callable Object.

    Hi All,
    I am facing "cannot find this class" while creating Background Callable Object.
    I followed the following document for Creating Background Callable Object.
    [Creating Callable Objects for Background Execution|http://help.sap.com/saphelp_nwce10/helpdata/en/53/cde385301f4aa3b8e77a92cd46bff3/frameset.htm]
    After giving the fully qualified java class name in the Implementation Class Name when i press next i am getting the error.
    Please suggets me in solving this issue.
    Regards,
    S.V.Satish Kumar
    Edited by: Sathish Kumar SV on Apr 4, 2009 10:34 AM

    Hi, kavita.
    First, make sure you choosed the correct container when you created the background CO.
    Second, make sure your package name was "com.examples.bckgco" and class name was "UserDetailsCallableObject". The exception  which you got just means you entered incorrect name.
    It doesn`t relate to your program.
    Best Regards.
    Louis Huang.

  • What does the class CL_EXITHANDLER do ? What the significance of this class

    what does the class CL_EXITHANDLER do ? What the significance of this class,

    Peters,
    Welcome to SDN!
    you can see this class in SE24 and than choose GET INSTENCE method DB on it. than put break-point on
    CALL METHODcl_exithandler=>get_class_name_by_interface
    finally run any t-code you will come into debugger mode and if you see in exit_name value after pressing F6 you will get BADi name of this perticuler T-code.
    basically we use this class for findings BADi.
    Amit.

  • Why can't I use this class inside my MovieClip?

    Hi,
    The attached SlideshowExample.as file works quite nice when I use it on stage directly. But when I tried to use it in Gallery_mc movie clip, it doesn't work, Please help me out in resolving this problem.
    Sorry, I think there is no file attachment option here.
    Thanks.

    What you need to do is to attach this class "SlideshowExample" to your MovieClip symbol in the Library, then instantiate it and add it to the display list. (If you want to use the name "Gallery_mc" then you can rename the class to 'Gallery_mc".)
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • How do I create an genericized instance of this class?

    Hi, I'm having trouble creating a proper generic instance of this class that I wrote. The class type is cyclic dependant on itself.
    public class MyClass<T extends MyClass<T>>
    I can create an instance like this:
    MyClass<?> class = new MyClass();But I would be mixing raw types and generic types.
    Is there anyway to create a proper generic instance of MyClass?
    Thanks a lot
    -Cuppo

    Ah thanks georgemc,
    your solution will certainly work.
    If i may ask your opinion of something...
    MyClass is designed such that the type parameter should always be the same as the class itself. It's kinda a hack to get the subclass type from the superclass.
    so a hierarchy looks something like this:
    class MyClass<T extends MyClass<T> >
    class SubClass<T extends SubClass<T>> extends MyClass<T>
    class FinalSubClass extends SubClass<FinalSubClass>So ideally i would want something like:
    MyClass m = new MyClass<MyClass>();
    (which is not possible)
    is there a way to get around this?
    -Cuppo

  • What is the name of this class?

    I have a JTable which is instantiated like this:
    "class table2 extends JTable {
         private int rows = 100, cols = 8;
         private Object[] rowData = new Object[cols];
    When I try to refer to it as "table2," I get a null pointer exception.
    My questions:
    What is the name of that class?
    Is there a way to reference it as "table2"?
    Many thanks in advance.

    Hello
    I might have the answer to your problem but firstly, is that all the code there is? For example, where is the constructor for your class?
    In answer to your questions:
    1. You cannot reference an object until it has been created (this might explain the NullPointerException)
    2. To reference it as "table2" you would do something like this:
    table2 table2 = new table2();Looks a bit confusing... :(
    You should start class names with capital letters and also choose a general name for the class like this:
    MyTable table2 = new MyTable();
    MyTable table3 = new MyTable();and so on.
    Post another message if you need more help.
    Regards
    Daniel Lam

Maybe you are looking for

  • Command line wasn't executed in ftp adapter

    Hi,gurus:     I met a problem when I used "Run operating system command before message processing" in a file to file scenario.After the message was processed successfully I found the command wasn't executed.However,the command(bat file) could be exec

  • Need to use xsds in PI Mapping

    HI, Upto now i used ddf files for mapping in Gentran integration suite. Now i need to xsd files instead of ddf files. How would i convert those ddf files  into xsd format. My main task is i want to do same mappings in PI which i did in GIS. Thanks, S

  • How to execute a 'Find' in all Methods of a component

    Hi, I have a really basic question about the usability of Web Dynpro. Is there any kind of <b>Search function</b>, as the binocular icon provide in the Class Builder or Function Builder. This is an absolute requirement in any Development tool. I just

  • US Per Diem Upload File

    Hi All, I have some questions regarding the u201CUS Per Diem upload from the Internetu201D with which I hope you can assist: 1. Are you aware of any clients in the US that are currently using this functionality? 2. What is the maintenance effort when

  • I have a macbookair tried to reboot but only get flasjhing folders icon with question mark

    help! macbook air won't boot up.  screen is white with flashing Folders Icon with quesion mark inside.  any suggestions?