Listening for change events on a JTable

Hi
me = Java newbie!
Well I've been building an app to read EXIF data from JPEG files using the imageio API and Swing. Learning both along the way.
Stumbling block is that I am outputting the EXIF data into a JTable, inside a JScrollPane. These 2 components then become associated with a JInternalFrame container of the class MyInternalFrame.
Works!
Next job is to enable user to select a row in the table which then displays the image file.
I know I can use ListSelectionEvent to detect a row selection and that 2 events are fired.
I put some code into MyInternalFrame class to register a ListSelectionEvent, but I can't see how to reference MyInternalFrame from within this code....see below:
package EXIFReader;
import java.io.File;
import java.io.FilenameFilter;
import javax.swing.JInternalFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
//This class constructs a table and displays it in a JInternalFrame
public class MyInternalFrame extends JInternalFrame {
static int openFrameCount = 0;
static final int xOffset = 30, yOffset = 30;
File file;
File[] directoryMembers = null;
public MyInternalFrame(File aFile) { //aFile rererences a directory containing jpeg files//
super(null,
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
file = aFile;
//Set the window's location.
this.setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".jpg");}};//Filter out any files in the directory that ain't jpegs
directoryMembers = file.listFiles(filter);
int i = 0;
String[][] tableData= new String [directoryMembers.length][5];
String[]headers = new String[]{"File Name","Date Taken",
"F-Number","Exposure",
"Flash Settings"};
for (File dirfile: directoryMembers)
try {
if(dirfile!=null){
tableData[i] = new ExifReader(dirfile).getEXIFData();//populate the table with jpeg file names
i++;}}
catch (Exception ex) {
System.out.print("Error" + ex);
if (tableData[0] != null){
final JTable myTable = new JTable(tableData,headers);
this.setSize(900,(50+(directoryMembers.length)*19));
myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.getContentPane().add(new JScrollPane(myTable),"Center");//add the JTable and JScrollPanel to this MyInternal Frame and display it! - cool it works!
ListSelectionModel myLSM = myTable.getSelectionModel();
myLSM.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent le) {
int[] rows = myTable.getSelectedRows();//want to respond to selections and then display the image as a JInternalFrame but got confused about references from within this listener - need help!
Any gentle nudges?!
P
I can respond to these events using a JFrame, but how can I display the image in a JInternalFrame?

Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
To get better help sooner, post a [_SSCCE_|http://mindprod.com/jgloss/sscce.html] that clearly demonstrates your problem.
db

Similar Messages

  • How do I listen for change in the global position of a Node

    Hi there,
    I want to create a Wire/Connection node between two scene nodes. I want this Wire node to be updated when one of the nodes is moving. In the common scenario I would listen for change events in the target nodes position and update the Wire :
    targetNode1.translateXProperty().addListener(new ChangeListener<Number>() {
    public void changed(ObservableValue value, Number oldValue, Number newValue) {             
    wire.setStartX(targetNode1.getTranslateX());
    wire.setStartX(targetNode1.getTranslateY());
    wire.setEndX(targetNode2.getTranslateX());
    wire.setEndY(targetNode2.getTranslateY());
    The problem is that the target nodes are children of another container nodes(that are actually moving). So listening for change events in the translate properties of the target nodes does not work(their parent nodes are actually moving)
    Is there way to listent for change in the global position of the target nodes relative to the Scene?

    It sounds very similar to a problem I posted about earlier...
    How to implement a UI similar to a UML Diagram with connections?
    I ended up making my own special bounds property, that updates when the parent's special bounds property changes.
    I also had to listen to the parentProperty change event to add/remove my listener on the parent node.
    All in all, a pain in the butt. There should be an easier way.
    The shortcoming of the solution is that all the nodes in the hierarchy must have my special bounds property implemented (ie. they're all classes under my codebase such that I can implement it), which for the moment is true... I'd like a cleaner solution however.

  • How to create many objects listening for one event

    I'm experimenting with the EventDispatcher class and I have a
    test class working. I want to use a loop to create a variety of
    movie clips that all listen for an event that gets dispatched every
    half a second. I have the event dispatching properly. My problem is
    that when creating the objects, the temporary variable I use to
    hold each created object has a life that extends beyond the loop in
    which it is instantiated. Rather than all five created objects
    changing color, only the last one changes color (see the code
    below--it lives on the first frame of an FLA file).
    This is not entirely surprising when I look at the code --
    'this' refers to the global scope and 'square' refers to the last
    created object that it pointed to. Here's the resulting trace:
    handler runing, square name is square 4
    this class name is global
    handler runing, square name is square 4
    this class name is global
    handler runing, square name is square 4
    this class name is global
    handler runing, square name is square 4
    this class name is global
    handler runing, square name is square 4
    this class name is global
    How can I modify this code so that each square object changes
    its own color?

    graphics.clear in the context of that function handler in my
    code would refer not to the squares but to the global scope,
    wouldn't it? In which case you'd be clearing all the graphics from
    your top level movie. I tried changing 'square.graphics' to just
    'graphics' in my handler and my squares just remained the original
    steady black.
    Your code doesn't use a loop and therefore isn't re-using a
    variable. You've escaped my 'logical errors' through brute force.
    (BTW, I think my code would work in AS2 if I used the old-school
    draw methods). Suppose you had to create 100 objects? Would you
    want to manually instantiate each one, typing that function over
    and over again? You'd have 500 lines of highly redundant code!
    Maybe try your example using a loop instead? I think you'll
    find it's pretty tough to sneak any vars like 'i' or 'square' from
    the global scope into the handler--the handler refers to the
    living, breathing variable rather than it's value at the time the
    handler was instantiated. Furthermore, you can't sneak any
    information about the square into your handler via the event object
    because the event object is created in a totally different place.

  • Listening for Changes to JTextArea

    I am writing a program that listens for changes to the contents of a JTextArea to obtain input for its execution. But I have implemented DocumentListener, PropertyChangeListener to listen for changes to the JTextArea for deriving input without success. Please could anyone advice on what to do.
    My code is below.
       myListener implements DocumentListener{
       JTextArea txt = new JTextArea();
       txt.getDocument().addDocumentListener(this);
       public void changedUpdate(DocumentEvent e){}
       public void removeUpdate(DocumentEvent e){} 
       public void insertUpdate(DocumentEvent e){
        try{
         //my code for obtaining input from txt is here
         int start = e.getOffset();
         Document doc = e.getDocument();
        }catch(BadLocationException ble){
    }

    Here's a link to the Swing tutorial on "How to Write a Document Listener":
    http://java.sun.com/docs/books/tutorial/uiswing/events/documentlistener.html

  • Any way to listen for changes in Spark TextArea?

    Hello,
    What is the best way to listen for changes in a Spark TextArea? My scenario is simple: I need to know when some text is added or deleted (with from/to index).
    Regards,
    Dinko

    s:TextArea does have a chang event - http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/TextAr ea.html.

  • How do I listen for changes in a container's components?

    I have a JScrollPane that contains a JTextPane. I want any Container that can possibly contain my JScrollPane to be able to listen for changes in the JTextPane's Document.
    For example, at the moment I'm using a JTabbedPane to hold a number of my JScrollPanes and I want to alter the tab title when any associated JScrollPane-JTextPane-Document is updated.
    Any suggestions on how best to handle this?

    I would use a controller object that manages all your gui components (tabs, scrolls, documents, text panes). Your controller object can register as a listener to the appropriate component, and when it changes, update the title of a tab (or do whatever else) as appropriate.
    Never put business logic like this stuff inside the actual gui components. Create, layout, etc. all the gui components (and related components like Document) from another controller like object instead. It makes handling the various listener stuff like this much easier. Read up on MVC (model view controller) stuff for more info.
    As for the actual mechanics, you could get the document that is used in the JTextPane and register as a DocumentListener. As a document listener, you get notified of all changes that are made to that document.

  • Error in work flow wait for change event

    Error in work flow wait for change event of business object bus1014, Actually this business object is triggering for two transaction one is me21n and another is c201 . am trying to create fork with two branches one is create and another if change occurs wait will trigger, bt when i trigger work flow controll is not after fork, it will stop in fork only. and am not getting my workflow container variable getting instantiate, am getting error in wait. please any one get out of me in this

    Hi Sangeetha
    What is LV_MATERIAL? is it a BO container element? or a class element or a just a simple variable?
    Error message is clear, you are trying to evaluate LV_MATERIAL but it does not contain a value.
    This is a custom workflow as it begins with WS9xxxxxxx... what is LV_MATERIAL used for? what are we expecting it to hold? maybe, from event to workflow binding we can pass the value to it.
    Please share the following:
    1) Definition screen shot of LV_MATERIAL
    2) Screen shot of The step where it is first used - from SWDD
    3) Screenshot of Event to Workflow Binding
    4) name of your base Business Object (seen in the triggering events tab of the WF template in PFTC)
    5) What is the corresponding variable for that BO in your workflow container
    6) Screen shot of WF definition from SWDD - please identify the step going in error in that screen shot
    Regards,
    Modak

  • [svn:fx-trunk] 12078: Fix for change events in Slider and ScrollBar.

    Revision: 12078
    Revision: 12078
    Author:   [email protected]
    Date:     2009-11-21 00:14:46 -0800 (Sat, 21 Nov 2009)
    Log Message:
    Fix for change events in Slider and ScrollBar. They now dispatch change events as before, whenever the user alters the value. In addition, changeStart and changeEnd events will be dispatched at the start and end of a user interaction or animation.
    TrackBase.as - Added metadata for changeStart/End events. Dispatch change, changeStart/End events when appropriate.
    Slider.as - Dispatch change, changeStart/End events when appropriate.
    ScrollBar.as - Dispatch the appropriate events. Note that changeStart/End will not dispatch when shift-clicking on a non-animating ScrollBar. Renamed animatingSinglePage to animatingOnce to better reflect its function. Refactored some method calls to the new private stopAnimation(), which is more consistent with Slider. Refactored the button handlers to make stepping more readable. Added a setValue call in animationEndHandler where we were ending up off the snapInterval when shift-clicking.
    Updated FlexEvent, ScrollBarTestScript and VideoPlayer to handle the new events.
    QE notes: Update Slider and ScrollBar tests
    Doc notes: No
    Bugs: SDK-24264
    Reviewer: Ryan
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24264
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/events/FlexEvent.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VideoPlayer.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ScrollBar.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Slider.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/TrackBase.as
        flex/sdk/trunk/frameworks/tests/basicTests/spark/scripts/ScrollBarTestScript.mxml

  • Listening for an event outside of the object...

    Hey, I spent a lot of my day trying to figure out how to
    listen for an event outside of an instantiated object of my own.
    I made my own class called
    Link. When my Link class is instantiated, a Loader object
    (var loader:Loader) is added and it loads a user-specified external
    PNG file. I want to track the Event.COMPLETE event OUTSIDE of my
    Link class, like in my FLA's Actionscript.
    So, I tried a few things without any luck, and by these you
    might get the idea of exactly what I'm trying to do:
    var link1:Link = new Link(...);
    link1.loader.addEventListener(Event.COMPLETE, handler);
    That didn't work, so I tried:
    var link1.Link = new Link(...);
    var loader = link1.getChildByName("loader") as Loader;
    loader.addEventListener(Event.COMPLETE, handler);
    ... that didn't work either. :(
    Any ideas?
    If I am taking the completely wrong approach please do let me
    know. If there's ANY way to know WHEN my loader has completed
    loading its image outside of my Link class...
    Thanks!
    ~ Andrew Merskin

    Let your Link class handle the Loader events. When
    Event.COMPLETE fires,
    just redispatch the event or dispatch a custom event.
    Example 1:
    link1.addEventListener("ALLDONELOADING", linkEventHandler);
    function linkEventHandler(event:Event)
    if(event.type == "ALLDONELOADING")
    // do something or nothing at all
    // Inside your link class you are listening for the load
    complete
    function loadCompleteHandler(event:Event)
    dispatchEvent(new Event("ALLDONELOADING")));
    Example 2:
    link1.addEventListener(Event.COMPLETE, linkEventHandler);
    function linkEventHandler(event:Event)
    if(event.type == Event.COMPLETE)
    // do something or nothing at all
    // Inside your link class you are listening for the load
    complete
    function loadCompleteHandler(event:Event)
    dispatchEvent(event);

  • Listening for click event

    I am curious, how can you have a child mxml page listen for
    an event from the parent?
    Let's say you have a button, call it 'btn1' on page1.mxml and
    you want to listen for the click event on page2.mxml. So far this
    is what I have:
    page1.mxml:
    <mx:Button id="btn1" />
    page2.mxml:
    <mx:Script>
    <![CDATA[
    private function btnListener(e:MouseEvent){
    Application.application.btn.addEventListener(MouseEvent.CLICK,
    setState(1));
    ]]>
    </mx:Script>

    "spacehog" <[email protected]> wrote in
    message
    news:glljts$g04$[email protected]..
    >I am curious, how can you have a child mxml page listen
    for an event from
    >the
    > parent?
    >
    > Let's say you have a button, call it 'btn1' on
    page1.mxml and you want to
    > listen for the click event on page2.mxml. So far this is
    what I have:
    >
    > page1.mxml:
    >
    > <mx:Button id="btn1" />
    >
    > page2.mxml:
    >
    > <mx:Script>
    > <![CDATA[
    >
    >
    > private function btnListener(e:MouseEvent){
    >
    Application.application.btn.addEventListener(MouseEvent.CLICK,
    > setState(1));
    > }
    > ]]>
    > </mx:Script>
    Check out Q3:
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf

  • Listening for keyPressed events from background?

    Is it possible to have a java program running in the background and listen for keyPressed events? I would like for the program to listen for certain keys to be pressed and when they are manipulate the mouse. From what I've looked at so far however it seems the listening component must have focus. Thanks.

    On any OS that would typically involve hooking into the OS itself.
    And then manipulating OS resources as well.
    Putting an app into the 'background' is also OS specific.
    Given that the above is all you want to do then java is not an appropriate language choice. C++ would be better.

  • Dispatching & listening for custom events from custom component [Flex 4.1]

    I'm giving this a try for the first time and I'm not sure I have the recipe correct!
    I have a custom component - it contains a data grid where I want to double click a row and dispatch an event that a row has been chosen.
    I created a custom event
    package oss
        import flash.events.Event;
        public class PersonChosenEvent extends Event
            public function PersonChosenEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
                super(type, bubbles, cancelable);
            // Define static constant.
            public static const PERSON_CHOSEN:String = "personChosen";
            // Define a public variable to hold the state of the enable property.
            public var isEnabled:Boolean;
            // Override the inherited clone() method.
            override public function clone():Event {
                return new PersonChosenEvent(type);
    Then I try to dispatch the event within the component when the datagrid is doubleclicked:
    import oss.PersonChosenEvent
    dispatchEvent(new PersonChosenEvent(PersonChosenEvent.PERSON_CHOSEN, true, false));
    And in the parent application containing the component I do on creationComplete
    addEventListener(PersonChosenEvent.PERSON_CHOSEN,addPersonToList);
    The event does not seem to fire though. And if I try to evaluate the "new PersonChosenEvent(..." code it tells me "no such variable".
    What am I doing wrong?
    (It was so easy in VisualAge for Java, what have we done in the last 10 years?? )
    Martin

    I've done this kind of thing routinely, when I want to add information to the event.  I never code the "clone" method at all.
    Be sure that you are listening to the event on a parent of the dispatching component.
    You can also have the dispatching component listen for the event too, and use trace() to get a debug message.
    I doubt if it has anything to to with "bubbles" since the default is true.
    Sample code
    In a child (BorderContainer)
    dispatchEvent(new ActivationEvent(ActivationEvent.CREATION_COMPLETE,null,window));
    In the container parent (BorderContainer)
    activation.addEventListener(ActivationEvent.CREATION_COMPLETE,activationEvent);
    package components.events
        import components.containers.SemanticWindow;
        import components.triples.SemanticActivation;
        import flash.events.Event;
        public class ActivationEvent extends Event
            public static const LOADED:String = "ActivationEvent: loaded";
            public static const CREATION_COMPLETE:String = "ActivationEvent: creation complete";
            public static const RELOADED:String = "ActivationEvent: reloaded";
            public static const LEFT_SIDE:String = "ActivationEvent: left side";
            public static const RIGHT_SIDE:String = "ActivationEvent: right side";
            private var _activation:SemanticActivation;
            private var _window:SemanticWindow;
            public function ActivationEvent(type:String, activation:SemanticActivation, window:SemanticWindow)
                super(type);
                _activation = activation;
                _window = window
            public function get activation():SemanticActivation {
                return _activation;
            public function get window():SemanticWindow{
                return _window;

  • Component listening for a event

    I need to make 1 component listen for an event in another component..
    JMenuItem listens for a TreeSelectionEvent and in case something selected enables... and disables otherwise...
    addTreeSelectionListener() is not possible for a JMenuItem component...
    so how do i do that?
    the code below is not acceptable because there is a lot of JMenuItem objects and it's a bit messy and difficult to add each...
    tree.addTreeSelectionListener(blah) {
    JMenuItem.setEnabled(false);
    i want a component checking himself for a proper condition...
    in case it will require too much hardware resourses what would you suggest?

    Do you ever get to a point in programming where you think that perhaps i have choosen the wrong hobby to get infatuated about
    That code worked really well targetplanet but it had a side effect that just makes me nutts lol
      as it triggered a mouse event function in the component that was initialized in Main and just made my web site go nuts . the component that we initialized was a skin but its itemRenderer component that followed had the mouse event! perhaps i better start again with me learning perhaps i missed something
    or perhaps i should just have one component to one job instead of trying to be clever and mutitask with less components!

  • Listen for an events for Swing objects in a separate class?

    Hi all, sorry if this is in the wrong section of the forum but since this is a problem I am having with a Swing based project I thought i'd come here for help. Essentially i have nested panels in separate classes for the sake of clarity and to follow the ideas of OO based development. I have JPanels that have buttons and other components that will trigger events. I wish for these events to effect other panels, in the Hierachy of my program:
    MainFrame(MainPanel(LeftPanel, RightPanel, CanvasPanel))
    Sorry I couldnt indent to show the hierarchy. Here LeftPanel, RightPanel and CanvasPanel are objects that are created in the MainPanel. For example i want an event to trigger a method in another class e.g. LeftPanel has a button that will call a method in CanvasPanel. I have tried creating an EventListner in the MainPanel that would determine the source and then send off a method to the relevant class, but the only listeners that respond are the ones relevant to the components of class. Can I have events that will be listened to over the complete scope of the program? or is there another way to have a component that can call a method in the class that as an object, it has been created in.
    Just as an example LeftPanel has a component to select the paint tool (its a simple drawing program) that will change a color attribute in the CanvasPanel object. Of course I realize i could have one massive Class with everything declared in it, but I'd rather learn if it is possible to do it this way!
    Thanks in advance for any help you can offer
    Lawrence
    Edited by: insertjokehere on Apr 15, 2008 12:24 PM

    Thanks for the response, ive added ActionListneres in the class where the component is, and in an external class. The Listeners work inside the class, but not in the external class
    import java.awt.event.ActionEvent;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    public class LeftPanel extends JPanel implements ActionListener {  
        /* Constructing JButtons, null until usage of the constructor */
        JButton pencilBut;
        JButton eraserBut;
        JButton textBut;
        JButton copyBut;
        JButton ssincBut;
        JButton ssdecBut;
        ActionListener a = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.print("\nNot supported yet.");
        /* The Top Panel contains the title of program */
        public LeftPanel(Dimension d){
            /* Sets up the layout for the Panel */
            BoxLayout blo = new BoxLayout(this,BoxLayout.Y_AXIS);
            this.setLayout(blo);
            /* Sets Up the Appearance of the Panel */
            this.setMinimumSize(d);
            this.setBackground(Color.RED);
            this.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
            /* Pencil Tool */
            pencilBut = new JButton("Pencil");
            pencilBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            pencilBut.setActionCommand("pencil");
            pencilBut.addActionListener(a);
            this.add(pencilBut);
            /* Eraser Tool */
            eraserBut = new JButton("Eraser");
            eraserBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            eraserBut.addActionListener(a);
            this.add(eraserBut);
            /* Text Tool */
            textBut = new JButton("Text");
            textBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            textBut.addActionListener(a);
            this.add(textBut);
            /* Copy Previous Page */
            copyBut = new JButton("Copy Page");
            copyBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            copyBut.addActionListener(a);
            this.add(copyBut);
            /* Stroke Size Increase */
            ssincBut = new JButton("Inc");
            ssincBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            ssincBut.addActionListener(a);
            this.add(ssincBut);
            /* Stroke Size Decrease */
            ssdecBut = new JButton("Dec");
            ssdecBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            ssdecBut.addActionListener(a);
            this.add(ssdecBut);
            System.out.print("\nLeftPanel Completed");
        public void actionPerformed(ActionEvent e) {
            System.out.print("\nAction Performed");
        }But this is not picked up in my external class here
    import java.awt.event.ActionEvent;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    public class MainPanel extends JPanel implements ActionListener {
        /* Creates a new the main JPanel that is used in the FlipBookFrame to contain all of the elements */
        public MainPanel(){
            /* TopPanel constraints*/
            tpcs.gridx = 1;
            tpcs.gridy = 0;
            tpcs.gridwidth = 1;
            tpcs.gridheight = 1;
            tpcs.fill = GridBagConstraints.BOTH;
            tpcs.weightx = 0.0;
            tpcs.weighty = 1.0;
            /* LeftPanel Constraints*/
            lpcs.gridx = 0;
            lpcs.gridy = 0;
            lpcs.gridwidth = 1;
            lpcs.gridheight = 3;
            lpcs.fill = GridBagConstraints.BOTH;
            lpcs.weightx = 1.0;
            lpcs.weighty = 1.0;
            /* CentrePanel Constraints*/
            cpcs.gridx = 1;
            cpcs.gridy = 1;
            cpcs.gridwidth = 1;
            cpcs.gridheight = 1;
            cpcs.fill = GridBagConstraints.NONE;
            cpcs.weightx = 0.0;
            cpcs.weighty = 0.0;
            /* RightPanel Constraints*/
            rpcs.gridx = 2;
            rpcs.gridy = 0;
            rpcs.gridwidth = 1;
            rpcs.gridheight = 3;
            rpcs.fill = GridBagConstraints.BOTH;
            rpcs.weightx = 1.0;
            rpcs.weighty = 1.0;
            /* BottomPanel Constraints*/
            bpcs.gridx = 1;
            bpcs.gridy = 2;
            bpcs.gridwidth = 1;
            bpcs.gridheight = 1;
            bpcs.fill = GridBagConstraints.BOTH;
            bpcs.weightx = 0.0;
            bpcs.weighty = 1.0;   
            this.setLayout(gblo);   //Sets the Layout of the panel to a GridBagLayout
            this.add(tp, tpcs); //Adds the TopPanel to the MainPanel using the TopPanel layout
            this.add(lp, lpcs); //Adds the LeftPanel to the MainPanel using the LeftPanel layout
            this.add(cp, cpcs); //Adds the CanvasPanel to the MainPanel using the CanvasPanel layout
            this.add(rp, rpcs); //Adds the RightPanel to the MainPanel using the RightPanel layout
            this.add(bp, bpcs); //Adds the BottomPanel to the MainPanel using the BottomPanel layout
            gblo.layoutContainer(this); //Lays Out the Container
        public PanelSizes getPanelSizes(){
            return ps;
        public void actionPerformed(ActionEvent e) {
            System.out.print("\nExternal Class finds event!");
            /*String command = e.getActionCommand();
            if (command.equals("pencil")){
                System.out.print("\nYESSSSSSSSSSSSSSSSSSSSS!");
        /* Create of objects using the PanelSizes funtions for defining the */
        PanelSizes ps = new PanelSizes();   //Creates a new PanelSizes object for sizing the panel
        CanvasPanel cp = new CanvasPanel(ps.getCentrePanelDimension()); //Creates a new Canvas Panel
        TopPanel tp = new TopPanel(ps.getHorizontalPanelDimension()); //Creates the TopPanel
        BottomPanel bp = new BottomPanel(ps.getHorizontalPanelDimension()); //Creates the BottomPanel
        LeftPanel lp = new LeftPanel(ps.getVerticalPanelDimension()); //Creates the LeftPanel
        RightPanel rp = new RightPanel(ps.getVerticalPanelDimension());   //Creates the RightPanel
        /* I have chosen to create individual constraints for each panel to allow for adding of all
         components a the end of the constructor. This will use slightly more memory but gives clarity
         in the code */
        GridBagConstraints cpcs = new GridBagConstraints();
        GridBagConstraints tpcs = new GridBagConstraints();
        GridBagConstraints bpcs = new GridBagConstraints();
        GridBagConstraints lpcs = new GridBagConstraints();   
        GridBagConstraints rpcs = new GridBagConstraints();
        GridBagLayout gblo = new GridBagLayout();
    }Any help will be greatly appreciated :-)

  • SWF panel listener for changed selection

    In short, my question is as follows. Is it possible to create a listener which
    detects when the current selection in the Flash authoring tool has changed,
    and informs my SWF panel? This does not have to be a listener per se,
    it can be some hand-crafted process which consumes some reasonable amount of processor time.
    I describe my question more precisely below.
    Suppose that I want to create an SWF extension panel for Flash (in Flash or Flex),
    and I would like the panel to display a property of the object currently selected on scene
    in the Flash IDE -- like the instance name of the object (if it exists).
    I can use JSFL to detect the instance name of the selected object, and pass the string to the
    SWF panel using call(), for instance. The problem is that I don't know how
    to detect that the user has selected the object, or that the selection has changed.
    Ideally, I would like to add an event listener that listens for such an action in the flash authoring tool.
    However, using JSFL, this does not seem to be possible (I can only listen to events such as frame changed
    or layer changed, but not selection changed).
    I tried the following solutions:
    1. Periodically check in JSFL whether the current selection has changed.
    The problem is that in JSFL, there is no sleep function, or anything alike. The javascript
    methods setInterval and setTimeout do not work in JSFL. Therefore, in order to periodically check for changes,
    one must actively loop. This is extremely resource-consuming -- in fact, it hangs the flash IDE.
    2. The periodic check can be triggered by the SWF panel itself. In actionscript, I can use setInterval to periodically
    invoke the selection update function via JSFL. I have set the interval to 400 milliseconds, which gives a reasonably quick
    reaction to changes. However, the functionality I want to implement is in fact more complicated than just retrieving the
    instance name of the selected object. As a consequence, performing this operation every 400 milliseconds still consumes
    too much processor time (the flash IDE consumes 30% of my processor time, even if the user doesn't do anything).
    Therefore, I still would like to find a solution which does not use the processor when the user does not do anything in the Flash IDE.

    I'm trying to do the same thing. Did you find a solution?

Maybe you are looking for

  • How to avoid the message "Do you want to save the changes you have made?"

    i have 3 forms master block detail1 block of master detail2 block of detail1 when i go out of detail1 and detail2 blocks after doing some modifications it asks me "Do you want to save the changes you have made"? i want to avoid this message as well a

  • I get a white screen with apple logo and progress bar on my imac mavericks

    I get a white screen with apple logo and progress bar ,then computer shuts down when I turn my imac back on same thing happens,every time same thing pprogress bar only goes half way then computer shut down is there a solution ? if not is there a way

  • Alarm "On Date" doesn't use the current entry start time

    When setting an alarm and choosing "On Date" it sets the date and time according to the initial time of the entry even if you have changed it first. So for instance I create a new calendar entry, it will default the time to the next hour from now 9:0

  • Sync problem in OVI Suite 3.0.0.284

    Working with nokia 2630 for a long time and since a few weeks with ovi suite 3.0.0.284. Also work with Outlook 2003. Ovi suite syncs my appointments en contacts between Outlook and 2630. This works fine, until this morning. The problem is a winter /

  • I cannot open iPhotos on my macbook pro

    how can i open iPhotos on my macbook pro  i cannot seem to down load the latest version on iTunes s