473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Buttons not appearing in applet

52
Hey Guys,

I'm currently writing a java applet for my class and I've run into a quirky little problem. I assure you answering this won't be considered cheating in anyway since it's just a bug and not the solution to the assignment.

I have 5 buttons that I need to use at different times in the applet. initially I need to have two on the screen (buttons B1 and B2). so in my init() I have these two added to the applet. Then once either of these buttons is pressed it should remove them and place three other buttons (B3, B4, B5). so in my event() I have it handle the click by this.remove() B1 and B2 then this.add() B3-B5. Then I change a variable and call repaint() since there are other changes on the applet depending on the button pressed. Unfortunately buttons B3-B5 don't appear on the applet, the repaint() happens but the buttons are strangely missing.

Is there something else I have to do to assure that my buttons get added properly?
Mar 16 '09 #1
3 2349
JosAH
11,448 Expert 8TB
Call the validate() and repaint() methods on the applet after removing the old and adding your new buttons.

kind regards,

Jos
Mar 16 '09 #2
Shisou
52
I had a feeling it would be something easy that I just never heard of before!

Thanks a million!
Mar 16 '09 #3
JosAH
11,448 Expert 8TB
@Shisou
You're welcome; it really pays back to read Sun's Swing tutorial (sorry no link here) and really understand what's happening underneath the surface.

kind regards,

Jos
Mar 16 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: nathanlaan | last post by:
This is the stupidest thing I have ever seen. Java 1.2, 1.3, and 1.4.1, and 1.4.2 all define the Applet.getDocumentBase() method differently! How am I supposed to get the directory of the document...
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
1
by: Charlie Kim | last post by:
Here is gnome applet source of mine. -------------------------------------------------- #!/usr/bin/env python import pydic import gtk import gnome.applet
2
by: Colin Steadman | last post by:
I have two buttons on my form and need to know which was clicked. If I setup the buttons like this: <input type="submit" value="submit" name="submit_to_array"> <input type="submit"...
4
by: j jay | last post by:
I have a string Input tag for a search function. By default, I gat a button with "Submit Query" on it. But what if I want a button with "Search" or just "submit" on it? What if I want a smaller...
1
by: markeboy | last post by:
What is the workaround to prevent toolbar buttons from displaying a grey square where the image should be once the toolbar button is disabled I have transparent color of the image list set to...
2
by: Bernie | last post by:
We have an application with several forms whose command buttons appear just fine the first time the form is opened. The next time it is opened the button disappears. If you click where the button...
1
by: cdimino | last post by:
How can I create an area of space on my applet that is clickable? That is to say, when a user clicks on a certain space within my applet, I would like something to happen in response. I do not,...
2
by: BillE | last post by:
Users of a VS2005 asp.net web forms application can complete questionnaires, and when they are completed the questionnaires can be viewed but not modified. Once completed, the controls in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.