Very Basic Question on Threads and Object Manipulation between classes

I have a feeling this is on the virge of being a stupid question but hey, its the right forum.
Lets assume I have a class that extends Jframe : Jframe1
In that frame there is only one Jlabel : Jlabel1
I want to create a thread that will affect Jlabel1
The thread will run an endless loop that will.. for example change the color of the label to a random color and then the thread will sleep for a given time. There is no use in this program. Its only meant to help me understand
I have looked up info and examples on threads. Unfortunately none were useful. Most examples try to illustrate the use of threads with the example of an applet digital clock. But it does not help with my problem, not to mention I dont want to delve into applets at this time.
I know I have to make a class that extends thread. Does it have to be an inner class?
How do I get to affect the frame's Jlabel1 from it? It says it doesn't know anything about it.

import javax.swing.*;
import java.awt.*;
import java.util.*;
public class Jframe1 extends JFrame implements Runnable{
  Container con;
  JLabel Jlabel1;
  Random rand;
  Color c;
  public Jframe1(){
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    con = getContentPane();
    rand = new Random();
    Jlabel1 = new JLabel("bspus", JLabel.CENTER);
    Jlabel1.setOpaque(true);
    con.add(Jlabel1, BorderLayout.NORTH);
    setSize(300, 300);
    setVisible(true);
  public void run(){
    while (true){
      try{
        Thread.sleep(1000);
      catch (InterruptedException e){
        break;
      int n = rand.nextInt(16777216);
      c = new Color(n);
      SwingUtilities.invokeLater(new Runnable(){
        public void run(){
          Jlabel1.setBackground(c);
  public static void main(String[] args){
    Jframe1 jf = new Jframe1();
    new Thread(jf).start(); // you don't need to create a new thread
  }                         // because this Main thread is just
                            // another thread.
                            // here, only for demonstration purpose,
}                           // we make a new separate thread.

Similar Messages

  • Basic question about storage and safety in iMovie '11

    A very basic question about storage and safety:
    I want to keep a backup of my raw footage on my external hard drive prior to begin working on the movie in iMovie. I want to do this:
    1. Upload the digital files from my camcorder to my Desktop *(as opposed to iMovie)*
    2. Duplicate that footage/clips.
    3. Put the duplicate clips/footage into a folder labeled with the name of that footage (like "Fun At the Dentist" or "Jimmy Learns How to Yodel").
    4. Drag the folder with the footage/clips into my external hard drive into a pre-existing folder titled "Backups/duplicates of all of my raw footage/clips." This big granddaddy folder will house all of the child folders of different movies.
    5 Then, open up iMovie '11 and import the raw footage/clips from my Desktop rather than from my camcorder.
    6. Then I want to make a duplicate of my finished movie and put it in my external hard drive in a "Finished Movies" folder.
    I know that the original raw unedited footage will always be in iMovies '11 but I want the original to also exist immediately accessible in my external hard drive.
    QUESTION:
    Is this viable? Is it wise? (I know it goes an extra unnecessary step, but aside from that.)
    *Do you have any precautionary advice?* Should I do something in my iMovies '11 preferences? What?
    In earlier years with iMovie '04 or '06 (cannot recall) I made many novice errors and ended up losing audio to my finished movie. I also lost footage.
    This time around with iMovie '11 I don't to make such novice, ignorant errors.
    Thanks so much for any comments to this question.
    -L

    Yes I'm sure it will work great for you.
    The iFrame format is something Apple has come up with. The reason for its existence is unknown to me so I can only speculate. But it seems to me that Apple "invented" this format in order to have devices such as Ipod/Ipad/Iphone/Ixxx create clips that are editable on consumer hardware such as already mentioned devices but also standard Mac computers, without the need for format conversion.
    iMovie converts most input formats during import, which takes a lot of time, and this need for conversion often comes as a surprise to most people new to home video editing.
    iFrame has a resolution of 960x540 which is long way from the common standards of 1920x1080 and 1280x720. If your end target is YouTube however, this may not be too bad though. However if you intend to go with YouTube HD, you may find iFrame footage to look wrong since they are effectively upscaled to a higher resolution.
    Technically iFrame uses the H.264 algorithm, a smaller frame size (960x540) and a rather low compression scheme. This will result in large files, but the plus side is that the files are ready for editing without the need for any conversion and iMovie will natively edit the files.

  • Possibly a very basic question but I have set up a spread sheet in Numbers and have viewed help videos but I can't get it to give me sums for the columns I highlight.  Keeps coming up with the figure zero.  I have version 09 2.3(554). Can anyone help

    Possibly a very basic question but I am going nowhere without a solution.  I have set up a spreadsheet in Numbers but it won't give me sums for chosen columns. I  have viewed the run through videos and used the formula but nothing happens apart from giving a figure of zero or a red arrow.  The sum icon in the bottom left hand section of the window does not highlight or show any total as I understand from the video that you can drag whatever total is here onto the relevent position on your spreadsheet.  I have Numbers 09 version 2.3 (554). Can anyone advise. Thanks.

    Hi Sohojools,
    To sum a column, use a formula such as this one in Cell A6
    Type this in a cell below your data:
    =SUM(A2:A4) or whatever range of cells you want to sum. The easy way is to type:
    =SUM(
    and then drag or shift-click to select the range of cells. Close the formula with a final bracket ")".
    The sum icon in the bottom left hand section of the window does not highlight or show any total
    To see the sum (and other simple statistics) in the bottom left, select a range of cells. That tells Numbers which cells you are refering to.
    The videos are good, but the Numbers'09 User guide, and the Formulas and Functions User Guide are better. Download them from the Help Menu in Numbers.
    Regards,
    Ian.

  • Here's a very basic question about 2 TB external drives and Time Machine.

    Here's a very basic question about 2 TB external drives and Time Machine.
    Ihave a Mac Pro with a .75 TB and 1 TB drive.  It also has a 1 TB 2ndinternal drive.  My current external drive is too small so I'll begetting a 1.5 TB or 2 TB drive.
    Obviouslythe new larger 2 TB drive will backup everything on the Mac Prointernal drive with Time Machine.  But there will be 1 TB of space leftover going to waste.
    ShouldI partition the external drive so that the TM portion will be 1 TB andthe use the remaining extra partition for additional file backups withCarbon Copy?
    Thanks for any insights.
    I tried searching around on the new Apple discussion forum, but I find it much harder to use than the old forum I used to use.

    The problem with terabyte drives is that that a 3 TB is about as big as you can get without going into RAID territory. Ideally, a Time Machine drive should be 3 times as large as all the drives you are backing up. So, if you have 2.75 TB of internal storage, you should have 8 TB of Time Machine space.
    Of course, that is "should". If your TB drives are mostly empty, then you can get away with something 3 times the size of your used disk space. Just remember that you are pushing it. Linc is right about Time Machine needing space to work.
    It is unlikely that you have regular churn on 2.75 TB of disk. I suggest identifying which drives and folders have the most activity and excluding those drives and directories that don't change much. It would be better to archive the data that doesn't change often and keep it out of Time Machine. Then you may be able to get away with a 2 TB Time Machine drive.

  • One very basic question about inheritance

    One very basic question about inheritance.
    Why we need inheritance?
    the benefit of inheritance also achieve by creating instance of base class using it in other class instead of extending the base class.
    Can any one please explain why we are using inheritance instead of creating object of base class????

    SumitThokal wrote:
    One very basic question about inheritance.
    Why we need inheritance?
    the benefit of inheritance also achieve by creating instance of base class using it in other class instead of extending the base class.
    Can any one please explain why we are using inheritance instead of creating object of base class????What did you find out when you looked on Google?
    One example of inheritance comes in the form of a vehicle. Each vehicle has similarities however they differ in their own retrospect. A car is not a bus, a bus is not a truck, and a truck is not a motorbike. If you can define the similarities between these vehicles then you have a class in which you can extend into either of the previous mentioned vehicles. Resulting in a reusable class, dramatically reduces the size of code, creates a single point of definition, increases maintainability, you name it.
    In short there are thousands of benefits from using inheritance, listing the benefits could take a while. A quick Google search should give you a few hundred k if not million links to read.
    Mel

  • If I upgrade to Mountain Lion on the computer that will install it, will my WIFI still work on the computer that cannot be upgraded? I know this is a very basic question

    If I upgrade to Mountain Lion on the computer that will install it, will my WIFI still work on the computer that cannot be upgraded? I know this is a very basic question. Trying to hold out as long as I can, but purchasing an iPhone for Christmas and new iMac next year when warrently expires.

    Thank U very much for the quick reply, I wanted to upgrade this weekend, but still on the fence. I can live with the software that is not compatible, they are on another compuetr, just didn't want the obvious stuff to stop working.

  • Very basic questions on text/email

    So I'm now convinced - with the 3.0 OS and the 3GS handset, the iPhone finally does all I want it to do and I'll be buying my first one in a couple of weeks.
    Before I do, though, I have a couple of very basic questions:
    1. Does predictive text only work in the SMS app, or does it work in the apps for email, writing notes, etc?
    2. Can you turn the predictive text off? (I find it wildly irritating, because I know far better what words I want to write than a pesky phone does!)
    3. Having email sent to a mobile is a whole new world for me! Do I need to subscribe to MobileMe at £££ per month, or is there another way of having email from my three accounts forwarded to my mobile?
    Hope someone can help!
    Cheers,

    1. Does predictive text only work in the SMS app, or does it work in the apps for email, writing notes, etc?
    It works with Safari, the Mail client, the Notes app, and with the SMS app.
    2. Can you turn the predictive text off? (I find it wildly irritating, because I know far better what words I want to write than a pesky phone does!)
    Yes.
    3. Having email sent to a mobile is a whole new world for me! Do I need to subscribe to MobileMe at £££ per month, or is there another way of having email from my three accounts forwarded to my mobile?
    You can access any IMAP or POP account with the iPhone's Mail client, and access multiple email accounts. I currently access to email accounts with the iPhone's mail client - my MobileMe account, and a business POP account. You can access all 3 of your email accounts with the iPhone's Mail client.

  • Basic question inbound / outbound and source service (ASA 5505)

    Hi there,
    I'm new to the ASA 5505 appliance and have a few very basic questions. Hope I get some responses and not flamed for being a total newbie. :-)
    Inbound versus outbound: I'm having a difficulty understanding the inbound versus outbound terminology. Can somebody please clarify? For example, if I want to block all http traffic from hosts on the inside to the internet but allow all https connections, intuitively I'd configure a rule to block outbound (= outgoing) traffic for the http protocol for the inside network. However, it seems as if I have to add this rule for inbound connections. Why is a connection from a host on the inside to a web server on the internet considered an inbound connection on the inside interface?
    When I add a rule, I've got a "service" field and a "Source Service" field in the "More Options" section. What's the difference? Do I have to set both to the same value?
    Your help is greatly appreciated.

    Hi Ralf,
    Yes, if you put a deny http, it would drop all packets for destination as http port, but be mindful that when you apply an access-list on your inside interface, it automatically activates the deny ip any any right at the bottom, you would be able to see that in the ASDM. So for the users that need be allowed access to the http, needs to be explicitly allowed http access, so your correct configuration would be:
    access-list inside_access_in deny tcp host 192.168.1.1 255.255.255.255 any eq http
    access-list inside_access_in permit tcp any any
    access-group inside_access_in interface inside
    This would block 192.168.1.1 to go to internet, but allow all others.
    Second question, i haven't chceked the ASDM, but just remember out of memory, that this service option should be the protocol, whether ip,tcp,udp,esp or gre etc.
    Moreover always try to block connections as closed to the source as possible, this would mean, if you want to filter traffic going from inside to outside, that should be done on the inside interface not outside.
    Thanks,
    Varun Rao
    Security Team,
    Cisco TAC

  • A very basic question regarding data block

    Hi All,
    I've a very basic question concerning data blocks in oracle forms 10g.
    I want to make a view only screen (only query allowed, no update, insert or delete).
    I'll have 6-7 fields on the screen but all the fields are not from a single table.
    For e.g, let say we've field names to display on the screen are f1, f2, f3, f4..
    Out of this f1 and f2 will come from table A and f3, f4 will come from table B.
    Now, my question : Is it possible to create a data block using the data block wizard for such situation if we select create data block from table options?
    If no, can you please tell me an approach to do this.
    Regards,
    Navnit

    Hello ,
    First write your query & select datablock property.
    just change the below properties
    Query Data Source Type=From Clause Query
    Query Data Source Name = (Paste query here)
    now you should add the block ITEMs and give their names according to query columns names. shows the column on canvas and run..
    Best Regard
    skyniazi
    Edited by: SKYNIAZI on Mar 29, 2009 1:32 PM

  • Very basic question... can photoshop overwrite the original file?

    Very basic question... can Photoshop Elements 13 overwrite the original file?

    You will need to check the Photoshop Elements for any particulars about that software.
    For Photoshop, if I make changes and exit saving those changes, yes the original is overwritten.
    Keep backups at all times and don't work off flash external drives. When people tell me their original 500 layer file got corrupted, and they didn't keep copies, I hate to tell them their weeks of work is down the bucket.
    In Photoshop, we use Image > Duplicate to work on a copy if we don't want the original touched, or File > Save as... where we give the file a different name. We save image.psd as image1.psd and image.psd is closed. We then have a copy, "Image1" opened.
    Gene

  • Entities not showing Contribution - very basic question

    Hi guys,
    Apologies for this very basic question - I'm very new to Hyperion, with just a weeks training! Anyway I'm building a basic model and have noticed that in the Value dimension my entities are not rolling up to the [Contribution Total]. This means that Entities do not roll up!!
    One suggested issue was that I needed a Sub Consolidate in the Rules, however I've set the attribute "ConsolidationRules" to be = to N. In the documentation this is defined as "N to use the default consolidation and eliminations."
    Wondering is there anything else that is needed to use default consolidations, or do I need to create some Rules??
    Thanks
    G

    Why do you think it is not rolling up? If your Consoldiation Rules are set to 'N' you do not need rules.
    Make sure your accounts are set to IsConsoldiate. Make sure you are viewing a 'Parent.Child' at Contribution Total.

  • Should I download and install the latest version of Adobe Flash to use with Lion?  My need for Flash is very basic: Google Maps, YouTube, and content on certain websites.  Thanks for any help you are able to provide.

    Should I download and install the latest version of Adobe Flash to use with Lion?  My need for Flash is very basic: Google Maps, YouTube, and content on certain websites.  Thanks for any help you are able to provide.

    Thanks for the speedy reply.  I have read so many comments about Flash being incompatible with Lion I was wondering whether to download it or not.  So many sites on the Web still require flash, however, you almost don't have a choice but to download it even if it is incompatible.  I gather a better version of Flash will be available for Lion soon.  Again, thanks for the help.  I will download the latest version of Flash.

  • Some basic questions on ESS and MSS

    Hi Experts,
    This is the first time I am going to deal with
    ESS and MSS.
    I have some basic questions about it and they are
    listed below:
    1. In an organization if they want to integrate
    ESS and MSS, how do they go about? What I mean
    is, will they install the packages in the R/3
    system and then use the to portal features to
    make iViews of ESS and MSS.
    2. Or is there a seperate package for the portal
    and the R/3 system
    3.What is the best way to customize ESS and MSS
    iViews? Is WebDynpro used to customize ESS and
    MSS applications, if yes how?
    4. Are these ESS and MSS packages different for
    ECC and the older version of R/3 systems? If yes what are the major differences?
    Please do let me know on these subjects and also
    if anyone of you have any links or documents
    associated with this scenario please do send me.
    Thank you
    Regards
    Luke

    Hi,
    here is what I know..
    1 & 2. Depending on the backend SAP version, the relevant ESS/MSS Business Packages have to be installed on the Portal. On the backend it will be via an Add-on.
    3. The webDynpro versions of ESS/MSS are available from mySAP ERP2004/2005 (ECC5/6). The best way to customize the iViews would be through the NetWeaver DevStudio.
    ent
    4. Yes, the ESS/MSS packages are differ depending on the backend SAP version.
    You can find all the  different packages & their info right here on SDN. From the home page click on the Portal Content Portfolio on the right hand side of the page>Browse Content Portfolio>Self Service for ESS & Line Manager for MSS.
    Regards,
    Suresh Datti

  • Very Basic Question i think ?

    Hi im very new to flash but am looking to learn some more
    about it i have tried to use the pre-built components in flash and
    was just wondering where or how you can retrieve the values from
    the checked boxes
    i know how to do for 1 checkbox by using
    if ( instancename.value = true){
    trace("Box was ticked");
    but what i am looking to do is run through a series of 5
    checkboxes and retrieve all the labels at first i can probably work
    out the checking if they are ticked but all i get traced is
    undefined which i guess means no value.
    This is the code i used to try to retrieve all the labels of
    every checkbox on press of a button
    on(release)
    trace("Clicked");
    var i = 1;
    while (i < 5){
    trace("While Running");
    i++;
    trace(CheckBox
    .Label);
    trace(i);
    It would be most appreciated if anyone could point me in the
    right direction for very basic tutorials on flash components as i
    could only find the macromedia livedocs which i didnt find a lot of
    help as its all technical speak which i am not familiar with
    yet....
    Thanks Pinky

    Many Thanks!!!!!
    This was the output i had to change the for to say i < 6
    to do the final checkbox but it is exactly whati wanted to do
    without having to use multiple if,s :D
    Many Thanks now just gotta try to work my head round
    comboboxes which i would have to start a new thread :D lol

  • VERY Basic Questions about Oracle eBusiness - what "languages" are used?

    Please forgive the very basic nature of this post- (I have been in systems (IT) for over 20 years, so I do have lots of systems experience, but no exposure to this particular software.)
    So here are the basic questions - I assume that much of the data base logic is written in PL/SQL, but what other tools / languages are the applications written in?
    (Oracle Forms, Oracle Reports, Java, C, something else?)
    With over 20 years and experience with a number of other packages, I can learn a great deal about an application by 1. Looking at the DB structures (charts), 2. looking into DB code (Packages, triggers, procedure, functions) and 3. Seeing the screen shots.
    None of my customers have had Oracle eBusiness - that have had home grown applications or other COTS/packages.
    can anyone suggest a place where an independent person can inexpensively get some exposure?
    My sincere thanks for any answers/suggestions. 

    Hi,
    Please refer to the following links for details about the different database releases and Oracle tools.
    Oracle Timeline
    http://www.oracle.com/timeline/index.html
    http://www.oracle.com/oramag/profit/07-may/p27anniv_timeline.pdf
    Oracle Corporation - Oracle FAQ
    http://www.orafaq.com/wiki/Oracle_Corporation
    Oracle E-Business Suite consists of Application/Database/Client tiers, you can find more details in [Oracle Applications Concepts|http://www.oracle.com/technology/documentation/applications.html] manual.
    Oracle Forms
    http://en.wikipedia.org/wiki/Oracle_Forms
    Regards,
    Hussein

Maybe you are looking for

  • How do I get my e-mail address into my profile

    I click on options (then wait a very long time) My email is shown as null. I follow the click here link to update it but get a box asking me if I am a new user, and the email requires a password, I don't understand why. If I enter a password and my e

  • Configuring custom database authentication in Weblogic 10

    Hi, For my project I am trying to configure security/login module. It's an ADF based web application(ADF11g) and is deployed on Weblogic10. I have implemented the custom authentication with DB login module, created the jar and placed it inside %WL_HO

  • Problems with SSI on OS X 10.5 desktop version

    I just upgraded (format and install) to 10.5.4 and I went to enable server side includes. I uncommented the two lines AddType text/html .shtml AddOutputFilter INCLUDES .shtml and I added index.shtml to the DirectoryIndex line as well as adding Includ

  • TOC is not showing in document

    The TOC is not showing up in the Document Inspector. I have no way of actually creating one. Help.

  • Contact Person Replication Problem - Updating could not be completed

    Dear Experts, I'm facing the problem when replicating contact person from CRM to R/3. It only happen when changing the bp/contact person that paired (with contact person relation type) to more than 5 customer/bp and it always error when replicating t