Total members 10261 | Gratitudes |It is currently Wed May 23, 2012 9:07 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: JFrame properties for an Applet to be embedded in website?
PostPosted: Sun Oct 16, 2011 1:17 am 

I've been trying to find a way to gain access to all the JFRAME functionality like buttons etc in an applet which is being doublebuffered. Is there any way to have these buttons etc and chat style panes in an applet?

EXAMPLE:

Say I'm making a small game. In this game I am using something like:

Code:
   // The paint function handles all the paint requests to draw things to the screen
   public void paint(Graphics g){

      bg.clearRect(0, 0, appWidth, appHeight);   // Refresh the background first   

      
      // GUI PLACEMENT
      
      bg.setColor(Color.orange);
      bg.fillRect(640, 685, 260, 70);      // PROGRESS QUICKVIEW
      
      bg.setColor(Color.red);
      bg.fillRect(740, 655, 80, 30);      // SERVER TIME

//////// MORE CODE HERE /////////


      // Finally output the prepared screen
      g.drawImage(buffer,0,0,this);
   }

BUT ..... I want to be able to use the JFrame things like buttons to choose items in the game, and I want to be able to implement a little chat client in the game as well ......

What would you recommend I do to accomplish this?

I was thinking about writing it all from scratch, boundary boxes and parsing text to fit inside for the chatbox etc ... and then for the buttons / hotkeys in the game but JFrame buttons in there to do all the actions but I'm starting to think that I'm tackling this in the wrong way entirely.

Any help please? Or would using JFrame properties inside my applet work?

VERY IMPORTANT: This is to be embedded into a website so it cannot have standard windows style borders etc, I just want to utilise the JFrame assets like buttons etc ...

Anyway any help you can offer me would be appreciated.

Regards
gam35guru


TOP
  
Reply with quote  
 Question subject: Re: JFrame properties for an Applet to be embedded in website?
PostPosted: Fri Nov 11, 2011 10:03 pm 
Offline
Newbie
User avatar

Joined: Mon Jul 30, 2007 1:11 am
Posts: 3
Has thanked: 0 time
Have thanks: 0 time
Based on experience, JFrame inside an applet is not recommended (or it wouldn't run at all). It would be redundant to have JFrame elements like title bar, max/min/close buttons as the browser already have these.

You can use JPanel instead and put buttons, textboxes, labels, and other doublebuffered elements inside it. Then, put the JPanel inside the applet.
Hope this helps.


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  

 Similar topics
 How can I increase the PageRank of my website on Google?
 Know your goals before building your website
 links CSS properties
 Changing the color and properties of the header tag
 How to download and save .mov files from this website ?
 Change the properties of div tag
 play music as your website background.
 Java applet
 Des java Applet ( Data Encryption Standards )
 Arabic website partner

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: Google Adsense [Bot] and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team