How do you capture system values to display in browser (drawString?)

Hi to all,
I'm attempting to get system.out.println values running an applet in a browser. I'm new to creating Applets and I see one option is to use drawString to display text. My code is as follows:
import java.applet.Applet;
import java.awt.*;
import java.io.*;
import java.net.*;
public class WhoAmI extends Applet{
* Tells you the domain name and IP of the machine
* you are running.
* @param args not used.
public String str2 = "test";
public static void main (String[] args){
try
InetAddress localaddr = InetAddress.getLocalHost () ;
System.out.println ( "Computer Name: " + localaddr.getHostName () );
System.out.println ( "IP Address : " + localaddr.getHostAddress () );
//System.out.println () ;
String str = localaddr.getHostName();
String str2 = str;
//System.out.println ( "ALTERNATE LOCAL IP ADDRESSES:");
InetAddress[] localaddrs = InetAddress.getAllByName ( str ) ;
for ( int i=0 ; i<localaddrs.length ; i++ )
if ( ! localaddrs[ i ].equals( localaddr ) )
System.out.println ( "IP Address("+i+"): " + localaddrs[ i].getHostAddress () );
//System.out.println ( "Local hostname : " + localaddrs[ i].getHostName () );
//System.out.println () ;
catch ( UnknownHostException e )
System.err.println ( "Can't detect localhost : " + e +". Check Network settings.") ;
public void init()
Button button = new Button("Close");
add(button);
public void paint(Graphics g)
g.drawString("I need the value of str variable from above to display here", 50, 25);
// Head.
public boolean action(Event evt, Object arg)
if (arg == "Close")
System.exit(0);
return true;
I've tried setting the localaddr.getHostName() value to string also trying to use a public variable name (str2) without success. How do you get a handle of the vale to display it?
Thanks in advance,
Geoff.

thanks for the insight.. however using the above has spawned to be what seems as a security error:
java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkExit(SecurityManager.java:762)
at javax.swing.JFrame.setDefaultCloseOperation(JFrame.java:356)
at Test.<init>(Test.java:7)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:567)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1778)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:496)
at sun.applet.AppletPanel.run(AppletPanel.java:293)
at java.lang.Thread.run(Thread.java:536)
Is there something else I'm doing wrong here?
Thanks for your help,
Geoff-

