Is it possible to add an Actionlistener to a JPanel?

Hi
Is it possible to add a listener to a panel that would react when the mouse button was pressed whilst over the panel.
I have panels displying data and when the user clicks on th panel I wish to expand the data for better viewing.
Mickp

Do I add the mouselistener to the panel itself or do I add it to the Frame and have to determine that the mouse is over the panel?
MIckp

Similar Messages

  • IS IT POSSIBLE TO ADD A SCROLL PANE TO A PANEL??

    Hi, Im trying to add a scroll pane to a panel but when I compile the code and try to open the form - a 'Illegal Argument Exception' is produced. Can anyone tell me whether it is possible to add a scroll pane the actual panel itself and also the code to do this.     
    Many Thanks, Karl.
    I have added some sample code I have created -
    public RequestForm(RequestList inC)throws SQLException{
              inRequestList = inC;
              displayForm();
              displayFields();
              displayButtons();
              getContentPane().add(panel);
              setVisible(true);
         public void displayForm() throws SQLException{
              setTitle("Request Form");
              setSize(600,740);
              // Center the frame
              Dimension dim = getToolkit().getScreenSize();
              setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2);
              getContentPane().setLayout(new BorderLayout());
              Border etched = BorderFactory.createEtchedBorder();
              panel = new JPanel();
              panel.setLayout( null );
              //panel.setBackground(new Color(1,90,50));
              Border paneltitled = BorderFactory.createTitledBorder(etched,"");
              panel.setBorder(paneltitled);
              scrollPane1 = new JScrollPane(panel);
              scrollPane1.setBounds(0, 0, 600, 740);
              panel.add(scrollPane1);
    }

    Hi all,
    I am still having trouble here. would it be posible to add a scrollpanel to this form? Can anyone provide me with a working piece of code so I see how it actually works.
    Any help would be greatly appreciated.
    Many Thanks, Karl.
    Code as Follows:
    /* ADMIN HELP Manual*/
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.util.*;
    public class AdminHelp extends JFrame implements ActionListener{
         private JButton exit;
         private JLabel heading1, help;
         private JPanel panel;
         Font f = new Font("Times New Roman", Font.BOLD, 30);
         private JScrollPane scroll;
         public AdminHelp(){
              setTitle("ADMIN Help Manual");
              setSize(400,325);
              // Center the frame
              Dimension dim = getToolkit().getScreenSize();
              setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2);
              panel = new JPanel();
              panel.setLayout(null);
              exit = new JButton("Close");
              exit.setBounds(280,260,100,20);
              exit.addActionListener(this);
              panel.add(exit);
              exit.setToolTipText("Click here to close and return to the main menu");
              getContentPane().add(panel);
              show();
              public void actionPerformed(ActionEvent event){
              Object source = event.getSource();
                   if (source == exit){
                        dispose();
              public static void main(String[] args){
                   AdminHelp frame = new AdminHelp();
                   frame.addWindowListener(new WindowAdapter(){
                   public void windowClosing(WindowEvent e){
                   System.exit(0);

  • Is it possible to add action to JLable component?

    Is it possible to add action to JLable component?

    I assume you are talking about an ActionListener? In which case the answer is no. But, you can add a MouseListener, MouseMotionListener, KeyListener and a few other ones as well. There's nothing an ActionListener can do that a well used MouseListener can't.
    HTH,
    BenW

  • Is it possible to add markups to a PDF that I am not the author of

    Most of the PDFs I generate are from other applications (like Autocad) where I "print to PDF" to create the file.   Most of the PDFs I recevie are generated the same way.   Prior to Acrobat Reader 8, it was simple for me and my collueges to exchange information on these PDFs by using markup tools and resending them with markups.   Since Acrobat 8 has come along, I now find it impossible to markup a drawing (no matter if I have created it using Print to PDF or if someone has sent it to me).  I went to the knowledge base and see that the drawing has to be enabled for markup in one of 2 ways
    In an open PDF, choose Comments > Enable For Commenting In Adobe Reader, and then save the PDF.  
    Start the wizard to initiate a shared review or an email-based review and follow the on-screen instructions. When you’re finished, commenting is enabled in the PDF that you specify for the review. 
    Well, there is no Comments selection in my toolbar.   Second method is given by
    Quickstart: Start an email review
    An email-based review lets you track review status and merge received comments into the PDF.
    Click Review & Comment and choose Attach For Email Review.
    If prompted, enter your identity information to create a reviewer profile.
    Follow the on-screen instructions to select the PDF, invite reviewers, and send the email invitation.
      If your email application doesn’t send email automatically, you may need to answer alert messages and switch to your email application to finish sending the message
    But there is no Review & Comment button to click.
    So, can someone tell me, can I still do a simple markup of any PDF?   Even if I have to jump through hoops can I?    I guess I can understand Why Adobe has done away with this feature in their free tool, as they were not getting any revenue off of it, but it greatly diminishes the usefulness of Acrobat Reader and therefore all PDFs for me.
    Thanks in advance for your response.

    To enable this right you need Acrobat, not the free Reader.
    However, starting from Reader X it is possible to add simple markups to any file, unless it has been specifically disallowed by the creator of the file.

  • In contacts there is the possibility to add a new event, as the birthdays, but they do not appear in iCal. Is there any way to make that possible? It is normal to have a person with his birthday, anniversary and others key dates you want to link to him.

    In contacts there is the possibility to add a new event, as the birthdays, but they do not appear in iCal. Is there any way to make that possible? It is normal to have a person with his birthday, anniversary and others key dates you want to link to such person, but the only one shows up is the birthday. How to be able to show all those dates linked to people in the agenda in the iCal?
    Thanks

    Hi,
    I sugggest you try my application, Dates to iCal. It is shareware with a 2 week trial period.
    Dates to iCal 2 is a replacement for Apple's birthday calendar for iCal. It has a range of features to allow the user to choose what, and what not, to sync to iCal from Address Book.
    As well as automatically syncing birthday dates from Address Book, Dates to iCal 2 can sync anniversary and custom dates. It can set up to five alarms for each date in iCal and can also set different alarms for birthdays and anniversaries. It allows the option of only syncing from one Address Book group. This application also allows for the titles of the events sent to iCal to be modified to the user's preference.
    Best wishes
    John M
    As I sell software on my site and ask for donations, the Apple Support Communities Use Agreement requires that I state that I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • Is it possible to add a graphics card to the back of my HP

    Hello  I want to know if it's possible to add a new graphics card to the back of a Laptop not inside of it but on the back of my laptop ???  my graphics Card is a Intel 4000 graphics card is a terrible for gaming TERRIBLE !!!  

    Not sure where it would go on the back, but no the system is closed. There is no place to insert a graphics card or attach it. You will find some hokey stuff on the internet where people say you can plug a video card in the wireless card slot but those are a hoax at worst and at best they do not tell you that such a thing would not even perform as well as what you have and is likely to damage the motherboard. 

  • Is it possible to add a backlit keyboard to an hp envy touchsmart 15

    is it possible to add a backlit keyboard to an hp envy touchsmart 15?

    Daevid.
    Yes you can.
    Your manual here.
    http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB8QFjAA&url=http...
    Page 20 chapter 3.
    REO
    HP Expert Tester "Now testing HP Pavilion 15t i3-4030U Win8.1, 6GB RAM and 750GB HDD"
    Loaner Program”HP Split 13 x2 13r010dx i3-4012Y Win8.1, 4GB RAM and 500GB Hybrid HDD”
    Microsoft Registered Refurbisher
    Registered Microsoft Partner
    Apple Certified Macintosh Technician Certification in progress.

  • Is it possible to add a hdmi port? Hp envy 23-d010ea all-in-one

    I wanted to get a Ps4 soon but i dont have a tv, and on my computer i dont have a hdmi port. i see on other models of my computer they have it for example on the 23-d052 its like this 
    Where as on my one is like this
    so that part is just an empty space. i was wondering if it were possible to add the hdmi port or if there was a way i could still play the ps4 on my computer?
    This question was solved.
    View Solution.

    The USB 3.0 to HDMI adapter referenced above, is only designed to connect to a USB port on you computer and output an HDMI signal to an HDTV or monitor. It will not allow you to connect the HDMI output of a game console to your computer.
    It may be possible to purchase all the components necessary to add that functionality to your computer, however the cost would far exceed the price of a new monitor or HDTV. Please purchase an inexpensive HDTV or monitor to use with your PlayStation.
    If you have any further questions, please don't hesitate to ask.
    Please click the White KUDOS "Thumbs Up" to show your appreciation
    Frank
    {------------ Please click the "White Kudos" Thumbs Up to say THANKS for helping.
    Please click the "Accept As Solution" on my post, if my assistance has solved your issue. ------------V
    This is a user supported forum. I am a volunteer and I don't work for HP.
    HP 15t-j100 (on loan from HP)
    HP 13 Split x2 (on loan from HP)
    HP Slate8 Pro (on loan from HP)
    HP a1632x - Windows 7, 4GB RAM, AMD Radeon HD 6450
    HP p6130y - Windows 7, 8GB RAM, AMD Radeon HD 6450
    HP p6320y - Windows 7, 8GB RAM, NVIDIA GT 240
    HP p7-1026 - Windows 7, 6GB RAM, AMD Radeon HD 6450
    HP p6787c - Windows 7, 8GB RAM, NVIDIA GT 240

  • Is it possible to add a new graphics card to my macbook pro 2011 13"

    Is it possible to add a new graphics card to my macbook pro 2011 13"?

    Hi W,
    Sorry, but no. It's soldered onto the logic board.

  • When creating a custom SearchPlugin, is it possible to add more code such as uppercase conversion of the SearchText and IF statements that change the URL depending on what is typed?

    When creating a custom SearchPlugin, is it possible to add more code such as uppercase conversion of the searchTerms and IF statements that change the URL depending on the searchTerms? Every time I try to add something firefox doesn't want to add it as a search plugin. I need to create a more powerful search tool for personal use.

    I've found some external software applications that will do it, so that leads me to believe its not possible within ID CC.

  • Is it possible to add more than one page at a time in pages - word processing?

    Is it possible to add more than one page at a time in pages - word processing?

    I haven't been able to find a way to add more than one page at a time.  I think you'll have to add them one at a time. 

  • Is it possible to add 16GB (2x8GB) of ram to the stock 8GB (2x4GB)  that is already in the iMac?   A total of 24GB (2x4GB, and 2x8GB)

    Purchasing the new 27" iMac
    Is it possible to add 16GB (2x8GB) of ram to the stock 8GB (2x4GB)  that is already in the iMac?
    A total of 24GB (2x4GB, and 2x8GB)
    upgrading memory on the new iMac 27"3.4GHz Quad-core Intel Core i7,
    8GB 1600MHz DDR3 SDRAM - 2x4GB
    3TB Fusion drive

    You can do it without any problem, but make sure you put the memory horizontally, so you will get the advantages of the Dual Channel. You can buy the memory in OWC or Crucial to make sure you have a compatible memory

  • Is it possible to add value item and non stock item in one billing?

    Is it possible to add value item and non stock item in one billing?

    Hi,
    Yes,it is possible .Take example of service scenario,where material used in servicing and service charges(labour) can be billed in single invoice.
    Billing document type,Customer and other header data should be same.
    Reward points if useful
    Regards,
    Amrish Purohit

  • Is it possible to add new line to existing Blanket Agreement through interface?

    Hi All,
    I need to add a new line to exisitng list of blanket agreements.
    I populated po_headers_interface and po_lines_interface and ran 'Import Price Catalogs' program.
    But this is only trying to update existing line instead of creating a new one.
    Please clarify whether it is possible to add just a line using the above process?
    tried multiple scenarios:
    action field in both tables - ORIGINAL - error, doc already exists.
    action field in both tables - UPDATE - updates existing line.
    action field - (UPDATE in hdr and ORIGINAL in line) - updates existing line.
    Thanks in advance.
    Girish

    Hi All,
    It's working now. populated action field as 'ADD' in po_lines_interface and it created a new line.

  • Is it possible to add more input values for a payroll element?

    Hi All
    I have created an element with 1 default input value 'pay value' and another input value '1xx1'. I have linked this to payroll and attached to many employees. Now due to business requirment, I need to add one more input value '2yy2' and also I need to change the formula. Eventhough its a minor change in formula, without a new input value it will not work. I tried to add a new one by datetracking to the element creation date without sucess.
    Is it possible to add input values after saving an element?
    Regards
    Rahman

    You can Change the Required Input Value to Not-required
    Alter the Sequence of the Input Value to be displayed in the Element Entry Screen
    You can Change the Input Value Validation Rule minimum, Maximum, Lookup and Formula
    Change your specification of which input values create Database Items. Note, however, you cannot remove Database Items if they are used in any formulas or QuickPaint reports.
    You cannot remove existing input values or add new one if you have created any entries for the element
    For more details you can refer http://ramesh-oraclehrms.blogspot.com/2007/08/maintaining-element.html

Maybe you are looking for

  • N95 8GB - cannot connect to PC

    Hi - read about this problem from a few people - I have just got a brand new N95 8GB from O2. Installed the cd software but it would just not find the phone using the USB. Ive tried different USB cables and ports to no avail. Ive uninstalled the soft

  • Reg:Function module SAPWL_GET_SUMMARY_STATISTIC not working in CRM ABAP 6.0

    Hi All,   When i execute the function module SAPWL_GET_SUMMARY_STATISTIC in CRM ABAP 6.0 passing the values below, PERIODTYPE                     HOSTID                          STARTDATE   it's not showing any values in the summary. it's showing the

  • Can we move SAP standard Function Group and Table defintion to BW

    Dear Forum, We are in a ‘pilot’ process of migrating SAP R/3 Custom development objects to our BW client and we have a few questions that we would like to know if possible. We are currently in the ‘To Be’ Blueprint Phase of migrating SAP 45B to ERP20

  • Sorting of the result on the page

    I have a set of records say 100, I am showing 10 at a time, now on each column name I have made a link, on the click of the same, I want to sort the data in the page alone, based on that column. How to go about it? TIA, Shanthi

  • Using an audio mixer with Onlocation

    Onlocation connects directly to the camera with firewire - but if I need to add an audio mixer - how can I do it?