Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Hi,I need to convert applet code to swing code

Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I want to change the applet buttons to swing buttons in my code.I put j infront of the buttons .but it is working like this if i move the cursor the button appears and then it disappears.I think i have to change the code entirely to swing due to the applet components i used in my code.I am sending my code.please help me what are all the things i have to change.if possible pls alter my code and send me.

pls help me.


[ UD: added CODE tags and removed email address ]
[ October 05, 2007: Message edited by: Ulf Dittmer ]
Posts: 43016
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it -"ppl" isn't really your last name, is it-, please take a moment to change it, which you can do right here.

The purpose of JavaRanch isn't to write someone's code for them, but rather to help people to learn Java, so that they learn how to do it themselves. So, nobody will be sending you code; I've removed the email from your post, because we like to UseTheForumNotEmail.

Also, please UseCodeTags when posting code of any length.

There are many other tips on how to get the most out of JavaRanch at HowToAskQuestionsOnJavaRanch.

As to your question, Swing works a bit differently from AWT, so just replacing AWT components with Swing components is not sufficient. Instead of using the paint method to do the drawing, you should use paintComponent.

The code is too long to try to understand it fully, but I noticed that you use "==" to perform string comparison. That's not going to work, you need to use the String.equals method.
[ October 05, 2007: Message edited by: Ulf Dittmer ]
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and get rid of all the commented out lines.

if they're not needed in you're code, they're not needed here.
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic