JPanel content change with MouseClicked

Here is my very simple question.
I create a JFrame, and a JPanel in it, and create a content via toAdd class which implements MouseListener.
What can I do to refresh the content of JPanel when MouseClicked?
I tried many things but since they did not work, may be for now, I should only ask, here is the code:
package jpanel;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class App1 {
    private static class toAdd extends JPanel implements MouseListener{
        public void paint(Graphics g){
            super.paintComponent(g);
            g.drawString("deneme", 20, 50);
        public void mousePressed(MouseEvent evt){}
        public void mouseReleased(MouseEvent evt){}
        public void mouseClicked(MouseEvent evt){
        // my question is related to this part.
        public void mouseEntered(MouseEvent evt){}
        public void mouseExited(MouseEvent evt){}
    public static void main(String[] args){
        toAdd toAdd = new toAdd();
        JPanel content = new JPanel();
        content.setLayout(new BorderLayout());
        content.add(toAdd, BorderLayout.CENTER);
        JFrame window = new JFrame("Platform");
        window.setContentPane(content);
        window.setSize(100, 200);
        window.setLocation(100, 100);
        window.setVisible(true);
}Message was edited by:
tolgafiratoglu

Like this perhaps?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class App1 {
    private static class toAdd extends JPanel implements MouseListener{
        public toAdd() {
            addMouseListener(this);
        private int wordindex = 0;
        private String[] words = { "not clicked", "clicked" };
        public void paint(Graphics g){
            super.paintComponent(g);
            g.drawString(words[wordindex], 20, 50);
        public void mousePressed(MouseEvent evt){}
        public void mouseReleased(MouseEvent evt){}
        public void mouseClicked(MouseEvent evt){
            wordindex = wordindex == 0 ? 1 : 0;
            invalidate();
            repaint();
        public void mouseEntered(MouseEvent evt){}
        public void mouseExited(MouseEvent evt){}
    public static void main(String[] args){
        toAdd toAdd = new toAdd();       
        JPanel content = new JPanel();
        content.setLayout(new BorderLayout());
        content.add(toAdd, BorderLayout.CENTER);
        JFrame window = new JFrame("Platform");
        window.setContentPane(content);
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window.pack();
        window.setSize(100, 200);
        window.setLocation(100, 100);
        window.setVisible(true);
}Message was edited by:
deeprave

Similar Messages

  • How to configure mail notification on a folder content change?

    Hello,
    I would like to configure a mail notification whenever a certain folder's content changes. In order to acomplish this I did the following:
    1. Configured new email Channel with the exchange address.
    2. Assigned this channel to the Notificator service.
    3. Subscribed to the requested folder with "Every Event".
    The problem is that I don't receive mail notifications on change. What am I doing wrong or missing here?

    Hi,
    Don't use exchange.... use an SMTP hostname if you have access to one!
    It is a lot easier as all you need is the hostname of the SMTP server without having to worry about authorizations.
    Cheers,
    Vic

  • OLM on content server with ias (10.1.3) java.lang.OutOfMemoryError

    Dears,
    we have set up OLM on content server with ias (10.1.3)
    I'm Facing the following error when uploading 100 M learning material although i have changed the server properties of OC4J java heap size to 1024 - 2048 and maxpermsize to 1024
    JSP Error:
    Request URI:/OA_HTML/OA.jsp
    Exception:
    java.lang.OutOfMemoryError
    Thanks,
    Regards.

    PLease refer Husain comments below
    "Please see these docs.
    OLM Content Import Erroring with java.lang.outofmemoryerror for Large Files [ID 368479.1]
    When Importing And/Or Uploading Large Upk-Type Files Fail to Unzip [ID 735653.1]
    Out Of Memory Errors While Uploading Large Content [ID 1130960.1]
    Utilizing Content Servers with Oracle Learning Management [ID 374677.1]
    Thanks,
    Hussein"
    apart from the above what I would normally is, while zipping the file I would exclude heavy content file and upload the file.
    after uploading file, just go and paste excluded file in respective folder.
    sathish

  • How to use content presenter with a multilanguage site

    I would you like to know if it's possible to manage a content presenter with multi language ? Normally, if i would show a content with a template view , i choose a UCM content to the parameter interface of the content presenter. Anybody has found a solution to found automatically the right content when i choose a another language. For example, i create a content presenter associated to a English content on UCM , is it possible when the user changes his language to spanish for example to have the related content in spanish or not ?

    There are a few options to do this but it requires quite a lot of customizations. Unfortunatly there is no out of the box solutoins to tackle this issue.
    First of all you have to make sure the content in UCM is related to each other so when you have a document in english, you can easily find the same document in another language. This can be based upon additional meta fields or by using the related content component.
    You probably also want to setup a workflow so when an english (or any language) document is checked in, the workflow kicks in and notify some other users so they know they have to translate that document.
    In Webcenter you have to make sure that the content presenter can show content based upon language. Normaly you can't realy build dynamic queries in the content presenter and when you select all the content from a folder, there is no way to add filters based upon language.
    In order to solve this issue, you can use the personalization server. By creating a scenario that takes the language as an input parameter (or by just querying the profile) you can build a dynamic CMIS query that can be used to power the content presenter. When you have configured the personalization server and create a scenario, you will be able to select that scenrio in the content presenter instead of selecting items or folder.
    It's quite a bit of work to make it multilingual but currently this is the only solution i have found...

  • I lost the ability to order and hide site columns if i use custom content type with a custom Create Form

    I have a team site collection and I want to add a new App of type Issue Tracking list. so I did the following:-
    From the site collection I created a new App of type issue tracking.
    Then from the site collection I created a new Content type named “CustomIssue” which has its parent as “Issue” content type.
    I went to the Issue tracking list and I changed the default content type from Issue , to the new “CustomeIssue” content type.
    I open the site collection using SP designer and I created a new Create form for my Issue tracking list based on the "CustomIssue" content type and I select to have the Create form as the default form when creating an item.
    Everything till this point worked well. But when I open the “customIssue” content type , and I re-order the columns and I hide some columns, this was not reflected inside the custom Create form …
    although when using the default content type and the default create form you can control the order of the fields and to specify if certain fields hold be hidden inside the Create form.. so can anyone advice on this please?

    Hi,
    According to your post, my understanding is that you lost the ability to order and hide site columns if i use custom content type with a custom Create Form.
    I try to reproduce the issue, the result is the same as yours.
    As a workaround, if I modify the custom content type form the site setting, and then change the NewForm as the default form, it will change the column orders.
    However, if I use the new created form as the default form, it will remain the original orders.
    I recommend that you modify the custom content type form the site setting, and then reset the NewForm as the default form.
    The result is as below:
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support
    ok thanks for the explanation ,, but what if i want to change the order and hidde some fields in the future ,, do i have to chnage the defualt create form again ...

  • A script that can be used to track text content changes in indesign?

    Is there a possibility a script that can be used to track text content changes in indesign. My Indesign software's version is CS3. As you can see below, I have deleted some texts and added some. I did it in another software.
    I have been searched for a long time. Because of my poor English, I still can't come up with any Object Model related to the script yet.
    Here is some idea of mine:
    Use the script tracking my revising texts. When I  add some new texts, the texts will be underlined. When I delete some texts, the position of the first character of the removed text will be added a small red triangle or something.
    Thanks in advance.

    Hidden dragon, what does that mean?
    I can't comprehend fully what you said.
    Is IDML short for Indeisgn Markup Language?
    I think you are telling me that I can open the Indeisgn document by using the software InCopy. Then I have change some contents. InCopy will help me tracking the revision.
    getZinger. Do I get your point?

  • Did the markup for java applets change with version 4.0.5

    Starting with Safari version 4.0.5 java applets are not rendering correctly. The Java coffee cup loading image pushes the actual content down. Was the applet tag markup changed with this release?
    Take a look at the following example:
    http://tinyurl.com/p27vpq
    or
    http://preview.tinyurl.com/p27vpq
    FYI, 4.0.4 displays correctly.

    Ok...
    First, try a different user account with Safari and see if the same thing happens. If it does then it's a system wide issue, not just your user account.
    From the Safari Menu Bar, click Safari / Empty Cache. When you are done with that...
    From the Safari Menu Bar, click Safari / Reset Safari. Select the top 5 buttons and click Reset.
    Go here for trouble shooting 3rd party plugins or input managers which might be causing the problem. Safari: Add-ons may cause Safari to unexpectedly quit or have performance issues
    Web pages now include a small icon or 'favicon' which is visible in the address bar and next to bookmarks. These icons take up disk space and slow Safari down. It is possible to erase the icons from your computer and start fresh. *To delete Safari's icon cache using the Finder, open your user folder, navigate to ~/Library/Safari/ and move this file "webpageIcons.db to the Trash.*
    Relaunch Safari.
    If you still have problems, go to the Safari Menu Bar, click Safari/Preferences. Make note of all the preferences under each tab. Quit Safari. Now go to ~/Library/Preferences and move this file com.apple.safari.plist to the Desktop. Relaunch Safari. If it's a successful launch, then that .plist file needs to be moved to the Trash.

  • Subcribe a Portal User Group to content change events on page?

    Another developer at my shop has created a custom routine that programmatically subscribes the given user to content change events on a page. At the heart of their custom routine are the following Oracle Portal API calls:
    portal.wwctx_api_private.set_context( v_user );
    portal.wwsbr_app_approval.subscribe
    p_object_context_id => v_siteid,
    p_page_id => v_pageid
    ...where v_user is the account we want to subscribe for notification of content changes on the given page.
    I have a need to extend this to allow subscriptions of Portal User Groups (PUGs) for the same content change events. It is not acceptable to statically subscribe the PUG membership, because I do not want a situation where today I subscribe all the members of group X, then tomorrow the membership of group X changes, but the list of subscribed users does not change automatically with the group membership modification. I could just as well manually subscribe each group member without going through the hassle of coding a modified subscription UI and backend routine to handle groups.
    Any suggestions?
    Thanks,
    shastew

    My shop is currently on 10g R1 (9.0.4.3). We will be upgrading to 10g R2 (10.1.2) in a few months, but this is not the 10.1.4 version your document link points to. Is CMEF included actually usable in 10.1.2?
    Also, publish and subscribe solves a particular set of design issues and allows for a certain degree of flexibility of usage, however, I don't see any built-in support for the User Groups that Portal provides for assigning basic page permissions. It's the group support that I'm interested in...and I don't want to have to create duplications of groups outside of what I already have. I don't want to have to write an entire application infrastructure to support outside group membership maintenance just for supporting subscription notifications. This should have already been built-in to interface with the existing Portal page permissions group framework. At our shop, a lot of effort has already been put into setting up and maintaining these built-in groups and we should be able to re-use them for something as brain dead simple as subscription notification.
    I've already given up and opened an enhancement request "TAR" for this.
    shastew

  • What changed with create from clipboard?

    Hi guys. Sorry if I do not sound technical on this but something has occured which might be how mavericks handles clip board contents now or photoshop.
    In illustrator I might create something that I copy then in photoshop, create new from clipboard. It used to be if I set a highish resolution the resultant vector paste would be nice and large, for arguments sake I might have a full sfreen zoomed to 50%
    Now when copying and crating from clip board even on high resolutions the size of the image is always the same, from A4 barley 500 pixels wide. which when experoting for a web or what ever makes it very small.
    As I say I am not technical and do understand there are differences between resolution, pixels, dpi etc etc, but never the less something changed with CC or mavericks and I prefered how it was before!
    Any ideas?

    Somebody mentioned a bug along those lines just recently.  I don't know for sure it is the same issue, but it sounded just like that.

  • In version 3.6 I can not open a website link from original page, I keep getting a new window that is blank and asking me to put in a web address. What has changed with the new version?

    When on a page if I click on a web link I get a new window that is blank and asks me enter a web address. This started happening with the new 3.6 version. It seems to have something to do with what I choose for the location in my privacy settings as the window changes with each setting but I still cannot get to the new site. Any ideas? I have no problem with this in IE and I have to keep opening IE when I encounter the problem on Firefox which is annoying.

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • HT1918 I can't seem to update my apps or make any purchases on from my account. Nothing has changed with my credit card information and for some reason the iTunes Store tells me my information is incorrect. What do I do?

    I can't seem to update my apps or make any purchases on from my account. Nothing has changed with my credit card information and for some reason the iTunes Store tells me my information is incorrect. What do I do?

    Yes, it's frustrating.
    I don't have my iPod with me but, as I recall, the change is done in Settings/Store.  That change will apply to NEW purchases.  However, be aware that all purchases are permanently associated with the Apple ID that was originally used.  Generally, it's only a problem when you need to update an app.  IF you do your updating from iTunes and your logged in to the "wrong" ID, you'll need to log out and back in again.  It's easier from the iPod as you do not need to log out/in but you do need to know the password.
    Unfortunately, you can not merge IDs nor can you transfer purchases from one ID to another.  Go here to find out exactly what you have.  I have the same problem so I deliberately made both passwords identical to make things slightly easier for me.

  • How to read the content from a External Content Type with out creating External List in Sharepoint 2013?

    Hi,
    I have a requirement to read the External Content Type and storing the Data in a Session Variable. The Reading of the content from External Content Type with out creating a External List.
    Please help I am trying to find the solution, but unable to do that.
    Thanks,
    Pradeep

    Hi,
    Firstly an external content type designed to work with SharePoint list and there is no way to read apart from this.
    If you are looking the solution out of the " Business Connectivity" then find that data source has been exposed through WCF and  Web Service ?
    So you can use REST API and CSOM to consume those data in SharePoint.
    You can also leverage the ADO.NET option if the datasources based on MS technologies.
    Murugesa Pandian| MCPD | MCTS |SharePoint 2010

  • I cannot install iTunes updates as of today.  Does anyone have any idea what changed with iTunes?

    The question apparently needs to be typed in twice...  good work.  Here it is again:
    I cannot install iTunes updates as of today.  Does anyone have any idea what changed with iTunes?

    Is this a distinct issue from the 42404?
    If so, are you getting an error message when you try to install iTunes? If so, what does it say? (Precise text, please.)

  • How do I put the page number in my header so the header changes with every page

    I need to write a paper for my english class and I need the header to contain the page number so it changes with each consecutive page.
    I need to know ASAP! Thank you!

    Click in your header > Menu > Insert > Page Number
    Peter

  • I created a book in iBooks Author using the Photo Book template. When I rotate to portrait orientation, the photo or widget disappears and a table of contents appears with only the interactive media showing.

    I created a book in iBooks Author using the Photo Book template. When I rotate to portrait orientation, the photo or widget disappears and a table of contents appears with only the interactive media showing.

    Thanx for the prompt response, KT. I have indeed seen that thread, only just after I posted the question.
    I have spent hours on the phone with what I now know is a call center in Texas on this question.
    I think Apple could be a little more "hands on" with iBooks Author users, and it should also be pointed out that landscape photos will not display in portrait mode.
    In my case, I used gallery widgets to display vertical photos, since they look better in portrait mode.
    But instead of simply rotating, the page disappears and a TOC of interactive media appears. The gallery behaves as expected when tapped. This is not what I expected, but since the gallery works, I can live with it.
    Right now I have "tickets" telling me to "fix" this "problem or to disable portrait mode.
    I don't want to disable portrait mode.
    Will Apple accept the books if I tell them this is not an "error?"

Maybe you are looking for