How to access the jpanel and other components on click of a button

hi ,
need help,how to access the components of a frame onclick of a button ,if the actionPerformed() is written in a seperate class.
in my code
button.addActionListener(new Xyz());
Xyz is implementing the ActionListener.
in actionPerformed() i want to access the components in the frame.
thanks.

public class Xyz implements ActionListener{
  JFrame frame;
  Component[] comps;
  public Xyz(JFrame f){
    frame = f;
    comps = frame.getContentPane().getComponents();
  public void actionPerformed(ActionEvent e){
    // access elements in comps array
button.addActionListener(new Xyz(this)); // if 'this' is a JFrame in question

Similar Messages

  • How to print the content of a textarea by clicking on a button?

    Hello, i'm currently developping a HTML Editor in java but i've got a problem with printing job... Does anyone know a simple code to print the content of a textarea by clicking on a button?
    for instance:
    JTextarea textarea = new JTextArea();
    JButton print = new JButton ();
    file_menu.add(print) ;
    print.addActionListener(
    new ActionListener()
    public void actionPerformed(ActionEvent event)
    ////----> what could i put here to print the content of my textarea named 'textarea' ?
    I've searched on the web but i didn't find it...
    Thanks very much for your help...
    S�bastien

    I've never tried it, but here's an article that might help:
    http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-Printing.html

  • How to access the currentPage and currentNode Objects in a Sling Servlet

    I have a requirement to write a Sling Servlet instead of regular CQ5 JSP
    In a standard CQ5 JSP it's easy to use the currentPage and currentNode objects, as they are automatically added by the default includes
    <%@include file="/libs/foundation/global.jsp"%>
    <h2>currentPage</h2>
    Title: <%= currentPage.getTitle() %><br />
    Name: <%= currentPage.getName() %><br />
    Path: <%= currentPage.getPath() %><br />
    Depth: <%= currentPage.getDepth() %><br />
    <h2>currentNode</h2>
    Title: <%= currentNode.getProperty("jcr:title").getString() %><br />
    Name: <%= currentNode.getName() %><br />
    Path: <%= currentNode.getPath() %><br />
    Depth: <%= currentNode.getDepth() %><br />   
    </div>
    I would like to know how to do this in a sling servlet, and be able to use the currentNode and currentPage objects.
    Does anyone have any code samples they would like to share??
    Thanks
    Tyrone

    currentPage - request.getResource().adaptTo(Page.class)
    currentNode - request.getResource().adaptTo(Node.class)

  • How to access the library and properties in captivate 8

    hello ...i should see the library and the properties buttons in the upper right corner of my screen...
    but i do not....please advise....i need to know how to do that...

    Please check if you get the same buttons for library and properties as mentioned in the screen shot below.
    Please click on the library or properties as indicated in the screenshot.
    If you still face any concerns please post your screen shot how exactly you are getting the library and properties button in Captivate.
    Regards,
    Rajeev.

  • I have created another user on our iMac but cannot figure out how to access aperture, excel and other purchased applications on the new desk top

    I have created an additional user on our iMac and have tried to set up file share but nothing happens.  I have an empty desktop and only the applications that came with the computer appear.  I'd like to have access to the others that we've purchased... Aperture, excel, etc.  I've followed the instructions for file sharing but I must be missing something. 
    Thanks for any assistance.

    Rebecca1952,
    You are over complicating things.  File sharing has nothing to do with what applications that each user has access to.
    To me it sounds like you just need some basic help getting the applications that you need onto your dock.
    Try this:
    Login to you new user account
    Click on an empty part of your desktop
    Click on the "Go" menu and select "Applications"
    A Finder window should open showing ALL of the applications on the Mac.
    Double-click one of them that you will use frequently (e.g. Excel)
    Once it is up and running you should see it's icon down on your dock.
    Right-click that icon on the dock, then select "Options", and "Keep in Dock"
    Once you have added each application to the dock in this manner, then it will remain there even after you quit the application.
    For one more expert way to launch any application on your mac quickly, try this:
    Hold the [command] key and hit the [spacebar] (this will start a Spotlight search)
    Start typing the name of the application you want to run (e.g. "Aperture")
    Once you see "Aperture" selected, simply hit the [return] key and Aperture will launch
    Hope this solves you problem.

  • How to ZOOM the JFrame and its components ?

    Hi
    I could not find any solution/suggestions for this, so I am asking help.
    I am adding multiple components (JLables, JtextFields and a JTable) in to Jpanel(s) and to a JFrame window and I want to add Zoom (+ or - ) functions.
    I don't want to take each and every component from JFrame/ JPanel(s) and resize or repaint.
    Is there any way, that you can increase and decrease the whole JFrame and JPanel's view so that the components, which are been added to them, look like their sizes are also increased / decreased?
    Any suggestions or help would be appreciated.
    Thanks.
    Regards,
    Vally.

    ok...
    god bless the "GlassPane"
    you can take a snapShot of your frame...
    draw it on your glassPane..
    and just use your glassPane
    to paint the image with the requested size...
    in this approach you cant press a button and to things..
    shay

  • How to access the BIOS and Satellite L40

    I need to go into the BIOS. How can this be accomplished?
    Cheers,
    Chris

    > Booting from the Win XP CD does not work, regrettably. Something with the SATA driver. Looks like a play to force end users to buy Vista.
    BIG NONSESE!!!!
    You need SATA drivers before you would continue with XP installation!
    I think you should read some threads here before making some assumptions
    On the Toshiba page you will find a Intel Storage Manager
    This package includes the SATA drivers!

  • Access the styles and defined names of an excel sheet in apps for office

    Hi Everyone,
    Can you please let me know how to access the styles and defined names of an excel sheet in apps for office ?
    Technologies/language  used:office JS ,Jquery and apps for office
    any help in this is highly appreciated
    Thanks!!
    Santosh Sutar 

    Hi,
    I’m not sure if I understand your question correctly, so please correct me if I have any misunderstandings.
    For the defined names, I assume you mean the named range. If so, you can create the binding to the named range through
    Bindings.addFromNamedItemAsync method.
    For the styles, I think the article below may give you some help.
    How to: Format tables in apps for Excel
    By the way, there are no methods to iterate the styles and named range through the current Office JavaScript API.
    If this is a feature you want to include in future versions of Office JavaScript API, please submit a feedback to
    Office Development Platform User Voice.
    Regards,
    Jeffrey
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I used a partitioned HDD for time machine, using a partition already containing other data files. I am now no longer able to view that partition in Finder. Disk Utility shows it in grey and "not mounted". Any suggestions of how to access the files?

    I used a partitioned HDD for time machine, using a partition already containing other data files. I am now no longer able to view that partition in Finder. Disk Utility shows it in grey and "not mounted". Any suggestions of how to access the files? Does using time machine mean that that partition is no longer able to be used as it used to be?
    HDD is a Toshiba 1TB, partitioned into two 500GB partitions.
    OS X version 10.9.2

    Yes, sharing a TM disk is a bad idea, and disks are cheap enough so that you don't need to.
    Now
    Have you tried to repair the disk yet

  • I have 2 game centers on 1 Apple ID and it willl only access 1 of them may someone tell me how to access the other one

    I have 2 game centers on 1 Apple ID and it will only access 1 of them may someone tell me how to access the other one

    You don't have to use the same ID for iCloud as you do for purchasing.  You can just set up iCloud using your other ID. 
    If your have already have another account, you have to go to Settings>iCloud, tap Delete Account, choose Keep on My iDevice when prompted, set up your new account with the other ID, turn on your iCloud data syncing and when prompted, choose Merge to upload your data to the new account.

  • Nokia Lumia 928 apparently died after an attempted Windows 8.1 update.  Replacement phone arrived the next day.  How can I restore my contacts, photos, etc.?  Backup assistant is no help and I don't know how to access the Cloud.

    Nokia Lumia 928 apparently died after an attempted Windows 8.1 update.  Replacement phone arrived the next day.  How can I restore my contacts, photos, etc.?  Backup assistant is no help and I don't know how to access the Cloud.

    Did you have the phone set to backup things to the One Drive on Microsoft servers?

  • How to access the Custom Data type variable given in Expression edit control To and From LabVIEW

    Hello, I would like to know how to access the custom data type variable given in the Espression Edit Control from LabVIEW and vice-versa
    Say, the FileGlobals.Reference_Handle (Custom Data Type Variable) contains the
    VISA I/O session (Which in turn contains VISA_DeviceName: String, Session: Number),
    Channel1: Number and
    Channel2: Number
    I am expecting the user to give FileGlobals.Reference_Handle as the input at the ExpressionEdit Control in the edit screen of the VI Call.
    I would like to know how to get the values of this custom data type to LabVIEW?
    Say, if I have the Cluster in LabVIEW like VISA I/O session (Deive Name and Session Number), Channel1 and Channel2
    how do i need to set this cluster to the Custom Data type variable in TestStand?
    Thanks and Regards
    Prakash 

    Hi,
    TestStand to LabVIEW: i didnt understand what you r trying to achieve. But if you are using references, Use Property nodes and Invoke nodes to achieve what you want in LabVIEW.
     LabVIEW to TestStand: check the image below: You need to click the button next to 'container'. I have used a cluster output in the VI.
    Hope this helps
    .......^___________________^
    ....../ '---_BOT ____________ ]
    ...../_==O;;;;;;;;_______.:/
    Attachments:
    1.JPG ‏187 KB

  • How to access the Requirements property (& subproperties) of steps and sequences with the TestStand API

    The concept of associating teststand objects to unit requirements for traceability purposes was added to TS 3.5, and I need to find out how to access the array of strings used to store unit requirements in step objects, sequence objects and sequencefile objects. The teststand help file points out that the requirements list of a sequencefile object is accessible using the PropertyObjectFile interface, and also points out that Requirements is a property of the sequence and step classes. Furthermore it implicitly states that the requirements property has a Links subproperty which is an array of strings, but that is pretty much the extent of the documentation on this new feature so far. There seems to be no expression function available to get to those requirements either.
    I know that this feature was added to allow TestStand to interface with RG, and I am planning on using RG, but I would also like to do things with the requirements information within TestStand.
    Anyone? 

    Are you talking about the Requirements Gateway?  It is a separate product from NI that will do what you are looking for.  I haven't used it so I am not sure of the API chain to make it work.  Take a look and see if that is what you were thinking of.
    Hope that this helps,
    Bob Young
    Sorry, I just re-read your original post and see that you are looking to also use the Requirements Gateway, so you obviously know about it.  I don't know what the API changes were that made it work so I am not going to be much help.
    Sorry about posting before getting the correct information from the original.
    Bob Young
    Message Edited by Bob Y. on 08-24-2006 04:54 PM
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • HT1923 I get a message-error opening installationlog file. Verify that the specified lof file location exists and is writeable-when I try to uninstall iTunes and other components

    I get a message-error opening installationlog file. Verify that the specified lof file location exists and is writeable-when I try to uninstall iTunes and other components. How can I uninstall and reinstall iTunes?

    Hey jemerritt,
    Thanks for the question. I understand you are experiencing issues with iTunes for Windows. The following resources may help to resolve your issue:
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    Issues installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    Thanks,
    Matt M.

  • How do I access the photos and videos from my computer that I backed up from my phone to verizon backup assistant plus?

    how do I access the photos and videos from my computer that I backed up from my phone to verizon backup assistant plus?

    You can download the PC (or mac) desktop application. 
    http://support.verizonwireless.com/clc/devices/knowledge_base.html?id=54607
    or you can sign into My Verizon ( http://www.verizonwireless.com/myverizon ) then navigate to MyVerizon/Manage & Store media.

Maybe you are looking for

  • OIM p.1.0.1 update to 9.1.0.2 bp018 error

    Hi,   I have updated oim 9.1.0.1 to 9.1.0.2 and then applies bp018 patch to it.   After applying the bp018 patch i am not able to create,update user's or not able to run any workflow(custom connector's) for provisioning.   And i am getting this error

  • Convert minutes to hh:mm:ss

    I have a column which holds the minutes (see example below), i need this converted to hh:mm:ss 236 233 232 212 Thanks,

  • RedHat WS and 11.5.10R2

    I'm going to try and install 11.5.10 on Redhat WS at home. Are there any issues with installing it on the WS version?

  • Auditing Alternatives with Application User Tracking

    I'm looking for an auditing solution that does exactly what Change Data Capture (CDC) does, except I need it to also track the application user that made the change.  I'm currently using SQL Server 2012 Enterprise and may be upgrading to 2014 later t

  • IMG Settings for  Workflow to trigger Eents

    Hi Friends, Can anybody tel me What are the settings in IMG to trigger any event for BOR : MKPF at the time of MIGO. Thanks, Narayan