Problem with MouseEvent

this.addMouseListener(new MouseAdapter(){
           private void showIfPopupTrigger(MouseEvent mouseEvent) {
                try {
                    l.write("22222222222");
               } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                   if (popupMenu.isPopupTrigger(mouseEvent))
                        try {
                              l.write("3333333");
                         } catch (IOException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                         String name = getValueAt(getSelectedRow(), 1).toString();
                         if(getValueAt(getSelectedRow(), 2).toString().equals("FOLDER"))
                         popupMenu.init(false,name);
                         else
                              popupMenu.init(true,name);     
                         popupMenu.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
                 public void mousePressed(MouseEvent mouseEvent) {
                      try {
                              l.write("000000000000000000000");
                         } catch (IOException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                         if (mouseEvent.getButton() == MouseEvent.BUTTON3) // BUTTON3 is the right mouse button
                              try {
                                   l.write("11111111111111111111");
                              } catch (IOException e) {
                                   // TODO Auto-generated catch block
                                   e.printStackTrace();
                              showIfPopupTrigger(mouseEvent);
                 public void mouseReleased(MouseEvent mouseEvent) {
                         showIfPopupTrigger(mouseEvent);
          });In the above given code, when I right click the mouse button, control reaches till l.write("22222222222");, but, it is not getting inside if (popupMenu.isPopupTrigger(mouseEvent)) , instead of that, control again goes to public void mousePressed(MouseEvent mouseEvent), what can be the reason?
Rony

I got the output with this.
if (popupMenu.isPopupTrigger(mouseEvent))
                        int indRow = rowAtPoint(mouseEvent.getPoint());
                         getSelectionModel().addSelectionInterval(indRow, indRow);

Similar Messages

  • Problem with FLVPlayback and component

    First of all I had problem with control component. they are not working so i just named that ppo and change the visibility to false to get rid of problem!
    ppo.visible=false;
    Question1
    (is there anyway to solve the problem? I mean to match the controlbar with screen of FLVplayer.)
    Question2
    what is the difference btw Flvplayback and FLVplayback 2.5 ?
    Question3
    whenever I click in btn1 it plays the flv.but sometimes it has no action so i click again and suddenly it plays the 001.flv twice and simultanously(even more than twice!)
    how can I solve my problem ?
    ___________________Frame 1______________
    import fl.video.*;
    import flash.events.MouseEvent;
    var myVideo:FLVPlayback = new FLVPlayback();
    control.visible=false;
    myVideo.x = 115;
    myVideo.y = -10;
    myVideo.skinBackgroundColor = 0x333333;
    myVideo.skinAutoHide=true;
    myVideo.skinFadeTime=300;
    addChild(myVideo);
    btn1.addEventListener(MouseEvent.CLICK , c1);
    function c1(e:MouseEvent):void
    myVideo.source = '001.flv';   
    Question 4 : I want to jump to another frame and start another flv but I want to stop previous flv. and again add myVideo2 to stage like frame 1 pattern. Is it true ? is there any better way to do this ?
    ---------------------------frame5-----------------------
    import fl.video.*;
    import flash.events.MouseEvent;
    var myVideo2:FLVPlayback = new FLVPlayback();
    control2.visible=false;
    myVideo2.x = 115;
    myVideo2.y = -10;
    myVideo2.skinBackgroundColor = 0x333333;
    myVideo2.skinAutoHide=true;
    myVideo2.skinFadeTime=300;
    addChild(myVideo2);
    btn2.addEventListener(MouseEvent.CLICK , c2);
    function c2(e:MouseEvent):void
    myVideo2.source = '002.flv';   
    thank you in advanced..

    Question1
    (is there anyway to solve the problem? I mean to match the controlbar with screen of FLVplayer.)
    what are you calling the '..controlbar' and what are you calling the '...control component'?
    Question2
    what is the difference btw Flvplayback and FLVplayback 2.5 ?
    2.5 has more features, http://blogs.adobe.com/ktowes/2009/05/announcing_dvrcast_and_flvplay.html
    Question3
    whenever I click in btn1 it plays the flv.but sometimes it has no action so i click again and suddenly it plays the 001.flv twice and simultanously(even more than twice!)
    how can I solve my problem ?
    remove the click listener so you can only click once.  then you may need to wait if testing online.
    ___________________Frame 1______________
    import fl.video.*;
    import flash.events.MouseEvent;
    var myVideo:FLVPlayback = new FLVPlayback();
    control.visible=false;
    myVideo.x = 115;
    myVideo.y = -10;
    myVideo.skinBackgroundColor = 0x333333;
    myVideo.skinAutoHide=true;
    myVideo.skinFadeTime=300;
    addChild(myVideo);
    btn1.addEventListener(MouseEvent.CLICK , c1);
    function c1(e:MouseEvent):void
    myVideo.source = '001.flv';   
    Question 4 : I want to jump to another frame and start another flv but I want to stop previous flv. and again add myVideo2 to stage like frame 1 pattern. Is it true ? is there any better way to do this ?
    ---------------------------frame5-----------------------
    import fl.video.*;
    import flash.events.MouseEvent;
    myVideo.stop();
    removeChild(myVideo);
    myVideo=null;
    var myVideo2:FLVPlayback = new FLVPlayback();
    control2.visible=false;
    myVideo2.x = 115;
    myVideo2.y = -10;
    myVideo2.skinBackgroundColor = 0x333333;
    myVideo2.skinAutoHide=true;
    myVideo2.skinFadeTime=300;
    addChild(myVideo2);
    btn2.addEventListener(MouseEvent.CLICK , c2);
    function c2(e:MouseEvent):void
    myVideo2.source = '002.flv';   

  • Problem with drag and drop

    Hi! I'm having a problem with getting this code working, basically I want to drag and drop two things onto another the things dissapear then it moves onto a new page, the first item works properly but then the second item wont dissapear and remains stuck to the cursor. Heres the code I'd be greatful of any help.
    import flash.events.MouseEvent;
    import fl.motion.MotionEvent;
    stop();
    Back6_btn.addEventListener(MouseEvent.CLICK, onBack6Click)
    function onBack6Click(event:MouseEvent):void{
        gotoAndPlay("Bedroom2");
        Forward6_btn.addEventListener(MouseEvent.CLICK, onForward6Click)
    function onForward6Click(event:MouseEvent):void{
        gotoAndPlay('Brother bit');
    var inGran:Number=0;
    Gin.addEventListener(MouseEvent.MOUSE_DOWN, dragOn);
    Tonic.addEventListener(MouseEvent.MOUSE_DOWN, dragOn);
    function dragOn(event:MouseEvent):void {
        event.target.startDrag(false);
        stage.addEventListener(MouseEvent.MOUSE_UP, dragOff);
    function dragOff(event:MouseEvent):void {
        event.target.stopDrag();
        if (event.target.dropTarget!=null&&event.target.dropTarget.parent==Gran) {
            event.target.visible=false;
            inGran++;
        stage.removeEventListener(MouseEvent.MOUSE_UP, dragOff);
    function checkPage(e:Event):void {
        if (inGran==2) {
            gotoAndPlay("Bedroom1");

    you have some mismatched brackets, change your target properties to currentTarget (and i'm not sure you're dropping onto the correct target) but, try:
    import flash.events.MouseEvent;
    import fl.motion.MotionEvent;
    stop();
    Back6_btn.addEventListener(MouseEvent.CLICK, onBack6Click)
    function onBack6Click(event:MouseEvent):void{
        gotoAndPlay("Bedroom2");
        Forward6_btn.addEventListener(MouseEvent.CLICK, onForward6Click)
    function onForward6Click(event:MouseEvent):void{
        gotoAndPlay('Brother bit');
    var inGran:Number=0;
    Gin.addEventListener(MouseEvent.MOUSE_DOWN, dragOn);
    Tonic.addEventListener(MouseEvent.MOUSE_DOWN, dragOn);
    function dragOn(event:MouseEvent):void {
    event.currentTarget.parent.addChild(event.currentTarget);
        event.target.startDrag(false);
        stage.addEventListener(MouseEvent.MOUSE_UP, dragOff);
    function dragOff(event:MouseEvent):void {
        event.target.stopDrag();
        if (event.target.dropTarget!=null&&event.target.dropTarget.parent==Gran) {
            event.target.visible=false;
            inGran++;
        stage.removeEventListener(MouseEvent.MOUSE_UP, dragOff);
    function checkPage(e:Event):void {
        if (inGran==2) {
            gotoAndPlay("Bedroom1");

  • Problem with ScrollPane and JFrame Size

    Hi,
    The code is workin but after change the size of frame it works CORRECTLY.Please help me why this frame is small an scrollpane doesn't show at the beginning.
    Here is the code:
    import java.awt.*;
    public class canvasExp extends Canvas
         private static final long serialVersionUID = 1L;
         ImageLoader map=new ImageLoader();
        Image img = map.GetImg();
        int h, w;               // the height and width of this canvas
         public void update(Graphics g)
            paint(g);
        public void paint(Graphics g)
                if(img != null)
                     h = getSize().height;
                     System.out.println("h:"+h);
                      w = getSize().width;
                      System.out.println("w:"+w);
                      g.drawRect(0,0, w-1, h-1);     // Draw border
                  //  System.out.println("Size= "+this.getSize());
                     g.drawImage(img, 0,0,this.getWidth(),this.getHeight(), this);
                    int width = img.getWidth(this);
                    //System.out.println("W: "+width);
                    int height = img.getHeight(this);
                    //System.out.println("H: "+height);
                    if(width != -1 && width != getWidth())
                        setSize(width, getHeight());
                    if(height != -1 && height != getHeight())
                        setSize(getWidth(), height);
    }I create frame here...
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JFrame;
    public class frame extends JFrame implements MouseMotionListener,MouseListener
         private static final long serialVersionUID = 1L;
        private ScrollPane scrollPane;
        private int dragStartX;
        private int dragStartY;
        private int lastX;
        private int lastY;
        int cordX;
        int cordY;
        canvasExp canvas;
        public frame()
            super("test");
            canvas = new canvasExp();
            canvas.addMouseListener(this);
            canvas.addMouseMotionListener(this);
            scrollPane = new ScrollPane();
            scrollPane.setEnabled(true);
            scrollPane.add(canvas);
            add(scrollPane);
            setSize(300,300);
            pack();
            setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        public void mousePressed(MouseEvent e)
            dragStartX = e.getX();
            dragStartY = e.getY();
            lastX = getX();
            lastY = getY();
        public void mouseReleased(MouseEvent mouseevent)
        public void mouseClicked(MouseEvent e)
            cordX = e.getX();
            cordY = e.getY();
            System.out.println((new StringBuilder()).append(cordX).append(",").append(cordY).toString());
        public void mouseEntered(MouseEvent mouseevent)
        public void mouseExited(MouseEvent mouseevent)
        public void mouseMoved(MouseEvent mouseevent)
        public void mouseDragged(MouseEvent e)
            if(e.getX() != lastX || e.getY() != lastY)
                Point p = scrollPane.getScrollPosition();
                p.translate(dragStartX - e.getX(), dragStartY - e.getY());
                scrollPane.setScrollPosition(p);
    }...and call here
    public class main {
         public main(){}
         public static void main (String args[])
             frame f = new frame();
    }There is something I couldn't see here.By the way ImageLoader is workin I get the image.
    Thank you for your help,please answer me....

    I'm not going to even attempt to resolve the problem posted. There are other problems with your code that should take priority.
    -- class names by convention start with a capital letter.
    -- don't use the name of a common class from the standard API for your custom class, not even with a difference of case. It'll come back to bite you.
    -- don't mix awt and Swing components in the same GUI. Change your class that extends Canvas to extend JPanel instead, and override paintComponent(...) instead of paint(...).
    -- launch your GUI on the EDT by wrapping it in a SwingUtilities.invokeLater or EventQueue.invokeLater.
    -- calling setSize(...) followed by pack() is meaningless. Use one or the other.
    -- That's not the correct way to display a component in a scroll pane.
    Ah, well, and the problem is that when you call pack(), it retrieves the preferredSize of the components in the JFrame, and you haven't set a preferredSize for the scroll pane.
    Please, for your own good, take a break from whatever it is you're working on and go through The Java™ Tutorials: [Creating a GUI with JFC/Swing|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html]
    db

  • Problem with JComboBox in aTable Cell

    I try to put JComboBox in JTableCell,
    what i want to do is something like this...
    Question | Answer |
    1. what is your favourite | a. Pizza |
    food? | b. Hot Dog |
    2. what is your favourite | a. red |
    color? | b. blue |
    Object[][] data = {
    {"1.What is your favourite food?", new AnswerChoices(new String[]{"a.Pizza","b.Hot Dog"})},
    {"2.What is your favourite color?", new AnswerChoices(new String[]{"a.red","b.blue"})}
    here my code;
    //class AnswerChoicesCellEditor
    import javax.swing.table.*;
    import javax.swing.*;
    import java.awt.Component;
    import java.awt.event.MouseEvent;
    import java.util.EventObject;
    import de.falcom.table.*;
    public class AnswerChoicesCellEditor extends AbstractCellEditor implements TableCellEditor{
         protected JComboBox mComboBox;
    public AnswerChoicesCellEditor(){
         mComboBox = new JComboBox();
         mComboBox.addActionListener(this);
         mComboBox.setEditable(false);
    public Component getTableCellEditorComponent(JTable table,Object value,boolean isSelected,int row,int column){
         if(value instanceof AnswerChoices){
              AnswerChoices a = (AnswerChoices)value;
              String[] c = a.getChoices();
              mComboBox.removeAllItems();
              for(int i=0; i < c.length; i++)
                   mComboBox.addItem(c);
                   mComboBox.setSelectedIndex(a.getAnswer());
         return mComboBox;
    public Object getCellEditorValue(){
         int nchoices = mComboBox.getItemCount();
         String[] c = new String[nchoices];
         for(int i = 0; i<nchoices; i++){
              c[i] = mComboBox.getItemAt(i).toString();
         return new AnswerChoices(c,mComboBox.getSelectedIndex());
         //return mComboBox.getSelectedItem(); //here i get but after selection there is no comboBox in tableCell
    //the Renderer class
    import javax.swing.table.TableCellRenderer;
    import javax.swing.*;
    import java.awt.Component;
    public class AnswerChoicesCellRenderer extends JComboBox implements TableCellRenderer {
         private Object curValue;
    /** Creates new AnswerChoiceCellRenderer */
    public AnswerChoicesCellRenderer() {
    setEditable(false);
    public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
    if (value instanceof AnswerChoices) {
    AnswerChoices nl = (AnswerChoices)value;
    String[] tList = nl.getChoices();
    if (tList != null) {
    removeAllItems();
    for (int i=0; i<tList.length; i++)
    addItem(tList[i]);
         setSelectedIndex(AnswerChoices.getAnswer());
         //this.setSelectedItem();
    //return this;
    //this.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
    if (table != null)
    if (table.isCellEditable(row, column))
    setForeground(CellRendererConstants.EDITABLE_COLOR);
    else
    setForeground(CellRendererConstants.UNEDITABLE_COLOR);
              setBackground(table.getBackground());
    return this;
    public class AnswerChoices {
         static int ans = 0;
         String[] choices ;
    public AnswerChoices(String[]c,int a){
              choices = c;
              ans          = a;
    public AnswerChoices(String[] c){
              this(c,0);
    public String[] getChoices(){
         return choices;
    public void setAnswer(int a){
         ans = a;
    public static int getAnswer(){
         return ans;
    //the TableModel i used in my app
    import java.awt.Color;
    import javax.swing.JTable;
    import javax.swing.ListSelectionModel;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellEditor;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableModel;
    import javax.swing.*;
    public class FAL_Table extends JTable {
    /** Creates new FAL_Table */
    public FAL_Table(DefaultTableModel dtm) {
    super(dtm);
    setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    setRowSelectionAllowed(false);
    setColumnSelectionAllowed(false);
    setBackground(java.awt.Color.white);
    setDefaultCellEditorRenderer();
    private void setDefaultCellEditorRenderer(Class forClass, TableCellEditor editor, TableCellRenderer renderer) {
         setDefaultEditor(forClass, editor);
         setDefaultRenderer(forClass, renderer);
         private void setDefaultCellEditorRenderer() {
              // Setting default editor&renderer of Boolean
              setDefaultCellEditorRenderer(Boolean.class, new BooleanCellEditor(), new BooleanCellRenderer());
              //Setting default editor&renderer of ComboBox
              setDefaultCellEditorRenderer(JComboBox.class, new ComboBoxCellEditor( ),new ComboBoxRenderer());
              // Number class
              // Setting default editor&renderer of java.math.BigDecimal
              setDefaultCellEditorRenderer(java.math.BigDecimal.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of java.math.BigInteger
              setDefaultCellEditorRenderer(java.math.BigInteger.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of java.lang.Byte
              setDefaultCellEditorRenderer(Byte.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Double
              setDefaultCellEditorRenderer(Double.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Float
              setDefaultCellEditorRenderer(Float.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Integer
              setDefaultCellEditorRenderer(Integer.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Long
              setDefaultCellEditorRenderer(Long.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of Short
              setDefaultCellEditorRenderer(Short.class,new NumberCellEditor(), new NumberCellRenderer());
              // Setting default editor&renderer of String
              setDefaultCellEditorRenderer(String.class,new StringCellEditor(), new StringCellRenderer());
              // Setting default editor&renderer of FileName
              setDefaultCellEditorRenderer(FileName.class,new FileNameCellEditor(), new FileNameCellRenderer());
              // Setting default editor&renderer of Color
              setDefaultCellEditorRenderer(Color.class,new ColorCellEditor(), new ColorCellRenderer());
              setDefaultCellEditorRenderer(AnswerChoices.class, new AnswerChoicesCellEditor(), new AnswerChoicesCellRenderer());
              setDefaultCellEditorRenderer(JSpinner.class, new SpinnerCellEditor(), new SpinnerRenderer());
    public Class getCellClass(int row,int col) {
    TableModel model = getModel();
    if (model instanceof FAL_TableModel) {
    FAL_TableModel ptm = (FAL_TableModel)model;
    return ptm.getCellClass(row,convertColumnIndexToModel(col));
    return model.getColumnClass(convertColumnIndexToModel(col));
    public TableCellRenderer getCellRenderer(int row, int column) {
    TableColumn tableColumn = getColumnModel().getColumn(column);
    TableCellRenderer renderer = tableColumn.getCellRenderer();
    if (renderer == null) {
    renderer = getDefaultRenderer(getCellClass(row,column));
    return renderer;
    public TableCellEditor getCellEditor(int row, int column) {
    TableColumn tableColumn = getColumnModel().getColumn(column);
    TableCellEditor editor = tableColumn.getCellEditor();
    if (editor == null) {
    editor = getDefaultEditor(getCellClass(row,column));
    return editor;
    import javax.swing.table.*;
    import java.util.Vector;
    import java.awt.event.MouseEvent;
    import java.util.EventObject;
    public class FAL_TableModel extends DefaultTableModel implements TableModel {
    public FAL_TableModel() {
    this((Vector)null, 0);
    public FAL_TableModel(int numRows, int numColumns) {
    super(numRows,numColumns);
    public FAL_TableModel(Vector columnNames, int numRows) {
    super(columnNames,numRows);
    public FAL_TableModel(Object[] columnNames, int numRows) {
    super(convertToVector(columnNames), numRows);
    public FAL_TableModel(Vector data, Vector columnNames) {
    setDataVector(data, columnNames);
    public FAL_TableModel(Object[][] data, Object[] columnNames) {
    setDataVector(data, columnNames);
         public boolean isCellEditable(int row, int col) {
    //Note that the data/cell address is constant,
    //no matter where the cell appears onscreen.
    Object obj = getValueAt(row,col);
    if (col != 1){
    return false;
         }else{
              return true;
    public Class getCellClass(int row,int col) {
    Object obj = getValueAt(row,col);
    if (obj != null)
         return obj.getClass();
         else
         return Object.class;
    public Object getCellValue(int row,int col) {
    Object obj = getValueAt(row,col);
              return obj;      
    my problem is, when i select an item from one of the comboBox in the table the value of the other cells changes too and i have the same problem with JSpinner.
    please help i am stuck
    Gebi

    and when i try to get the current value oa a cell it returns the Component class like this
    AnswerChoices@bf1f20 ...

  • Problem with XML loading and xmlns

    I'm having a problem with loading an XML file that was created by Filemaker.  Filemaker will output an XML file using one of two different grammars.  One outputs in a mostly standard form that I can use with one glitch.  Flash CS4 AS3 seems to have a problem with the xmlns in one of the nodes.
    Specifically:
    <FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
    If I remove the xmlns="http://www.filemaker.com/fmpdsoresult" the file loads properly and I can access the various fields with no problem.  However, when I leave the xmlns=... in, it will trace out the XML properly but I can't access the fields using the code listed below.  This is driving me crazy!
    With the xmlns part in the XML file I get the following error when it tries to load the thumbnail files:
    TypeError: Error #1010: A term is undefined and has no properties.
    I need to have it so that the user can enter/edit data and simply output the XML file from Filemaker and then Flash will load up the unaltered XML file and show the info requested by the user.  That is to say I could have the user open the XML file in a word processing application and have them delete the xmlns..., but that is rather cumbersome and not very user friendly.
    I've tried every xml.ignore function I could find but it doesn't help.  Hopefully someone out there can help
    Thanks,
    -Mark-
    Partial XML:
    XML From Filemaker Export:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- This grammar has been deprecated - use FMPXMLRESULT instead -->
    <FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
      <ERRORCODE>0</ERRORCODE>
      <DATABASE>Sport.fp7</DATABASE>
      <LAYOUT></LAYOUT>
      <ROW MODID="1" RECORDID="1">
        <FirstName>Mark</FirstName>
        <LastName>Fowle</LastName>
        <Sport>Sailing</Sport>
        <Medal>None</Medal>
        <CourseOfStudy>Design</CourseOfStudy>
        <Year>1976-1978</Year>
        <HomeState>California</HomeState>
        <ImageName>93</ImageName>
      </ROW>
    </FMPDSORESULT>
    AS3 Code:
    import fl.containers.UILoader;
    var aPhoto:Array=new Array(ldPhoto_0,ldPhoto_1,ldPhoto_2,ldPhoto_3,ldPhoto_4,ldPhoto_5);
    var toSet:int=10;//time out set time
    var toTime:int=toSet;
    var photoPerPage:int=6;
    var fromPos:int=photoPerPage;
    var imgNum:Number;
    //var subjectURL:URLRequest=new URLRequest("testData_FM8.xml");
    var subjectURL:URLRequest=new URLRequest("Sports.xml");
    var xmlLoader:URLLoader=new URLLoader(subjectURL);
    xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
    var subjectXML:XML = new XML();
    subjectXML.ignoreWhitespace=true;
    subjectXML.ignoreComments=true;
    subjectXML.ignoreProcessingInstructions=true;
    function xmlLoaded(evt:Event):void {
        subjectXML=XML(xmlLoader.data);
        if (root.loaderInfo.bytesTotal==root.loaderInfo.bytesLoaded) {
            removeEventListener(Event.ENTER_FRAME, xmlLoaded);
            trace("XML Data File Loaded");
            trace(subjectXML);
        } else {
            trace("File not Found");
        imgNum=2;//subjectXML.ROW.length;
        trace(subjectXML);
        loadThumb(0);
    function loadThumb(startPos:int):void {
        var count:Number=aPhoto.length;
        trace(subjectXML.DATABASE);
        for (var i=0; i<count; i++) {
        try{
            aPhoto[i].source="images/"+subjectXML.ROW[startPos+i].ImageName+"_main.jpg";
        }catch (e:Error){
            trace(e);
            aPhoto[i].mouseChildren=false;
            aPhoto[i].addEventListener(MouseEvent.MOUSE_DOWN, onThumbClick);
        trace("Current mem: " + System.totalMemory);
        ldAttract.visible=false;
    function unloadThumb():void {
        var count:Number=aPhoto.length;
        for (var i=0; i<count; i++) {
            aPhoto[i].unload();
            aPhoto[i].removeEventListener(MouseEvent.MOUSE_DOWN, onThumbClick);
        trace("Current mem: " + System.totalMemory);
    function onThumbClick(evt:MouseEvent) {
        var i:Number;
        //trace("Thumbnail Clicked " + evt.target.name);
        i=findPos(evt.target.name);
        ldLrgPhoto.source="images/"+subjectXML.ROW[i+fromPos].LOCAL_OBJECT_ID+"_main.jpg";
        ldLrgPhoto.visible=true;
        btnPrev.visible=false;
        btnNext.visible=false;
        gotoAndStop("showPhoto");
    function findPos(thumb:String):Number {
        var pos:Number;
        var count:Number=aPhoto.length;
        for (var i:Number=0; i<count; i++) {
            if (thumb==aPhoto[i].name) {
                pos=i;
        return pos;

    Hi,
    I was trying to use xml namespaces, so in my application I receive an XML file from the server. The file has a namespace, so when I parse the file I need to specify the namespace:
    I got the following piece of xml:
    <ls:exchange xmlns:ls=".../tsw" xmlns:tm="http://kxa">
        <ls:projects>
             <tm:annotation id="" date="" action="getprojects" status="responseok"/>         
        <ls:project id="" name="proj" description="..." owner="asss"  release="2" />
            <ls:projectV  id="" version="" creationdate="" modificationdate=""/ >
        </ls:project>
    </ls:projects>
    </ls:exchange>
    and the following code
    <mx:VBox label="WELCOME" verticalScrollPolicy="off" horizontalScrollPolicy="off">
          <mx:Tree id="tree" dataProvider="{srv.lastResult.project}" labelField="@name"  width="300" height="100%" itemOpen="itemOpenEvt(event);" />
    </mx:VBox>
    So i want to display the content of the xml (project nodes”) in a tree view, but i don’t know how to includes the namespace"ls:" in the data provider “srv.lastResult.project”. can u help me it’s urgent.
    sincerly
    Celine

  • Problem with image url

    Hello,
    today I have a problem with image url. I wanted Image to change when mouse dragged over it. But nothing happened. Any ideas?
    def maxIco: ImageView = ImageView{
    image: Image{
    url: "{__DIR__}ikony/max.png"
    onMouseDragged: function(event: MouseEvent){
    maxIco.image = Image{
    url: "{__DIR__}ikony/max2.png"
    }

    This is working for me:
    src/main/Main.fx
    src/main/icon/image1.bmp
    src/main/icon/image2.bmp
    //Main.fx
    package main;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.input.MouseEvent;
    var changed = false;
    def imgView: ImageView = ImageView {
        image: Image {
            url: "{__DIR__}icon/image1.bmp"
        onMouseDragged: function (e: MouseEvent): Void {
            if (not changed) {
                imgView.image = Image {
                    url: "{__DIR__}icon/image2.bmp"
                changed = true;
                println(imgView.image.url);
        onMouseReleased: function (e: MouseEvent): Void {
            imgView.image = Image {
                url: "{__DIR__}icon/image1.bmp"
            changed = false;
            println(imgView.image.url);
    Stage {
        title: "ImageTest"
        scene: Scene {
            width: 700
            height: 600
            content: [
                imgView
    }I've changed few things to switch image only one time on mouseDragged event.
    It print the image URL.

  • Having problem with change of name in the datagrid Coding

    I am having problem with changing the name of the datagrid header text name for one of the data either in the flash file or the php file.
    The thing is i want to change the Course_Name to Course Name that has no underscore so that it will look nicer in the datagrid but if I change it in the php file like SELECT Course_Name as 'Course Name' ....., it will not turn out in the datagrid when I CTRL ENTER the flash file but the others like Price,description and display is shown.
    There is no problem with my php code but I do not know how to change the Course_Name into Course Name so please help me resolve this error that I am having.
    This is my flash code
      function goCourse(e : MouseEvent):void
      gotoAndStop(5);
      refreshResponder = new Responder (refreshSuccess, onFault);
      connection = new NetConnection ();
      connection.connect (gateway);
      dataDG.addEventListener (Event.CHANGE, gridItemSelected);
      refreshData (true);
      function gridItemSelected (e: Event): void {
      ID = e.target.selectedItem.ID;
      courseTxt.text = e.target.selectedItem.Course_Name;
      priceTxt.text = e.target.selectedItem.Price;
      descTxt.text = e.target.selectedItem.Description;
      private function getParams () {
      var param: Object = new Object ();
      param.ID = ID;
      param.Course_Name = courseTxt.text;
      param.Price = priceTxt.text;
      param.Description = descTxt.text;
      return param;
      private function refreshData (refresh: Boolean): void {
      if (refresh)
      connection.call ("Course.viewCourse", refreshResponder);
      private function refreshSuccess (result: Object): void {
      dataDG.dataProvider = RecordSetDP.toDataProvider (result);
         dataDG.columns = ["Course_Name","Price","Description","Display"];
      private function onFault (fault: Object): void {
      trace (String (fault.description));
    This is my php file code.
      function viewCourse()
      $this->connect();
      $sql = "SELECT Course_Name,Price,Description,Display
      FROM coursetb";
      return mysql_query($sql,$this->_connection);

    i don't see where you're calling your php file in your code, but change 'Course Name' to 'Course_Name' (or vice-versa) there.

  • Problem with action script 3 make input text box and button....

    Hi every one I am trying to make a family book using "Air for Android" with a simple search engin in the book
    air for android only work with AS3,
    the search function is to type a person's name and hit submit then go to a specific frame.
    have a problem making below code to work in AS3 and hopefully one of you guys can lead me in the right direction to fix the issue.
    Currently, I have an input text box and a button. When you type specific words into the input box and then hit the button it sends you to a specific frame.
    (it work find in AS2 but not in AS3,)
    Here is my current code that is placed on the main timeline, first frame:
    stop();
    onEnterFrame = function () {
        submit.onRelease = function() {
            switch (yourname.text) {
            case "name1" :
                gotoAndStop(2);
                break;
            case "name2" :
                gotoAndStop(3);
                break;
    My button that checks if the phrase is correct is called "submit" and my input box has an instance of "yourname".
    My phrases that will be accepted in the input box are "name1" and "name2" which bring me to two different frames.
    Basically, I'm having a problem with making this to work with AS3.

    you should use the default option in the switch statement
    that way yourname contains something not in one of the case statements it will go to the default bit and execute teh code there
    function onSubmit(e:MouseEvent):void
                                  switch (yourname.text)
                                            case "name1":
                                                      gotoAndStop(2);
                                                      break;
                                            case "name2":
                                                      gotoAndStop(3);
                                                      break;
                                            default:
                                                      goToAndStop(you frame you want);
                                            break;

  • Problems with tooltips

    Here's the problem I am having: I would like to have a tooltip that dynamically changes based on what position it is currently hovering over on a custom control.
    After looking through the various tooltip methods, it would seem that the way to do this is using JComponent's String getToolTipText(MouseEvent e)The problem with this approach is that once the tooltip pops up, moving the mouse will continually call this method. What I would like is to dismiss the tooltip once the mouse moves and essentially reset the tooltip hover timer. Does anyone know of a way to do this?

    That's not quite what I am looking for, though thanks for trying. The problem with both of these situations (using contains(int, int) and using getToolTipText(MouseEvent)) for updating the tooltip text is that they are both called too frequently for me to use them.
    I'll elaborate on my problem and maybe someone can see a solution. I am creating a custom text component that highlights specific areas of text and I want to provide a tooltip when the mouse hovers over those areas. If I override the contains method as in the SwingSet2 example, I will be constantly updating the tooltip text because it is called every time the mouse moves. If I override the getToolTipText(MouseEvent) method, once the tooltip pops up it will constantly query getToolTipText(MouseEvent) as the mouse moves until it moves off the screen.
    Determining what tooltip text to display (if any) in this particular application takes enough time that it really shouldn't be calculated each time the mouse is moved. I would like to only compute the tooltip text if the mouse hovers on a particular area. Unfortunately, there is no mouse hover event in swing like there is in SWT, so I seem to be out of luck. That is, unless someone else has come across this same problem and knows a way around it :).

  • Some strange problem with Flash/As3

    Hi,
    I am having some strange problem with my flash cs3.
    Whatever script I write in as3  doesn't work, even a stop() function doesn't work . But when I change my publish setting to as2 it works fine.
    Not sure about the root cause, may be some setting or preference or my cs3 is corrupted.
    Can anybody please advise.
    Thanks,
    Kishor

    try this
    create a new fla as3,
    select frame 1
    open the actions panel
    paste in the following code
    var squares:Array = new Array;
    setup();
    function setup():void {
        for (var i = 0; i < 25; i++) {
            var square:Sprite = new Sprite();
            //square.name = "square" + i;
            square.graphics.beginFill(Math.random() * 0xffffff);
            squares.push(square);
            squares[i].graphics.drawRect(0, 0, 100, 100);
            squares[i].x = i*3;
            squares[i].y = i*3;
            squares[i].filters = [];
            square.graphics.endFill();
            stage.addChild(squares[i]);
    for (var j = 0; j < squares.length; j++) {
        squares[j].addEventListener(MouseEvent.MOUSE_DOWN, dragMovie);
        squares[j].addEventListener(MouseEvent.MOUSE_UP, dropMovie);
        squares[j].buttonMode = true;
    function dragMovie(event:MouseEvent):void {
        event.target.startDrag();
    function dropMovie(event:MouseEvent):void {
        event.target.stopDrag();

  • Problems with Click a row in the Table

    Dear All,
    I am new to Java GUI. I got some problems with clicking the row in a table.
    My table allows the user to delete some rows fromt the table. When the user click a row or some rows in my table, the delete button should be enabled. It does work in most of the time. But sometimes, even the row being hight lighted, the button is still not enabled.
    Do you have any idea for what can cause this problem?
    What I did is :
    1. add a mouse listener to the table
    _userTable.addMouseListener(new java.awt.event.MouseAdapter()
    public void mouseClicked(MouseEvent e)
    userList_mouseClicked(e);
    2. then, if the row being selected is > 0, I will enable my delete button.
    Can anybody help?
    Thanks!

    Dear All,
    I am getting problems with single selection in a table. Although I have set the selection model to single, if I select a row int the table and then depress Ctrl/Shift multiple rows are selected.
    The code for set single selection is :
    ListSelectionModel seleModel = myTable.getSelectionModel();
    seleModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    Any idea about this? Is this a bug in JAVA?
    Thanks!

  • Performance problems with UI grid of rectangles

    Am looking for some help on how to program a specific user interface (UI). I need to create a large matrix (n x m) of rectangles, and give the user the ability to click and drag the mouse over them to select them. When a user clicks/drags over a rectangle, it should repaint itself a different color and store the fact that it was selected. Since the matrix is rather large, I want to put it in a JScrollPane so that the user can scroll over the entire matrix.
    So far I have come up with two ways to do this, and one of them was horrendously slow. (It is unusable.) I would like some advice on how to do this to get the best UI performance so that I have a really slick and fast UI. The two methods I have tried are:
    1. Create a new class called MyRectangle that extends java.awt.Rectangle. This is a pretty simple class that just adds a couple of instance vars to keep track of if it has been selected or not, and what color it should paint itself and its border. Next, I create a class called MyJPanel that extends JPanel. MyJPanel contains an (n x m) array of MyRectangles and overloads the paintComponent() method to paint them all on the panel. MyJPanel also implements the mouseListener(s) so it can tell when someone has pressed/clicked/ or dragged over it. When it receives a MouseEvent, it finds the correct MyRectangle (by comparing the point returned on MyJPanel), sets that MyRectangle's instance vars appropriately, and then calls UpdateUI().
    Here is the problem with this design. That array of MyRectangles looks at least like this:
    MyRectangle myRectangleArray[][] = new MyRectangle[50][200];
    So, in the paintComponent() method of the MyJPanel, it has to iterate through the 50 * 200 rectangles in order to know how to paint each one on the screen. Not to mention the fact that at each one it has to do a comparision to determine how to set Graphics2D.setPaint( Color.XX ); for that specific rectangle. As mentioned, I have implemented this and it is EXCRUTIATINGLY SLOW. So, I moved on to....
    2. Create a new class called MyJButton that extends javax.swing.JButton. MyJButton contains instance vars to note if it is selected or not, what its background color should be. MyJButton also implements the mouseListener(s) and handles all the MouseEvents themselves. Now, instead of having MyJPanel overload paintComponent() and handle all that myself, I just have it contain an (n x m) array of MyJButtons and just add them to the panel using a GridLayout. The problem here is that the mouseDragged event doesn't work quite the way I'd like. In order to implement mouseDragged, I have to create an interface and have each MyJButton callback to its container MyJPanel to tell it when / where the dragging started and stopped so that MyJPanel can update all the other MyJButtons. However, the performance seems to be much better and the user can click all over without causing the screen to lock up doing repaints.
    Ok, here's my question. DOES ANYONE HAVE A BETTER WAY OF DOING THIS???
    What I want is to present the user with an (n x m) matrix of rectangles (inside a scrollable pane). This matrix will be LARGE, like at least 50 x 200 and would prefer to go up to 70 x 500 or more. The size of each rectangle will need to be definable as the number of columns gets larger, I will need to make the size of the individual rectangles smaller. The user should be able to click and drag over these rectangles, and the program should store which row / column was selected, and should then paint those selected rectangles on the screen in a different (configurable) color.
    Can anyone offer any help?
    Don Osburn
    [email protected]
    [email protected]

    using JTable is worth looking into, I did a quick test for speed purposes and this looks good if you do decide to go with a custom solution. Mouse processing shouldn't be too hard (the code for converting from user space to model space is in the paint method), but I can't figure out how to intercept mouse events properly (think this is done in the UI delegate or smt)
    asjfimport javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MatrixComponent extends JComponent {
       int rows, columns;
       int swidth, sheight;
       Dimension mySize;
       boolean [][] isSelected;
       Font myFont;
       public MatrixComponent(int rows, int columns, int w, int h) {
          this.rows = rows;
          this.columns = columns;
          this.swidth = w;
          this.sheight = h;
          this.mySize = new Dimension(columns*swidth,rows*sheight);
          this.isSelected = new boolean [columns][rows];
          this.myFont = new Font("Monotype",Font.PLAIN,8);
       public void paintComponent(Graphics g) {
          Rectangle clip = g.getClipBounds();
          int sx = clip.x/swidth;
          int ex = Math.min(1 + sx + clip.width/swidth, columns);
          int sy = clip.y/sheight;
          int ey = Math.min(1 + sy + clip.height/sheight, rows);
          g.setFont(myFont);
          for(int x=sx; x<ex; x++)
             for(int y=sy; y<ey; y++) {
                g.setColor(new Color(x*255/columns, y*255/rows, 100));
                g.drawRect(x*swidth,y*sheight,(swidth-1),(sheight-1));
                g.drawString(""+(x+y*columns),swidth/2+x*swidth,sheight/2+y*sheight);
       public Dimension getPreferredSize() {return mySize;}
       public Dimension getMaximumSize() {return mySize;}
       public Dimension getMinimumSize() {return mySize;}
       public static void main(String [] arg) throws Exception {
          JFrame frame = new JFrame("MatrixComponent");
          frame.getContentPane().add(new JScrollPane(new MatrixComponent(1000,1000,50,50)));
          frame.pack();
          frame.show();
    }

  • Problems with WEBSERVICES

    Hello,
    i have some Problems with WebServices.
    When I call my function how makes the request (get_frob), it goes back to the main program and make a print! After that my request starts!
    I want that the request finished first and then make a print!
    I need threats for this???and how does it work?
    My englisch is not so good I´m sorry for that!
    Please help me
    Thanks
    Chris
    def Button_Autorisieren:SwingButton=SwingButton{
        text:"Autorisieren"
        width:100
        translateY:150
        action:function()
            var Authentication:HTTP_Authentication=new HTTP_Authentication();
            Authentication.get_frob();
            java.lang.System.out.println(Authentication.abfrage);
    public class HTTP_Authentication {
        var api_key:String="***********";
        var secret_key:String="***********";
        var stat:String;
        var sig:String;
        var frob:String;
        var method:String;
        var md5_String:String;
        var perms:String;
        var api_sig:String;
        public var abfrage:Boolean;
        public var link:String;
        def md5:MD5=new MD5();
        var parser = PullParser{
            documentType: PullParser.XML;
            onEvent: function(event: Event) {
                    if (event.type == PullParser.START_ELEMENT ) {
                        if(event.qname.name == "rsp" and event.level==0)
                           stat=event.getAttributeValue(QName{name:"stat"});
                        if (stat=="ok")
                         if(event.type==PullParser.END_ELEMENT)
                              if(event.qname.name == "frob")
                                  frob=event.text;
                                  java.lang.System.out.println("Frob: {frob}");
                                   abfrage=true;
        public function get_frob ()
            method="flickr.auth.getFrob";
            md5_String="{secret_key}api_key{api_key}method{method}";
            java.lang.System.out.println(md5_String);
            sig=md5.makeMD5(md5_String);
            java.lang.System.out.println(sig);
            var request = HttpRequest {
                    location: "http://api.flickr.com/services/rest/?method={method}&api_key={api_key}&api_sig={sig}"
                    method: HttpRequest.GET
                    onInput: function(input: java.io.InputStream)
                                    parser.input=input;
                                    parser.parse();
                                    input.close();
                        }.enqueue();
        }

    Hello,
    thank you for your answer. It was my mistake, I discribe the problem very bad.
    When i call the function get_frob(). Netbeans goes in the function and run through the end but nothing happened
    onMouseClicked: function( e: MouseEvent ):Void {
                         test=Authentikation_Frob.get_frob();and in my if clausel there will be a wrong output! After the output my programm go back to the function get_frob() and then make the request and go back to the if clausel. Now everything ist correct. But why does my programm need 2 runs ????thats not correct!!
    Thank you!!
    if (test==true)
                             var Authentikation_Link:HTTP_Authentication_Link=new HTTP_Authentication_Link();
                            link=Authentikation_Link.get_link();
                            var uri = new java.net.URI("{link}");
                             var desktopClazz = java.lang.Class.forName("java.awt.Desktop");
                             var getDesktopMethod = desktopClazz.getMethod("getDesktop");
                             var desktop = getDesktopMethod.invoke(null);
                             var browseMethod = desktopClazz.getMethod("browse", [uri.getClass()] as java.lang.Class[]);
                              browseMethod.invoke(desktop, uri);
                         else
                             fehler_ausgabe.visible=true;
                             fehler_ausgabe.content="Fehler {Authentikation_Frob.frob_fehler} {Authentikation_Frob.frob_hilfe}";
                         }Edited by: Esco24 on Aug 10, 2009 1:02 AM

  • Problem with Repositioning Chart

    Hi, I am currently working on a project for which I am trying to take a column chart and allow the user to click and drag the mouse to create a zoom window. When the mouse is released the chart is zoomed in on the area that was covered by the mouse.
    I also want a scroll bar to appear after the chart zooms in so the rest of the chart can be scrolled to in the zoomed-in view. I have written code to do both of these things but I am having a problem. When I drag over the chart to zoom in it zooms fine and the scroll bar appears but the issue is that the portion of the chart that is displayed is the left-most portion, no matter which part I selected to have the view zoom in on. The methods are called when there is a mouseDown, mouseMove, and mouseUp event on the chart, respectively.
       //Declares the zoom variables
       [Bindable]
       private var dragStart:Point;
       private var dragEnd:Point;
       private var TL:Point;
       private var BR:Point;
       private var zooming:Boolean = false;
       //Declares the scroll variables
       private var negProp:int;
       //Sets the start point for the zoom window
       private function startDraw(event:MouseEvent):void
        zooming = true;
        dragStart = new Point(columns.mouseX, columns.mouseY);
       //Draws the zoom window as the mouse moves
       private function showDraw(event:MouseEvent):void
        if(zooming)
         dragEnd = new Point(columns.mouseX, columns.mouseY);
         //Finds the top-left and bottom-right points of the zoom window
         TL = new Point();
         BR = new Point();
         if(dragStart.x < dragEnd.x)
         { TL.x = dragStart.x;
          BR.x = dragEnd.x;
         else
         { TL.x = dragEnd.x;
          BR.x = dragStart.x;
         if(dragStart.y < dragEnd.y)
         { TL.y = dragStart.y;
          BR.y = dragEnd.y;
         else
         { TL.y = dragEnd.y;
          BR.y = dragStart.y;
         //Keeps the zoom window from going off the canvas
         if(TL.x < 0)
          TL.x = 0;
         if(BR.x < 0)
          BR.x = 0;
         if(TL.x > chartCanvas.width - 1)
          TL.x = chartCanvas.width - 1;
         if(BR.x > chartCanvas.width - 1)
          BR.x = chartCanvas.width - 1;
         //Draws the zoom window
         chartCanvas.graphics.clear();
         chartCanvas.graphics.lineStyle(1, 0x000000, 0.25);
         chartCanvas.graphics.beginFill(0xd4ef0, 0.5);
         chartCanvas.graphics.drawRect(TL.x, TL.y, BR.x-TL.x, BR.y-TL.y);
         chartCanvas.graphics.endFill();
       //Clears the drawing canvas and sets the new coordinates
       private function endDraw(event:MouseEvent):void
        zooming = false;
        chartCanvas.clear();
        negProp = TL.x / wipChart.width;
        wipChart.width = (wipChart.width / (BR.x-TL.x)) * wipChart.width;
        wipChart.x = -1 * (negProp * wipChart.width);
    If anyone can help me I'd greatly appreciate it. Thank you.

    Seems to simply be a problem with your data. See this
    code.

Maybe you are looking for

  • Question about FMIR - open close fm periods

    A simple question: In the fmir transaction (to open and close fm posting periods), if the "From" column for a particular year is blank (not zero, but BLANK), and the "To" column has 12, then will the whole year be open? Or does the "From" column have

  • 10.3.9 and HP Laserjet 'jobs stopped' Can I pretend it's another printer?

    Cannot get HP Laserjet M1120 MFP to print on my Mac Mini running 10.3.9: the printer is correctly identified in the Printer Setup Utility. But when i print, from any program, everything looks like it's going to happen but then I get the message 'jobs

  • Anyone Figured Out How to Get Snow Leopard Working on a Retina 15" ?

    Hi All, Has anyone figured out a way to get Snow Leopard to install and run stable on a Macbook Pro 15 Retina? Just like Lion, Mountain Lion is flaky, and just isn't as rock solid as Snow Leopard. Media, Finder, and a host of other system level attri

  • TS4268 iMessaging NOT working.  Please help

    Updated my 4s and now I can't get my iMessaging or FaceTime to work.  I keep getting an error reading, "Could not sign in.  Please check your network connection and try again."  My connection is fine... I think.  I don't seem to have trouble connecti

  • When trying to open iphoto, it won't open.

    It says "Caution.  The iPhoto Library is locked, on a locked disk, or you do not have permission to make changes to it." I click ok, and then, it won't open.