close
    How do I make my Java stand-alone application bring out buttons after animating a welcome message for the user?

    Please I'm new to Java programming. I'm writing an application which has to bring a welcome message to the user and will later bring out buttons to enable the user to choose what next to do. Please what should I do to achieve what I needed in the application?


    I succeeded in making the application to animate welcome texts for the user, but when I created a button, it didn't appear after the welcome messages.


    The following code fragment is an example of how I tried to achieve the aim but failed.


    import java.awt.*;import java.applet.Applet;


    enum TextsContainer{FIRST1_DISPLAY("MY FIRST NAME IS"), FIRST2_DISPLAY("MY SECOND NAME IS"); private final
    String context; private TextsContainer(String context){this.context=context;}
    public String getContext(){return context;}}


    class ProcessTextsContainer{ private TextsContainer textContainer;
    public ProcessTextsContainer(TextsContainer textContainer){
    this.textContainer=textContainer;}
    public TextsContainer getTextContainer(){return textContainer;}}


    public class ExecuteTexts extends Applet implements Runnable{ Thread thread=new Thread(this); Font font1=new Font
    ("Courier",Font.BOLD+Font.ITALIC,50);
    public ProcessTextsContainer paintText1_1=new ProcessTextsContainer(TextsContainer.FIRST1_DISPLAY);
    public ProcessTextsContainer paintText1_2=new ProcessTextsContainer(TextsContainer.FIRST2_DISPLAY);
    public String currentText1_1=paintText1_1.getTextContainer().getContext();
    public String currentText1_2=paintText1_2.getTextContainer().getContext();
    public void start(){if(thread==null){thread=new Thread(this);}}
    public void stop(){if(thread!=null){thread.stop();}}
    public void run(){}
    public void pause(int duration){try{thread.sleep(duration);}catch(InterruptedException e){}}
    public void paint(Graphics graphics){ graphics.setColor(Color.getHSBColor((float)50.0,(float)30.3,(float)5.30));
    graphics.setFont(font1);graphics.drawString(currentText1_1.toString(),10,100);graphics.setColor(Color.BLUE);
    graphics.setFont(font2);pause(100);graphics.clearRect(10,70,481,330);graphics.setFont(font1);graphics.
    setColor(Color.ORANGE);graphics.drawString(currentText1_2,10,100);graphics.setFont(font2);graphics.
    setColor(Color.BLUE);graphics.clearRect(10,70,602,31);graphics.clearRect(72,127,858,79);}


    public static void main(String[]args){ Applet applet=new ExecuteTexts();Button button=new Button("Ok");
    Frame frame=new Frame("TESTING TEXTS");frame.add(applet);frame.add(button);frame.show()}}


     Please I need urgent intervention which I will so muchly appreciate. If my question need further explanation, I will be glad to explain further.


    Thanks a lot as you comply.

    0  Views: 386 Answers: 1 Posted: 13 years ago

    1 Answer

    You need to contact Java about this. We are a general question and answer site. This is above us, we are only everyday volunteers not computer techs or programmers. 



    Top contributors in Programming & Design category

     
    ROMOS
    Answers: 234 / Questions: 0
    Karma: 11370
     
    Colleen
    Answers: 612 / Questions: 0
    Karma: 10395
     
    country bumpkin
    Answers: 57 / Questions: 0
    Karma: 3660
     
    pythonlover
    Answers: 93 / Questions: 0
    Karma: 2060
    > Top contributors chart

    Unanswered Questions

    i9bet
    Answers: 0 Views: 7 Rating: 0
    nohu90lv
    Answers: 0 Views: 6 Rating: 0
    thuy nguyen hai phong
    Answers: 0 Views: 13 Rating: 0
    shbet288online1
    Answers: 0 Views: 8 Rating: 0
    km88gcom
    Answers: 0 Views: 10 Rating: 0
    shbet188biz1
    Answers: 0 Views: 8 Rating: 0
    km88gcom
    Answers: 0 Views: 9 Rating: 0
    where is b52clubglcom
    Answers: 0 Views: 16 Rating: 0
    > More questions...
    466578
    questions
    722259
    answers
    785558
    users