Can I have my own implementation of java.awt.EventQueue

Hi guys,
Can I "override" the default implementation of java.awt.EventQueue? Some JVM/CVM tricks?
For any tips, Thanks!

I think what you're looking for is EventQueue#push(EventQueue).
public static void main(String[] args) {
        final EventQueue queue = new EventQueue() {
            public void postEvent(final AWTEvent theEvent) {
                super.postEvent(theEvent);
                System.out.println("postEvent "+theEvent);
        Toolkit.getDefaultToolkit().getSystemEventQueue().push(queue);
        final JFrame frame = new JFrame();
        frame.setContentPane(new JButton("Click Me"));
        frame.setSize(300, 300);
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }

Similar Messages

  • Can I provide my own implementation of java.security.acl.Acl ?

    Hi,
    If I write my own securrity realm, am I able to use my own implementaion of
    'java.security.acl.Acl' and 'java.security.acl.AclEntry' or do I have to use
    the implementation provided by weblogic ? When Security.checkPermission() is
    called, does it solely rely on APIs defined in 'java.security.acl' or does
    it really expect to talk to an instance of weblogic 'AclImpl' ?
    Thanks, Alexandre.
    Alexandre Vauthey
    Software Engineer
    Application Networks
    444 Ramona street
    Palo Alto, CA 94301

    Yes, you can do this.
    Alexandre Vauthey wrote:
    Hi,
    If I write my own securrity realm, am I able to use my own implementaion of
    'java.security.acl.Acl' and 'java.security.acl.AclEntry' or do I have to use
    the implementation provided by weblogic ? When Security.checkPermission() is
    called, does it solely rely on APIs defined in 'java.security.acl' or does
    it really expect to talk to an instance of weblogic 'AclImpl' ?
    Thanks, Alexandre.
    Alexandre Vauthey
    Software Engineer
    Application Networks
    444 Ramona street
    Palo Alto, CA 94301

  • How can i have a refrence of a java class object instance in my c++ project

    Hi!
    How can i have a refrence of a java class object instance in my c++ project. Is there a way?

    hahaxia wrote:
    The second question is the big one. The first question is half of the problem of "c++ to java" invocation and access. But the other half which is "java to c++ " invocation and access is still not solved. jni only provide the "java to c++ " DLL invocation Wrong,
    Using JNI your java classes can have methods implemented in C/C++.
    Using JNI you can call java classes.
    There is no other possible interaction between C++ and java, so it does it all.

  • I am part of a family sharing setup.  Can I have my own payment method so the organizer does not get charged for my purchases?

    I am part of a family sharing setup.  Can I have my own payment method so the organizer does not get charged for my purchases?  If so, how do I set this up?

    Yes.  Just redeem gift cards so that your own account always has a sufficient credit balance.  Here is how it works:
    Family purchases and payments
    After you set up your family, any time a family member initiates a new purchase it will be billed directly to your account unless that family member has gift or store credit. First, their store credit will be used to pay the partial or total bill. The remainder will bill to the family organizer's card.

  • How can i display multiple Pictures in a java.awt.Container best?

    hi,
    I just started with a new Project, it works just like a FileManager.
    On entering a directory all the files in it shall be displayed in a scrollable area. Displayed means here a Graphical representation of the file, in case of a picture a small preview version of it.
    I put together a javax.swing.JScrollPane with a java.awt.Container and viewport. The Container has a FlowLayout.
    Now for every image in a Directory I create a Component-class in witch I overwrote the public void paint(Graphics g) to display a scaled version of the image, this scaled version is created in the Constructor of my Component-class.
    this works fine for just a few images, but if i try to open a directory with a lot of pictures it takes a long time at the beginning and sometimes it just kills the application.
    so i changed in a way that only when a Component is in view of the visible rectangle of the scroll pane the scaled image will be created, and when the component gets out of view the image is set to null.
    now it is running without killing the application, but it takes way too long to scroll now, because the images are loaded all the time.
    so i figured i must be doing something wrong, so what is the best way to get small previews for up to a few hundred files and then display them in a scrollable area? (like in Windows Explorer if you activate the miniature preview)
    if anyone can give me some hints, that would be great
    thanks shirasuresh

    This might give you some ideas:
    import java.awt.*;
    import javax.swing.*;
    public abstract class LazyIcon implements Icon {
        private int width;
        private int height;
        private Image image;
        public LazyIcon(int width, int height) {
            this.width = width;
            this.height = height;
        protected abstract Image createImage();
        public int getIconHeight() {
            return width;
        public int getIconWidth() {
            return height;
        public void paintIcon(Component comp, Graphics g,int x, int y) {
            if (image == null)
                image = createImage();
            g.drawImage(image, x, y, comp);
    }You could also do this with a custom component class, but I like the JLabel + Icon combination.
    Any if you want to get fancy, you could load images in another thread, at low priority, so when the user is just sitting there, your code is preparing the panel for scrolling ;-)
    Message was edited by:
    BigDaddyLoveHandles

  • Can't find class when i use java.awt.Panel

    I got a Pocket PC with CE 3.0
    I made my first PJava application just a few hours ago. And it works fine. But when i introduce a Panel to improve the interface then application fails on the Pocket PC with the error message "could not find class application". When i remove the Panel it works fine again.
    I thought that java.awt.* is part of PJava. And even if not i should be able to introduce even a java.lang.* class to the PJava application if i use the JAR.
    Any suggestion?

    you should provide more detail about your deployment procedures.
    There are many ways to get this message. AWT in fact is part of pJava and works fine for most of us. So I assume the deployment is the problem. Have you checked the actual content of the JAR? Have you provided a path statement? How do you call your app (shortcut?)

  • Can you have multiple classes in one .java file ?

    or am I being dumb ;-)
    I'm guessing not because the filename has to match the classname but maybe you can ... ?
    C

    To elaborate a bit more. The public class must match the filename, however you can declare "inner" classes.
    An inner class can be declared inside another class, or even inside another method. Where you declare that class dictates the scope it will have. However, the lack of an ability to declare these classes public (a public class must be declared inside a java file with the same name), means that they are not visible anywhere else. However, they do still have plenty of uses.
    Declaring a class inside a method is used rarely, but would look something like
    public void foo(Bar myBar = new Bar
            private String baz = "Hello";
            public String doSomething()
                 return baz;
         myBar.doSomething()
    }This declares and implements the class Bar inside the method header. Sure, this is a pretty useless example, but you could put any methods or variables inside your inner class, and they would be available only during execution of that method. (ie. only have method scope).
    }

  • L added her sister R to a family plan. Can R have her own itunes account for syncing the phone and downloading her own apps, or must she always sign in using L's account and password?

    So, if R wants to sync her iphone 5C but still have L pay for it on the family plan, can R just get her own itunes account for buying music and apps? Or is she stuck using L's account?

    Family Plan as with the cell phone carrier?
    Is so, the iTunes account or Apple ID is not related to the type of cell phone plan an iPhone is under.
    Will the sisters being using the same computer and iTunes library?

  • I can't have my own personal data without a judge seeing it first!

    I have been a Verizon customer since October of 2009. For the most part, I've enjoyed your services. You have extremely helpful customer service representatives both at your stores and through your call center. I didn't even mind when you took away unlimited data. Okay, I did a little but not enough to make me want to discontinue my service with you. Until today. I called your customer service line about 3 weeks ago to request copies of the last 12 months of text detail for my account. I was adamant with the customer service rep that I needed the text detail. Imagine my dissapointment when I received only my call logs. I then placed another call to your customer service department to find out what happened. The second customer service rep, much like the first, hadn't been told that customers could no longer access any text details beyond three months. She placed me on hold and spoke to the legal department. Upon returning she informed me that I would have to subpoena my own text records. Though a little offputting, it wasn't really that much trouble. I asked my attorney to contact your legal department with a subpoena which he did today. Again, imagine my dissapointment to find out that not only can I not access my own records beyond three months, I have to have them released to a judge. I don't want the courts involved in what is a private matter. My private matter. This isn't an issue of national security. No one else needs to know why I want my own text records but me. I also find it extremely disconcerting that such a large change to how you handle data storage was most likely posted in small print on one of those annoying emails that everyone receives once a month telling them what has changed in the way of privacy practices and policies that no one reads. If I had known this was coming, I would have downloaded everything before the change. Every single one of your customers should have received an email specifically for this change. And really, if you had honestly tried to let your customers know this change was coming, why did none of your customer representatives know about it? I pay for my phone, my data package and my unlimited texting every month and I have done so for almost 4 years. I should have complete access to my records without getting lawyers and courts involved. Since that isn't the case here, I will no longer be a Verizon Wireless customer after this month nor will my husband or my sister who are also on my account. I'll take my business elsewhere as I imagine several other of your customers will do as well. I see a mass exodus of customers upset that yet one more thing has been taken from them with no warning and no culpability on the part of the company they pay every month for cell phone service. I highly doubt you'll read this. But I guarantee the thousands of Verizon customers already upset with your changes will. Why do you get to decide what I can access of my personal business? And why do you get to decide that I have to share my personal information with others if I want it? I want my privacy back!

    Also you are wanting text messages. Thus another party or multiple parties have a right to voice their opinion as to whether you can have them
    Finally the most records VZW keeps of messages is between 3-10 days tops.

  • Can users have their own subscription in SSRS?

    Is there a way user can subscribe a report of his own in SSRS 2008R2?
    We have about 20 reports and 400 users and everyone have their report parameter selection criteria. Is there a way they can default their parameter selection and subscribe?
    Another requirement is
    Is there a way to save favorite selections within a report to then choose them later. 
    Favorite #1
    Favorite #2
    Thanks,
    Jo

    Hi Jyo1105,
    Answer1: According to your description, there are 20 reports and 400 users, you want to set specific parameter values based on recipients. If that is the case, we can achieve your goal by using Data-driven Subscription.
    Reporting Services provides data-driven subscriptions so that you can customize the distribution of a report based on dynamic subscriber data. Data-driven subscriptions use query results to determine the recipients of the subscription, delivery settings,
    and report parameter values. At run time, the report server runs a query to get values used for subscription settings. We can use the Create Data-driven Subscription pages to define the query and assign query values to subscription settings. For detail information,
    please refer to the following steps:
    1. Open Report Manager, and locate the report for which you want to create a data-driven subscription.
    2. Hover over the report, and click the drop-down arrow.
    3. In the drop-down menu, click Manage. This opens the General properties page for the report.
    4. Select the Subscriptions tab, and then click New Data-driven Subscription.
    5. Select the delivery extension and data source for the subscription.
    6. Specify a query that retrieves subscriber data like below:
    CREATE TABLE Name (
    Group varchar(20),
    Country varchar(20),
    Type varchar(20),
    Email_to varchar(50)
    INSERT INTO Name
    ('Group1', ’Country1’, ’Type1’, '[email protected]'),
    ('Group2', ’Country2’, ‘Type2’, '[email protected]'),
    ('Group3',’Country3’, ’Type3’, '[email protected]')
    7. Specify delivery extension options like below:
    8. Specify report parameters for the subscription like below:
    9.  Specify when the subscription is processed, then click Finish to save the configuration.
    For more information about Data-driven Subscription, please refer to the following documents:
    http://msbimentalist.wordpress.com/2013/08/26/how-to-create-data-driven-subscription-in-ssrs/
    Answer2: As per my understanding, there may be several parameters in the report, when users preview the report, they need to select values for each parameter. So you want to save some selections as favorite.
    In Reporting Services, we could not achieve the goal directly. As a workaround, we can use snapshot. For more details, please refer to the following steps:
    1. Open Report Manager, and navigate to the report.
    2. Hover over the report, and click the drop-down arrow.
    3. In the drop-down menu, click Manage.
    4. Click Parameter in the left pane, set default values for the parameters, then click Apply.
    5. Click Report History in the left pane, click New Snapshot.
    In this way, the parameter selections are saved, when we click the snapshot, the report server retrieves the stored report from the report server database, and shows the data, parameter selections and layout at the time when the snapshot was created.
    If you have any more questions, please feel free to ask.
    Best Regards,
    Wendy Fu

  • Can we have our own map component in Xcelsius 2008 ?

    Can anyone help me how to use our own MAP in Xcelsius 2008.  
    For an example, i would like to use the map of India duly marked for its states also.
    Thanks in advance.
    BaaRaa.

    Hi,
    You can download the Add-On from this link and use it.
    http://www.reportex.co.uk/xc_maps.html
    Regards,
    Senthil k

  • Can I have my own payment solution with family sharing?

    We have family sharing and we have a credit card on my husbands account and he's in charge of the family sharing. I would like to be able to choose my own payment solution sometimes and not have to go through the one registered on him all the time.

    Anna0414 wrote:
    We have family sharing and we have a credit card on my husbands account and he's in charge of the family sharing. I would like to be able to choose my own payment solution sometimes and not have to go through the one registered on him all the time.
    Anna,
    Buy iTunes gift cards, and redeem them to your account.  As long as your own account has a credit balance, any purchases made by you will be charged to your own credit balance, and will not hit the Family Organizer's credit card.
    Here is the document for your reference:
    Family purchases and payments
    "After you set up your family, any time a family member initiates a new purchase it will be billed directly to your account unless that family member has gift or store credit. First, their store credit will be used to pay the partial or total bill. The remainder will bill to the family organizer's card."

  • I have an itunes account with 3 ipods can we each have our own email address

    can we have our own email address if we share the 1 itunes account???

    There can be only one emailladdress accociate with an Apple/iTunes ID.  However, after you initiall set up the Messages and FaceTime apps with the Apple/iTunes ID you can add another email amessaging/calling addresses and delete the Apple/iTunes email address.

  • HT204053 can i set up a seperate icloud for my ipad? My daughter bought my ipad, its wifi, not through a phone co. however im on her icloud and need my own i cloud for work purposes. I have my own apple id. How do i get off her i cloud and on my own?

    My daughter bought my ipad 2. She manages all our apple devices on her computer. She purchased a i cloud package for her phones but it is showing on my ipad. I have my own apple ID now, and I download apps and songs from Itunes all the time on my own id. However her I cloud is on my ipad. I need my own I cloud for work purposes and when I try to change the apple ID in setting for her I cloud its grayed out... How can I have my own i cloud on my ipad. Originally when she bought the Ipad, she set it up on her ID, She used the ipad for awhile before she got a new one. I am using this one now. She can track my ipad if I loose it. It still shows as one of her devices. Can I get my own I cloud?

    Yes of course. Jsut go to "Settings > iCloud" delete her account from your device and then start creating a new one just for you.

  • Greetings: I have multiple iPads and iPhones. I want all to be able to be able to stream to our Apple TV. All of the docs I see say you must have the same Apple ID for all the devices, but we each have our own Apple ID. Is this just a doc short coming?

    Greetings: I have multiple iPads and iPhones. I want all to be able to be able to stream to our Apple TV. All of the docs I see say you must have the same Apple ID for all the devices, but we each have our own Apple ID. Is this just a doc short coming?

    You can each have your own ID for your own iTunes accounts, but in order for a device to stream via AirPlay to the same Apple TV, everything must use the same homesharing ID. This is not the same as your iTunes account ID (although it can be for one of the devices)

Maybe you are looking for