Similar Messages

  • How do you clean safari from virus displaying ads?

    how do you clean mac from virus displaying ads?

    There is no need to download anything to solve this problem.
    You may have installed one or more of the common types of ad-injection malware. Follow the instructions on this Apple Support page to remove it. It's been reported that some variants of the "VSearch" malware block access to the page. If that happens, start in safe mode by holding down the shift key at the startup chime, then try again.
    Back up all data before making any changes.
    One of the steps in the article is to remove malicious Safari extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those. If Safari crashes on launch, skip that step and come back to it after you've done everything else.
    If you don't find any of the files or extensions listed, or if removing them doesn't stop the ad injection, ask for further instructions.
    Make sure you don't repeat the mistake that led you to install the malware. It may have come from an Internet cesspit such as "Softonic" or "CNET Download." Never visit either of those sites again. You might also have downloaded it from an ad in a page on some other site. The ad would probably have included a large green button labeled "Download" or "Download Now" in white letters. The button is designed to confuse people who intend to download something else on the same page. If you ever download a file that isn't obviously what you expected, delete it immediately.
    Malware is also found on websites that traffic in pirated content such as video. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow. Never install any software that you downloaded from a bittorrent, or that was downloaded by someone else from an unknown source.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates (OS X 10.10 or later)
    or
              Download updates automatically (OS X 10.9 or earlier)
    if it's not already checked.

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • How do you clear system and application logs in a server?

    Hello all,
    How do you clear system and application logs in a server?
    thanks,
    mike

    go to start button,all programs,assosories, System tools T event viewer. now select application & rt click & clear & do not save.similarly do for sytem too.

  • How do you Capture pages in 5.0

    How do you Capture pages in 5.0

    You can't, that entire method has been removed.
    Pages 5 is a severely cut down beta. Apple removed over 100 features and added a lot of bugs.
    Pages '09 should still be in your Applications/iWork folder.
    Peter

  • How do you know the best iMac display size

    how do you know the best iMac display size
    Only on them fits in the screen window and that makes the font so tiny.  The others are too wide or too tall.  I usually view at 150 - 200% for vision issues.

    You say it's better to do the Media Browser?  I'm fairly new to movie, dvd and garage band.  How would I go about using the Media Browser instead of straight to iDVD?
    Select Your project - go up to Share - Share to Media Browser and as Large (Not HD)
    In iDVD select a nice theme - click on Media button - click on Movie - Select Your movie.
    NOW - Save as a DiskImage - and test this before burning DVDs - if this Plays OK then either burn the Image by using Disk Util tool (and set down burn-speed to x4) - or burn via iDVD (will take more time)
    I want to keep as much quality as I can.
    Then don't use iMovie'08 or 09 or 11 - as they all discard every second line resulting in less quality on the DVD. I use iMovie HD6 or FinalCut any version.
    Also...I tried to split my project in iMovie...but couldn't find a way.  I wound up just making a copy and then deleting out a handful of scenes from the copy...I still have the original at 4:12hrs.  Is there a way in iMovie to split a project? 
    I would make a copy and cut away a bit from the end - calling this Part 1 and from start of the other copy Part 2.
    OR - there are other programs that can squees in more to a DVD e.g. Roxio Toast™ - BUT this has two cons.
    • It costs - to me it was well spent mony as it can so much more e.g. back engineer a DVD to an editable form
    • Squeesing in more on a DVD - costs in QUALITY - and as You want as much as it can be - then 90 minuts portions encoded with Pro-Quality encoding and full quality interlasced material from a video-editor that delivers this is the way to get 100% of what DVDs can do.
    DVD is as standard only SD-Video - HD not possibly. Then You need Blu-Ray. (also Roxio Toast™)
    Yours Bengt W

  • How would you capture the stdout of Runtime.getRuntime().exec())?

    How would you capture the stdout of Runtime.getRuntime().exec())?
    Say you wanted to execute PKZIP25.exe from java using Runtime.getRuntime().exec(). How would you capture the output of PKZIP25 (the console IO) in a file so you could check the results?
    Thanks
    Bill Blalock

    Thanks.
    Could you explain a little more?
    The program I am calling seems to be executing, as far as Java is concerned, but nothing happens. I imagine I have made mistakes in calling it but can't see the output to the console.
    Should I use Runtime.getRuntime().exec() or Runtime.exec() for something like this?
    I appreciate the help!
    Bill B.

  • How do you get the album pictures displayed with the right songs on my iphone 5

    how do you get the album pictures displayed with the right songs on my i phone 5?

    I have the same problem but i only have iphone 4s its only jsut started in the last 2 weeks or so

  • How do you capture buzz & reverse in the RMX?

    Hey all - on the Stylus RMX, whenever I "capture" the chaos - it always leaves off the reverse & buzz elements. Upon reading the RMX online manual, it specifically says this is not possible. So - the question is - if you can't capture these 2 features w/in the RMX capture, how can you capture the actual performance (as heard) within Logic?
    PowerMac G5 1.8GHZ single 2GB RAM   Mac OS X (10.4.3)  

    What mode are you in? I believe you must have stylus rmx is groove mode instead of slice mode. You can then also set logic to record what movements you make with those faders, either by mouse or if you have them mapped to another controller. I find that I will drag over a loop and then record the reverse and reorder parameters later so I can get them to happen more with what is happening in the rest of the song.

  • How do you capture a picture of someone you are ta...

    How do you capture a picture of someone you are video chatting with?

    Please see this FAQ.
    Taking a video snapshot of another person
    Regards,
    Tamim
    Location - Dhaka | Bangladesh - Standard Time Zone: GMT/UTC + 06:00 hour
    If one of my replies has adequately addressed your issue, please click on the “Accept as Solution” button. If you found a post useful then please "Give Kudos" at the bottom of my post, so that this information can benefit others.

  • How do you capture a still picture from DVD

    How do you capture a still picture from a DVD

    Click iMovie/About. If you have version 9.0.4 (iMovie 11) this will work. If you have an earlier version, this will also work, but there are also other ways.
    First, get an app called MPEG Streamclip, which is free. (MPEG Streamclip from Squared 5)
    Open MPEG Streamclip.
    In iMovie, select the clip you need. Then, right-click/Reveal in Finder.
    Drag this clip into MPEG Streamclip
    In MPEG Streamclip, move the playhead to the frame you want.
    In MPEG Streamclip, click FILE/EXPORT FRAME.
    Choose JPEG, TIFF, or PNG and give it a name.
    You can then drag this photo into iPhoto.
    I have created a short video Tutorial on how to do this. There is one error in the Tutorial, where it says that Command-click is the same as right-click. I should have said Control-click instead.

  • How do you capture a screen shot

    how do you capture a screen shot on a MacBook Air

    Quickest way is Command-Shift-3:
    This takes a screenshot of the screen, and you can then save it as a file on the desktop
    Cheers!

  • How do you capture an answered phone number in contacts ?

    How do you capture an answered phone number in contacts ?

    When you look at your call history in the phone app, you see the number that you want to add, and press on the small right arrow on the right. It will show you a new page where you can simply create a new contact or add it to an existing one.

  • How do you return System Time of the local box in FTP command

    How do you return System Time of the local box in FTP command... since I want to output the system time of my local box copying to the FTP server...

    Its asking me to enter a new date... I actually want to return it into a log file since I am using ws_ftp.... but the log files dont have any date time being returned... i just want to be able to echo that date time into the log file... but it doesnt do that... I also tried
    SHELL ECHO %DATE% %TIME%
    but it returns this in the log file
    Processing Line 10 [SHELL ECHO %DATE% %TIME]
    I also tried in my ws_ftp script and it says:
    Processing Line 15 [!Date]
    Sending command [!Date] with parameter []
    !Date
    500 '!DATE': command not understood
    Failure in command [!Date]

  • How i can capture the value for ovs selector in web dynpro application

    hi
    i create one OVS for SALES DOCUMNT MY PRIMARY KEY
    FILED IS VBELN AND I WANT GENERATE ONE REPORTS FOR SALES DOCUMENT HOW THIS SERCH HELP IS CAPTURE THE VALUE I WANT TO SOULATION

    >
    awadhesh chandel wrote:
    > hi
    >  i create one OVS for SALES DOCUMNT MY PRIMARY KEY
    > FILED IS VBELN AND I WANT GENERATE ONE REPORTS FOR SALES DOCUMENT HOW THIS SERCH HELP IS CAPTURE THE VALUE I WANT TO SOULATION
    I am afraid that you are going to have to supply a few more details.  What exactly are you having problems with?  Do you need help creating the OVS?  Or perhaps on how to capture the input from the OVS?  Or do you nee dhelp actually generating the report of the sales documents itself?

Maybe you are looking for

  • How to obtain the table index in word use LabVIEW Report Generation Toolkit for Microsoft Office

    I created a word templete and it had several tables. When I use the "Word Edit Cell" function in LabVIEW Report Generation Toolkit for Microsoft Office, the function need "table index", and I didn't find any function to get or set the table index in

  • Verification problem with BB Curve 9320

    Hi - when I try to access my emails on my BB I get a message that it is an invalid account. How can I get over this and get my email working again? Thanks

  • Lost calendar events after sync

    after syncing my mac book air with my iphone 4 i lost all my past and future calendar events on my macbook and iphone. I have backups on time capsule: Q: how do i recover my approx 900 calendar events from time capsule into my calendar on macbook wit

  • Trying to Sync Multiple Systems

    I am having great difficulty with iSync across multliple systems. I will admit that this may be due to my own misconception about what sync is suppose to be so let me explain what I have, what I think should happen then what is happening: Work Setup:

  • Question about java transperancy

    I'm trying to make it so that my JPanel is transparent and shows the frame behind it (it's background is green). But when i start the program the JPanel is there and i see no green. Here is my code public static void main (String [] args)           f