Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-21-2003, 09:34 AM   #1 (permalink)
thunderflash
Registered User
 
thunderflash's Avatar
 
Join Date: Apr 2003
Location: Illinois
Posts: 2
thunderflash is on a distinguished road
Send a message via AIM to thunderflash Send a message via Yahoo to thunderflash
Exclamation Converting Applications To Applets

Hey i was wondering if any knew good documentation on converting apps to applets. Or if you wanted to see my applications spacific code and try to convert it yourself ask for it in a reply. I am very frustrated and new to java so any help would be awesome
thunderflash is offline   Reply With Quote
Old 04-22-2003, 07:42 AM   #2 (permalink)
sno2dude
Registered User
 
sno2dude's Avatar
 
Join Date: Apr 2003
Location: Michigan Tech
Posts: 38
sno2dude is on a distinguished road
Send a message via AIM to sno2dude Send a message via Yahoo to sno2dude
apps to applets eh? well you are talking 2 different things here.... first off, if it does ANY file I/O... forget it, it cant be made into an applet..... applets cant do file i/o. other than that, your main class has to extend JFrame and you have to change your window or whatever into a JFrame.... shouldent really be too hard...... actually.... you dont really even need to make it into a JFrame now that i think about it, you would just have to make a class that launches your applet and make IT a JFrame..... i think... sorry tho, cant help you out with any sites
sno2dude is offline   Reply With Quote
Old 04-22-2003, 10:46 AM   #3 (permalink)
thunderflash
Registered User
 
thunderflash's Avatar
 
Join Date: Apr 2003
Location: Illinois
Posts: 2
thunderflash is on a distinguished road
Send a message via AIM to thunderflash Send a message via Yahoo to thunderflash
Exclamation okay

Alright. my prog doesnt involve any file IO. however it does request that the user input a string and then that is analyzed to produce an outpu. I assume there will be no problem there. My biggest problem is the spacifics. I am new to java and this program is for a class. All of the sudden my teacher said it would be cool if i could put it on a website. I am very new to java and this is an independant study progect. So i will get no help from my teacher. Perhaps if one would like i could send them the source via email.
thunderflash is offline   Reply With Quote
Old 04-22-2003, 02:19 PM   #4 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
applets can do almost anything ( as long as they have the right permissions ) however they can't use "swing" so that includes JFrame, JPanel J*...

anything beginn with J, don't use it

personally, ihate applets but if you want more detailed answers look @ the java forum / docs for help: forum.java.sun.com there will be a tutorial on them somewhere that...
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Old 04-23-2003, 08:25 AM   #5 (permalink)
sno2dude
Registered User
 
sno2dude's Avatar
 
Join Date: Apr 2003
Location: Michigan Tech
Posts: 38
sno2dude is on a distinguished road
Send a message via AIM to sno2dude Send a message via Yahoo to sno2dude
ignore abc123.... applets can use swing but cannot read or write to files (security issues). I ALWAYS use Swing for my applets. JPanel's are the core of an applet.... they are the "Container" which you add things into.... im having a massive brain fart right now though and cannot remember specifics cuz i havent done any applets for a while here but i will try to look into it all for you. I KNOW you can use swing in an applet though.
sno2dude is offline   Reply With Quote
Old 04-23-2003, 08:36 AM   #6 (permalink)
sno2dude
Registered User
 
sno2dude's Avatar
 
Join Date: Apr 2003
Location: Michigan Tech
Posts: 38
sno2dude is on a distinguished road
Send a message via AIM to sno2dude Send a message via Yahoo to sno2dude
okay..... your main class has to extend JApplet (you can go here to see what you inherit from JApplet class) other than that its MOSTLY the same
EXAMPLE:

Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TwoButtons2 extends JApplet {

    //-------------------------------------------
    //
    // init - This method will be called 
    //         to set everything up
    //
    //-------------------------------------------

    public void init() {

	// set up window
        Container window = getContentPane();
	window.setLayout(new FlowLayout(FlowLayout.LEFT));

	// set up red button
	JButton red = new JButton("red");
	red.setBackground(Color.red);
	window.add(red);

	// set up green button
	JButton green = new JButton("green");
	green.setBackground(Color.green);
	window.add(green);

	// set up label
	JLabel which = new JLabel("which one?");
	which.setOpaque(true);
	which.setBackground(Color.white);
	window.add(which);

	// set up listeners
	ButtonListener redLstner =
		new ButtonListener(which, Color.red);
	red.addActionListener(redLstner);
	ButtonListener greenLstner =
		new ButtonListener(which, Color.green);
	green.addActionListener(greenLstner);

	} // end of init method

    } //end of TwoButtons2 class
    
//-------------------------------------------------------------
//
//-------------------------------------------------------------
    
class ButtonListener implements ActionListener {

    // properties
    private JLabel theLabel;
    private Color theColor;
    
    // constructor
    public ButtonListener(JLabel lbl, Color c) {
    
        theLabel = lbl;
        theColor = c;
        } // end of constructor
        
    //-------------------------------------------
    //
    // actionPerformed - called on and sent an 
    //                   ActionEvent and does 'something'
    //                   with it.
    //
    //-------------------------------------------

    public void actionPerformed(ActionEvent event) {

        theLabel.setBackground(theColor);
        } // end of actionPerformed

    } // end of ButtonListener class
sno2dude is offline   Reply With Quote
Old 04-23-2003, 05:31 PM   #7 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
Quote:
Originally posted by sno2dude
ignore abc123.... applets can use swing but cannot read or write to files (security issues). I ALWAYS use Swing for my applets. JPanel's are the core of an applet.... they are the "Container" which you add things into.... im having a massive brain fart right now though and cannot remember specifics cuz i havent done any applets for a while here but i will try to look into it all for you. I KNOW you can use swing in an applet though.
hmm

well as far as i know MS doesn't have support for SWING so if you use it in your applet it won't display.

and i am almost certain you can write files in an applet you just have to navigate the security manager...
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Old 04-23-2003, 05:55 PM   #8 (permalink)
sno2dude
Registered User
 
sno2dude's Avatar
 
Join Date: Apr 2003
Location: Michigan Tech
Posts: 38
sno2dude is on a distinguished road
Send a message via AIM to sno2dude Send a message via Yahoo to sno2dude
Sun removed the support for writing files from an applet because it would screw a LOT of things up on a computer from a webpage. and my applets work just fine in MS with Swing....... you just gotta make sure you have Java installed and not just JavaScript..... duh
sno2dude is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with converting to HTML 4.01 Transitional gamehead200 HTML, XML, Javascript, AJAX 8 10-30-2004 09:06 AM
Applications for a small Linux server for a small business.... Admin Linux / BSD / OS X 4 07-04-2004 04:16 PM
How to put files in applets?? Lyliss Java 8 05-07-2004 06:07 AM
Converting a character to hex? M3GAPL3X Standard C, C++ 1 07-11-2003 12:04 AM


All times are GMT -8. The time now is 11:03 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting