Total members 11894 |It is currently Thu Nov 21, 2024 7:34 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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




Author:

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.


Author:
Newbie
User avatar Posts: 3
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : JFrame properties for an Applet to be embedded in website?
 JFrame on applet     -  
 Remove default window icon from JFrame     -  
 Change the properties of div tag     -  
 links CSS properties     -  
 Change CSS Properties from JQuery     -  
 Class static properties     -  
 Java properties utility     -  
 Define boolean Class properties     -  
 demonstrate how to add lighting and material properties     -  
 Changing the color and properties of the header tag     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com