Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
|
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 9th, 2004, 03:40 PM
Authorized User
 
Join Date: Jun 2004
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hlchuah77
Default How to call java external files?

Hi, everybody, do anyone know is it possible to call java external files?

For example, I have created an applet, "Webpage.java", in this applet, I use GridBagLayout to organize its container which comprises banner, body, and bottom-banner as for example.

I would like to use Label to create a banner, place an image on the body part, and again, a Label at the bottom-banner. Instead of writing all the coding in "Webpage.java", I write coding and save it in separate .java files.

So, if I create another three java files such as "Banner.java", "MyImage.java" and "BottomBanner.java", is there any way for "Webpage.java" to call those three java files so that those three external java files can be executed in "Webpage.java"?


 
Old September 11th, 2004, 09:20 PM
Registered User
 
Join Date: Aug 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default


That's easy. Just add the following lines of codes in your
programme.

Bannerjava banner = new Bannerjava();
add(banner);
You can call methods from banner by simply including the method
name like this:
banner.methodname();
Another example is below. Minicalc is an external java
file.

import java.awt.*;

 public class CalcApplet extends java.applet.Applet {
     MiniCalc calc = new MiniCalc();

     public void init() {
         setBackground(Color.gray);
         add(calc);
     }
 }

 
Old September 12th, 2004, 02:10 PM
Authorized User
 
Join Date: Jun 2004
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hlchuah77
Default

Thanks a lot, Judex. You really solve my problem, thank you. :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call an External program to run ? itayzoro VB.NET 2002/2003 Basics 0 July 31st, 2008 01:45 AM
call external program from vb.net praswani Pro VB.NET 2002/2003 2 October 18th, 2007 07:19 AM
Urgent:How to call the external function ivanlaw Javascript 6 October 16th, 2007 12:16 AM
Call or linking to external .jar file tony_s Java Basics 0 December 16th, 2006 05:20 PM
how to call an external program? schockp Oracle 2 November 13th, 2003 07:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.