JSpinner and MouseListener for EzCalendar

hi,
has anybody succesfully set a MouseListener to a JSpinner? I've tried to set it to the Spinner directly, to it's Editor, even to the underlying Component, but my MouseListener is never activated. It seems the JSpinner consumes all the mouse events itself without passing them on.
Background: I'd like to catch right-button clicks on a JSpinner.DateEditor to pop up the EzCalendar which was discussed her recently.
Any ideas are welcome...
Klaus

FYI:
((JSpinner.DefaultEditor) mySpinner.getEditor()).getTextField.addMouseListener(myMouseListener);dit it. The MouseListener had to be added to the underlying FormattedTextField. Duh!

Similar Messages

  • MaskFormatter with JSpinner and DateEditor?

    Hi,
    I'm trying to apply a MaskFormatter to the DateEditor on a JSpinner. We want the ability to both manually edit the fields by hand AND/OR click the up/down arrows.
    The one gotcha is that when manually entering the values, we want to set a mask on the field so the user doesn't have to type in the ":" when separating the time fields. Right now, when they can delete all the text in the spinner textfield.
    I've dug through the source code of JSpinner and it appears that I should be able to get the editors JFormattedTextField and set the MaskFormatter as part of the AbstractFormatFactory. But all I end up with is a blank JSpinner and I can't type in the textfield.
    Below is my code:
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.util.Calendar;
    import java.util.Date;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JSpinner;
    import javax.swing.SpinnerDateModel;
    import javax.swing.SpinnerModel;
    import javax.swing.text.DefaultFormatterFactory;
    import javax.swing.text.MaskFormatter;
    public class MaskedFieldTest {
         public static void main(String[] args) {
              final JFrame f = new JFrame("Textfield demo");
              f.setDefaultCloseOperation(f.DISPOSE_ON_CLOSE);
              f.addWindowListener(new WindowAdapter() {
                   public void windowClosed(WindowEvent e) {
                        System.exit(0);
              f.setSize(250, 70);
              try {
                   // Create a spinner
                   JSpinner spinner = new JSpinner();
                   // Set up a dummy calendar for the model
                   Calendar calendar = Calendar.getInstance();
                   Date initDate = calendar.getTime();
                   calendar.add(Calendar.YEAR, -100);
                   Date earliestDate = calendar.getTime();
                   calendar.add(Calendar.YEAR, 200);
                   Date latestDate = calendar.getTime();
                   // Set the model
                   SpinnerModel dateModel = new SpinnerDateModel(initDate, earliestDate, latestDate, Calendar.YEAR);
                   spinner.setModel(dateModel);
                   // Create the dateeditor using the time format we want displayed in the spinner
                   JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(spinner, "hh:mm:ss a");
                   // Create a mask for editing so we don't have to manually add the :
                   MaskFormatter fmt = new MaskFormatter("##:##:## UU");
                   // Get the factory from the editor and set the maskformatter for the editing portion
                   DefaultFormatterFactory form = (DefaultFormatterFactory)dateEditor.getTextField().getFormatterFactory();
                   form.setEditFormatter(fmt);
                   // Finally, assign the editor to the spinner
                   spinner.setEditor(dateEditor);
                   // Display the panel
                   JPanel panel = new JPanel();
                   panel.add(spinner);
                   f.getContentPane().add(panel);
                   f.setVisible(true);
              } catch (java.text.ParseException e) {
                   e.printStackTrace();
    }If you run the code, you'll just get an empty JSpinner and you can't do anything in the textfield even though it is enabled.
    I'm running JDK.1.4.2_09 on Windows XP SP2
    Has anyone used a MaskFormatter with a DateEditor on a JSpinner before?
    Thanks,
    - Tim

    see weebib's post here
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=581804

  • KeyListener and MouseListener...How?

    I have a JTable and I want to add some KeyListener and MouseListener events to do following functions:
    - When PageDown is pressed, function NextPage(){...} is invoked
    - When a row is selected, then press Enter, function Select(){...} is invoked
    - Or when a row is clicked, function Select(){...} is invoked
    - When ESC is pressed function Exit(){...} is invoked
    Thanks all your help and sorry for my poor English :)

    I think you should look at using Actions. Here is a simple example that shows how to map Actions to KeyStrokes:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class KeyboardAction extends JFrame
        public KeyboardAction()
            JPanel panel = new JPanel();
            setContentPane( panel );
            JTextField textField1 = new JTextField("Ctrl+1 or Ctrl+2", 10);
            panel.add( textField1 );
            JTextField textField2 = new JTextField("Ctrl+2", 10);
            panel.add( textField2 );
            //  Change the input map of the text field,
            //  therefore, Ctrl+1 only works for the first text field
            Action action1 = new SimpleAction("1");
            Object key1 = action1.getValue(Action.NAME);
            KeyStroke ks1 = KeyStroke.getKeyStroke(KeyEvent.VK_1, KeyEvent.CTRL_MASK);
            textField1.getInputMap().put(ks1, key1);
            textField1.getActionMap().put(key1, action1);
            //  Change the input map of the panel
            //  therefore, Ctrl+2 works for both text fields added to the panel
            Action action2 = new SimpleAction("2");
            Object key2 = action2.getValue(Action.NAME);
            KeyStroke ks2 = KeyStroke.getKeyStroke(KeyEvent.VK_2, KeyEvent.CTRL_MASK);
            panel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks2, key2);
            panel.getActionMap().put(key2, action2);
        class SimpleAction extends AbstractAction
            public SimpleAction(String name)
                putValue( Action.NAME, "Action " + name );
            public void actionPerformed(ActionEvent e)
                System.out.println( getValue( Action.NAME ) );
        public static void main(String[] args)
            KeyboardAction frame = new KeyboardAction();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setVisible(true);
    }Here is section in the Swing tutorial that explains more about key bindings and Actions:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html

  • Colors of JSpinner and JComboBox

    hello
    I like to change the fore- and backgroundcolors of JSpinner and JComboBox. how can I do this?
    thanks in advance! nix

    this is much easyer code I will use it.
    but the button is anyway gray and black!?You want to change the color of the arrowButton and arrow color?
    there's probably an easier way, but this worked OK for me
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.plaf.basic.BasicSpinnerUI;
    import javax.swing.plaf.basic.BasicArrowButton;
    class Testing extends JFrame
      public Testing()
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setLocation(400,300);
        JSpinner spinner = new JSpinner(new SpinnerNumberModel(50, 0, 100, 5));
        spinner.setUI(new MyUI());
        ((JSpinner.DefaultEditor)spinner.getEditor()).getTextField().setBackground(Color.GREEN);
        JPanel jp = new JPanel();
        jp.add(spinner);
        getContentPane().add(jp);
        pack();
      public static void main(String[] args) {new Testing().setVisible(true);}
    class MyUI extends BasicSpinnerUI
      protected Component createNextButton()
        JButton btn = (JButton)super.createNextButton();
        JButton btnNext = new MyBasicArrowButton(SwingConstants.NORTH);
        btnNext.addActionListener(btn.getActionListeners()[0]);
        btnNext.setBackground(Color.BLACK);
        return btnNext;
      protected Component createPreviousButton()
        JButton btn = (JButton)super.createPreviousButton();
        JButton btnPrevious = new MyBasicArrowButton(SwingConstants.SOUTH);
        btnPrevious.addActionListener(btn.getActionListeners()[0]);
        btnPrevious.setBackground(Color.BLACK);
        return btnPrevious;
    class MyBasicArrowButton extends BasicArrowButton
      public MyBasicArrowButton(int direction)
        super(direction);
      public MyBasicArrowButton(int direction,Color background,Color shadow,Color darkShadow,Color highlight)
        super(direction,background,shadow,darkShadow,highlight);
      public void paintTriangle(Graphics g,int x,int y,int size,int direction,boolean isEnabled)
        Color oldColor = g.getColor();//Note 1: all if(!isEnabled) code removed, for brevity
        int mid, i, j;                //Note 2: all EAST / WEST code removed, for brevity
        j = 0;
        size = Math.max(size, 2);
        mid = (size / 2) - 1;
        g.translate(x, y);
        g.setColor(Color.GREEN);//<-------------------set arrow colors here
        switch(direction)
          case NORTH:
            for(i = 0; i < size; i++)
              g.drawLine(mid-i, i, mid+i, i);
            break;
          case SOUTH:
            j = 0;
            for(i = size-1; i >= 0; i--)
              g.drawLine(mid-i, j, mid+i, j);
              j++;
            break;
        g.translate(-x, -y);
        g.setColor(oldColor);
    }

  • Automatic TO creation and confirmation for a Material document

    Hi Dear All,
    i am new to MM andWM.
    I have to customization for auto transfer orders and confirmations for material documents what ever created with 101 movement type in Inventory Management. I have down configuration like below.
    SPRO->Logistics Execution->Warehouse Management->Activities->Transfers-> Set Up Autom. TO Creation for TRs / Posting Change Notices
    Double click on ‘control data ‘tab
    Hear for my warehouse I given input like   Auto TO = ‘1’,
                                                                             AddId = ‘select check box’.
    And in ‘Assign control’ tab for 101 movement type I have given input like below.
    Automatic TO = ‘1’.
    TO item can be confirmed immed. = ‘tick checkbox’
    Propose Confirmation = ‘tick checkbox’.
    Foreground/Backgrnd = ‘D’.
    After creating of Material document I am executing report RLAUTA10 in SE38.When I execute this report system showing message like ‘TO processing finished: TR total:   17, TO created:    0, Errors:   17’.
    If I check header details of transfer requirements in LB03, i am not seeing ‘Tick Mark’ in Auto TO Creation field.
    Can any one tell me what the mistake i have down or if i need to do any further configuration. Please help me regarding this concern?
    Thanks in Advance..

    Dear Steve,
    Thanks a lot for giving reply with what I need to do, but I am unable to see result.
    I have down configuration like below even though system not processing Auto TO creation. Can you explain me if I have down any mistake below.
    Click on ‘Assign’ button,
    Press on ‘New entries’
    WhN = ‘900’
    Reference Movement Type = ‘101’
    Movement indicator = ‘B’
    Movement type for Whse Mgmt = ‘101’
    TR create Transfer Requirement = ‘X’
    Immed.TO Creation
    Mail confirmation for background processing = ‘01’.
    GR date = ‘2’

  • Need help to open and look for file by name

    Hi,
            Im needing help to open a folder and look for a file (.txt) on this directory by his name ... The user ll type the partial name of file , and i need look for this file on the folder , and delete it ....
    How can i look for the file by his name ?
    Thx =)

    Hi ,
        Sry ,, let me explain again ... I ll set the name of the files in the follow order ... Name_Serial_date_chanel.sxc ..
    The user ll type the serial that he wants delete ...
    I already figured out what i need guys .. thx for the help ^^
    I used List Directory on advanced IO , to list all .. the Name is the same for all ... then i used Name_ concateneted with Serial(typed)* .. this command serial* ll list all serials equal the typed , in my case , ll exist only one , cuz its a count this serial .Then i pass the path to the delete , and its done !
    Thx ^^

  • Hi. I am using a time capsule for few PC s. I have made 5 different account to access time capsule. but in windows when i enter account name and password for one account, i cannot access other accounts, because windows saves username

    Hi. I am using a time capsule for few PC s. I have made 5 different account to access time capsule. but in windows when I enter account name and password for one account, i cannot access other accounts, because windows saves username. how can i prevent this from happenning. I really need to access all my accounts and dont want it to save automaticlly.

    Why have 5 accounts if you need to access all of them.. just have one account?
    Sorry I cannot follow why you would even use the PC to control the Time Capsule. Apple have not kept the Windows version of the utility up to date.. so they keep making it harder and harder to run windows with apple routers.

  • "securely" use one ethernet interface for WAN and other for the LAN

    I am reconfiguring our dual 2.7 Intel Xserve running MacOSXServer 10.5.4, and had a question.
    Is it possible (or advisable) to use en0 to perform LAN services, and then configure en1 to only allow access to very limited service. VPN, FTP, CALDAV and later Mail.
    I imagine that this is possible via a firewall configuration, but first I do not know how to specify interface in addition to ports, and second I don't know how advisable this would be.
    Currently I have a DSL package from ATT with 5 static IP addresses. I have an Airport Extreme set up as one of those addresses providing DHCP and NAT to the LAN. I am using the LAN ports on the back of that to bridge my three switches (2 managed [clients and oce print server 100 base-T] and 1 unmanaged [ laser printers and copier 10 base-T]).
    I have the LAN based on 192.168.0.x, with the Xserve at 192.168.0.5. I have DNS configured and working (Thank you Antonio Rocco)
    I have 20 LAN clients, 18 mac 1 PC and one PC via Parallels. I will have no more than 1 or 2 WAN clients at any one time
    I provide AFP, SMB, Directory Services currently. As part of the reconfigure, I desire to take better advantage of the collaboration tools to provide wikis and CALDAV services. I also want to allow our employees to publish their individual calendars, so that they can subscribe to them at home, or vice versa.
    I would like to configure VPN, one for me to access configurations when I am away using Remote Desktop (I have used command line to some extent, but still feel more comfortable with the GUI tools) and second for limited access to content for certain users.
    It would also be very helpful for us to have a FTP site. It is unnecessary for this the be a FQDN service, sending the IP address is perfectly acceptable as we only use a service like this 10-15 times a year.
    (Related but unimportant in the grand scheme, is there a way to generate a link to the FTP server that you could email that not only is a link, but also a temporary username and password?)
    Thank you in advance,
    Ion Webster

    First, I missed a zero in the network speeds, I have two managed GbE switches that have all of the GbE capable machines connected to them, and an unmanaged GbE switch that has all the 10 or 100Base-T connections. My apologies for the mistake. That was one of the reasons I went with the GbE capable Airport to bridge the switches.
    Ok, I had been leaning towards a separate hardware firewall, but here is also where there is a hole in my knowledge. Do I need to look at something like the Linksys RVS4000 which bills itself as a +"4-Port Gigabit Security Router with VPN. Secure, smart Gigabit networking for growing business"+ I would like easy configuration, as I take care of these systems in addition to my job, rather than full time. This will be the first time I have set up a VPN connection, so even though I have spent a lot of time researching the manuals, and reading Schoun Regan (Apple Training Series) I don't have real world experience here. So if I buy more hardware, I want it to be the product that will provide the protection, and also allow me to configure it so that I can get these services running. All my VPN clients are running Macs, most on an AIrport connection and have their IP ranges in the 10.0.1.x range. all but one is on OS 10.5.x so I have a fairly homogeneous set of machines to make work together.
    I will review the links you provided regarding static routing, but I do believe the hardware solution is a better one, and wish to pursue it, for all the reasons you give, and that in the brief perusal of the links, it is more than I want to tackle.
    As far as FTP vs sFTP, I have no preference. I simply want a way to have online storage for transfer of large files on occasion. Ideally I want a folder, or a series of folders that are accessible for my LAN users to put items in and take them out, and for my (s)FTP users to do the same
    So long story short, the hardware solution I would like to purchase, I need to be able to do the following:
    VPN connections for content access and ARD access ( knew about and will ensure differing IP ranges)
    (s)FTP
    Calendar publishing
    mail(at a later time)
    Thank you for your help thus far.
    Ion Webster

  • HT204053 i accidently set up one account for i cloud and one for itunes. suggestions on how do i update this to only the one. please on how do i change my icloud to be the same as my itunes acct. thanks

    i accidently set up one account for icloud and one for itunes; suggestions on how to correct this and use just one account for both.... thanks

    If you want to change your iCloud ID to another existing ID you'll have to delete the account, create a new account with the other ID, and migrate your data to the new account.  To do this, first go to Settings>iCloud on your phone and turn all data you are syncing with iCloud (contacts, calendars, etc.) to Off.  When prompted choose to keep the data on your iPhone.  (If you are syncing iWork documents with iCloud, also open your iWork apps and turn off iCloud syncing and choose to keep the documents on your phone.)  After everything is turned off, scroll to the bottom and tap Delete Account.  Next, set up a new iCloud account using your other ID, then turn syncing for your data (contacts, etc.) back to On.  When prompted, choose Merge.  This will upload the data to your new account.
    This will not move your photo stream, however.  If you have photos in photo stream that aren't in your camera roll and that you haven't backed up anywhere else you will need to save these before deleting the account.  To do this, open your photo stream album on your iPhone in the thumbnail view, tap Edit, tap all the photos to select them, tap Share, then tap Save to Camera Roll.  You can then delete the iCloud account and your photos will stay in your camera roll.

  • I have 2 macbooks each with an account for me and one for my wife. I use one Macbook logged in with my account and my wife uses the other Macbook only loged in on her account. We both make regular time-machine back-ups each on a separate external disk

    I have 2 Macbooks each with an account for me and one for my wife. I use one Macbook logged in with my account and my wife uses the other Macbook only logged in on her account. We both make regular time-machine back-ups each on a separate external disk. Is it possible to update her account on my macbook using her external disk without overwriting my stuff on the same Macbook and vice versa?

    Time Machine does not do individual accounts. It records the complete drive. So if you were to use her TM backup on your Mac it would make your Mac just like hers. Both yours and her account on your MAC.
    Just copy the missing files over from her Mac to yours. If there are differennt programs on each then they would need to be installed on both.

  • Ok, I have two itunes library account one for the PC and one for my Mac, I have my first iphone on my PC, but i just upgrade and I would like to use my new iphone on my Mac but all of my apps and other stuff is in the first library.. How do I put my apps

    ok, I have two itunes librarys account, one for my PC and one for my Mac, I use the PC for my iphone, but I upgrade my iphone and all my apps and
    stuff is on the first itunes library. How do I put the apps from one iphone to the otherusing two dirffernt itunes library? please help..

    Drrhythm2 wrote:
    What's the best solution for this? I
    Copy the entire /Music/iTunes/ folder from her old compouter to /Music/ in her account on this new computer.

  • One account for itunes match and one for all the rest?

    Hello everybody
    I was wondering how to use an Apple ID for iTunes Match and other for iCloud and backups. I found an article on the website that said that you actually can do that, but my question arises when I find out that now I only use one ID, all my apps are in there, along with my iPhone backups and stuff. So, if I create an ID for subscribing to iTM, will I lose the ability to update my apps on the old ID?
    Please help!
    The article is: http://support.apple.com/kb/HT4895
    Cheers

    I know, but I can't use my credit card on my iTunes Store account, since it's a US ID. What if I change the country of my ID? How often can I change it? I was thinking of changing it, purchasing iTM, and then changing it back... can I do that?
    Thank you

  • HT204053 i use one apple id for icloud and one for itunes  and now it wont let me since i reset my phone now  i up graded to iphone 4s still the same problem

    please help me fix this problem I have one id  for icloud and one for itunes that i share with my husband

    If the old ID is an earlier version of your current ID, temporarily recreate the old ID by going to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Click edit next to the primary email account, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iPhone, even though it prompts you for the password for your old account ID. Then save any photo stream photos that you wish to keep to your camera roll.  When finished go to Settings>iCloud, tap Delete Account and choose Delete from My iPhone when prompted (your iCloud data will still be in iCloud).  Next, go back to https://appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

  • Can you have two Apple IDs on one IPAD? One for school and one for home?

    Can you have two Apple IDs on one IPAD? One for school and one for home?
    If so do you know how to do it?

    It depends on what you want to do.
    You could, for example, have one AppleID for iCloud backup [and therefore message syncing, notes syncing, etc] and a second one for iTunes [music, iBooks, etc].
    But if you are looking for a way to flip everything between different appleIDs, then no.

  • At times when dragging the vertical scroll bar my computer screen oscillates up and down for some time before going blank or not responding to any clicks requiring a forced system restart. What is wrong?

    Hi,
    Suddenly while working with Firefox if I happen to drag the vertical scroll bar, a very abnormal behavior occurs. My screen dances up and down for a short time before either going black or getting restored but with no clicks working. The only way to resume is to force a restart of the system.
    Any help would be deeply appreciated.
    Thanks and Regards
    Deepak

    That didn't work. On trying to install a new driver I got the error the graphics driver could not find compatible graphics hardware. Is there anything else that can be done to at least prevent the hanging of the computer even if it means less features from Firefox being available?

Maybe you are looking for

  • Utilization(J2IUN) in case of Sales plant and Mfg plants are different

    Hello, we are having two company codes 1000 and 2000, 1000 is having the Manufturing plant- 1000 2000 is having the sales plant      - 2000 Both the plant are having the same excise group-10 The company will procure a materials in 1000 plant and CENV

  • Please tell me The Procedure to open apple reseller store

    Hiii, I am a post graduate in Inetrnational Business And Marketing From Amity university (india) . I want to open apple reseller store or a service center. please tell me the procedure and investment Thanx Ankit Sharma <Email Edited by Host>

  • How to see changes in all BOM" s under plant for a period ?

    Hi Gurus, i want to see the list BOM's which was changed with in period and the details of changes like Quanity and user names who have done the change. Regards, mahesh.

  • Circular scanning and smoothing

    hi! I am working on an image processing program. The project involves capturing images of Haidinger intereference fringes and analysing them. I am able to acquire the image, and can find the center of the fringes using a Vision script and a low pass

  • Pages file can't be opened

    Hi, I was working on a pages file, then a message appeared, once i selected the "Revert" option, the file has been closed and i can't re-open it again. the message is: " the file name.pages" can't be opened. i upgraded all versions and deleted the ol