Adding scrollpane to JEditorPane

I was trying my GUI to show a .gif file on a JEditorPane but when it does so, since the .gif file is big, it takes up the whole spaceon the GUI but messes up the components underneath it as well.
Then I tried using a scrollPane, but the scroll pane shows, but the bars that move don't appear, and the problem is still not sorted.
Any suggestions?

I was trying my GUI to show a .gif file on a
JEditorPane but when it does so, since the .gif file
is big, it takes up the whole spaceon the GUI but
messes up the components underneath it as well.
Then I tried using a scrollPane, but the scroll pane
shows, but the bars that move don't appear, and the
problem is still not sorted.
Any suggestions?Have you tried setting the scroll bar policies to always be on?
ResultScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
ResultScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
You may also want to try extending the JTextPane and overriding getScrollableTracksViewportWidth to always return false.
A last suggestion would be to put a JPanel in the scroll pane, set it to a border layout, and then put your text pane in there.
The last two suggestions also have the effect of turning line wrapping off, although the first has some problems when your text contains tabs.

Similar Messages

  • Adding ScrollPane to frame

    hi All
    I am facing a problem that i have some labels which are being dynamically generated by picking up data from serialized file. And i am adding and i am not getting scrollbars.
    I think that the main problem i am having is that i have specified position for the labels and lables are beyond the bounds of my panel. Is it just because of that.....
    Am using NULL layout.
    Help required urgently!!
    thanx in advance,
    harpreet

    Hello Harpreet,
    you need a JScrollPane class. Use the getViewport() method of it and add your component. You may also pass your component to the constructor of JScrollPane.
    Best regards,
    Martin

  • Adding ScrollPane to Table

    Hi all,
    I am Doing project in Java Swing. I need a help line for using scroll pane with table and textarea.
    final String[] colheads={"Book Name","Due Date"};
    final Object[][] data={{"",""},{"",""},{"",""},{"",""},{"",""},{"",""}};
    JTable table=new JTable(data,colheads);
    JScrollPane jsp=new JScrollPane(table);//,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    panel.add(jsp);
    getContentPane().add(panel);

    Well I can't really say without seeing any code, but try this
    package testing;
    import javax.swing.*;
    public class Test
      public static void main(String[] args)
        JFrame frame = new JFrame("Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        String[] data = {"Ankka", "Possu", "Sorsa", "Nakki"};
        JList list = new JList(data);
        JScrollPane scroller = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        frame.add(scroller);
        frame.pack();
        frame.setVisible(true);
    }#

  • Adding scrollpane to my major frame

    Hi All,
    this is my problem:
    i have a main frame ,this frame include internal frames.
    what i need is:
    when one of the internal frames extend the main frame size the scroll's will appear.
    i succed to do it sepratly for each internal frame but how can i do it to my major frame.
    Thanks

    1) add the JDesktopPane to a scroll pane.
    2) add the scroll pane to the content pane
    3) set the preferred size of the desktop pane. Scrollbars will appear/disappear as the Jframe is resized.

  • JEditorPane with text/html content-type still displaying as plain-text?

    Hello all,
    I recently started work on a very basic HTTP GET program that gets the HTML source of a page and, using a JEditorPane, displays the page as normal (i.e. like a browser would).
    Anywhoo, the HTTP GET is fine, and the source is loaded into a String called "html". Then I do this:
    displayArea.createEditorKitForContentType("text/html");
                        displayArea.setText(html);However the content appears in the editor pane as plain-text (i.e. the HTML code appears as-is, not in a 'compiled' form).
    Any ideas why this is?
    Thanks,
    Tristan

    Thanks for the replies, however the setContentType didn't work either. When I changed the code to what you suggested, nothing got inserted into the editor pane at all (i.e. no HTML - nor plain-text?). More of the code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.net.Socket;
    import java.util.Scanner;
    public class ClassName extends JFrame implements ActionListener
         public JTextField urlIn, pageIn;
         public JButton go;
         public JScrollPane scrollPane;
         public JEditorPane displayArea;
         public JPanel topPanel;
         public String url, page, html;
         public int index;
         public ClassName()
              setSize(1230,680);
              setLayout(new BorderLayout());
              JPanel topPanel = new JPanel();
              topPanel.setLayout(new FlowLayout());
              urlIn = new JTextField(18);
              pageIn = new JTextField(18);
              JButton go = new JButton("Go!");
              topPanel.add(urlIn);
              topPanel.add(pageIn);
              topPanel.add(go);
              add(topPanel, BorderLayout.NORTH);
              displayArea = new JEditorPane();
              displayArea.setEditable(false);
              add(displayArea, BorderLayout.CENTER);
              go.addActionListener(this);
              urlIn.addActionListener(this);
              setVisible(true);
         public static void main(String args[])
              new ClassName();
         public void actionPerformed(ActionEvent e)
              if( e.getActionCommand() == "Go!" )
                   url = urlIn.getText();
                   page = pageIn.getText();
                   if (url != null && page != null )
                        try
                             final int HTTP_PORT = 80;
                             Socket s = new Socket(url, HTTP_PORT);
                             InputStream inStream = s.getInputStream();
                             OutputStream outStream = s.getOutputStream();
                             Scanner in = new Scanner (inStream);
                             PrintWriter out = new PrintWriter(outStream);
                             out.print("GET " + page + " HTTP/1.0\n\n");
                             out.flush();
                             while( in.hasNextLine() )
                                  String input = in.nextLine();
                                  html = html + input;
                             s.close();
                        catch (Exception exception)
                             System.out.println("Error: " + exception);
                        displayArea.setContentType("text/html");
                        displayArea.setText(html);
                        urlIn.setText("");
                        pageIn.setText("");
                 else
                      System.out.println("Please enter something!");
    }Am baffled as to what the problem is? :-(
    Thanks,
    Tristan

  • JEditorPane crashing( Out of Memory )

    I'm trying to display an html document that is about 3MB, everytime I try it crashes, if I cut the size down to about 400KB it loads fine.
    Is there some kind of limit to the size of a file the editorpane can handle?
             // load the class the creates the file
             LeadGenerator lg = new LeadGenerator();
            // get the editorPane from the report creator class.
         JScrollPane scrollPane = lg.getReport();
         scrollPane.setBounds(0, 0, dim.width,dim.height);
         jDesktopPane.add(scrollPane);
      // code snippet from the report creator class
    public void LeadGenerator{
      // user picks a file name  "f"
      for( loop till the input file is done ){
         out.write("</BODY>"+"\r\n");
         out.write("</HTML>"+"\r\n");
         out.flush();
         out.close();
    // method that returns the report in a scroll pane.
    public JScrollPane getReport(){
              JScrollPane scrollPane = null;
              JEditorPane htmlWindow = new JEditorPane();
              htmlWindow.setEditable(false);
              try{
                   java.net.URL reportPage = new java.net.URL("File:///"+f.toString());
                   System.out.println(reportPage);
                   if (reportPage != null) {
                        try {
                             htmlWindow.setPage(reportPage);
                        } catch (java.io.IOException e) {
                             javax.swing.JOptionPane.showMessageDialog(null,
                                       e.getLocalizedMessage());
                             e.printStackTrace();
                   } else {
                        javax.swing.JOptionPane.showMessageDialog(null, "File not found ");
                   scrollPane = new JScrollPane(htmlWindow);
                   scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                   scrollPane.setViewportView(htmlWindow);
                   scrollPane.setVisible(true);
              }catch(MalformedURLException mfe){}
              return scrollPane;
         }

    Is there some kind of limit to the size of a file the
    editorpane can handle?I don't think so.

  • SetEnable of scrollPane

    i have added scrollpane to list and doing disable. list become diable but scroll bar is moving.
    what is the solution to stop moving of scroll bar when scrollpane is disable.

    thnks a lot
    this is working
    ScrollPane.getVerticalScrollBar().setEnabled(false);

  • Don't allow to press "Enter" in JEditorPane

    Hi,
    I need not to allow to press "Enter" key in JEditorPane. I added keylistener to JEditorPane.How to implement this?
    public void keyPressed(KeyEvent e){
    int code = e.getKeyCode();
    if(KeyEvent.getKeyText(code).equals("Enter")){
    //Don't allow to press
    Please provide me a suggestion.
    Regards
    Senthil

    I am only providing an alternative answer but perhaps could have been a little clearer with my reply.
    ***For the benefit of those who don't know***
    e.consume() will consume that keystroke and thereby also accomplish what he asked.
    A Document filter would be a better implementation if he wants to block the newline but Senthil was also not clear as to weather he wanted to block the keystroke or the newline.
    @db A simple "Welcome to the forums, but ......." may also have been a better answer from you.
    I am not trying to start a flame war, just would like to become part of the community and provide some assistance where I can.

  • Scroller wont scroll

    This might call for me to post the code, if so let me know and I will,I have an applet that I am trying to use a scroll panel and move the scroll bar when information is added to a JEditorPane contained in the scrollpane, the text shows but the scroll panel wont scroll to the position that I want it to when I run it in the applet but it will scroll when I run it in appletviewer? Any tricks to this or am I being to vague? Thanks in advance. Joe

    If I understand you correctly you want to see the last added text in the pane. If this is the case use the JTextComponent class's setCaretPosition() method to move the caret to a specific location. In your case retrieve the length of text in the pane and use that as a parameter to the method.

  • Design for mirroring keytyped events for a shared editor

    Hi there,
    Can anyone suggest a layout for an algorithm which will allow a shared editor to handle keytyped events and have that mirrored in the listening client?
    So far the received packets get added to a JEditorPane by a setText() call, but this is useless as it overwrites anything in the JEditorPane.. As every KeyTyped event is fired the packet gets sent to another client that needs to append them to the JEditorPane. But I also need to consider the Caret position, deleted text, tab and space (everything under the sun that could happen when someone is editing text in the JEditorPane).
    Has anyone got any suggestions as to how to correctly tackle this problem..
    Thanks : -)
    Adrian

    It may be possible but I still wouldn't do it that way. Mainly because key events aren't sufficient to synchronize two documents. It's possible to change a document without a keyevent occurring -- for example if you press Ctrl-V on many computers, it will paste the contents of the clipboard into the document. I don't know if you get a key event in this case, but even if you do it doesn't tell you enough to synchronize the remote document properly.

  • Open in external browser?

    Hi folks, basically I have a HTML file being added to a JEditorPane, all working fine. When you click one of the hyperlinks in the file it opens the website in the java application! i.e. it updates the editorPane with the website.
    Question: How can I code so it opens in the system's default browser. The code (or help given) needs to be platform independent. Here is my code:
        public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          try {
            editorPane.setPage(e.getURL());
          } catch(IOException ioe) {
        }Cheers!

    This question may be a long shot...
    I installed java 1.6 on my system (the preview apple release) and get the following error:
    Invalid memory access of location 84130040 rip=811d8b7a
    # An unexpected Java error has been detected by HotSpot Virtual Machine.
    # If this error is reproducible, please report it with the following information:
    # 1. Provide the steps to reproduce, a test case, and any relevant information
    # 2. The corresponding JavaNativeCrash_pid<num>.crash.log (Java state)
    # 3. The corresponding <name>.crash.log (native state; generated by CrashReporter)
    # 4. This data:
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.6.0_04-b12-45-optimized mixed mode)
    # An unexpected error has been detected by Java Runtime Environment:
    # Bus Error (0xa) at pc=0x00007fff811d8b7a#
    # Bus Error (0xa) at pc=0x00007fff811d8b7a, pid=381, tid=4300226560
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.6.0_04-b12-45-optimized mixed mode macosx-amd64)
    # An error report file with more information is saved as:
    # /Users/matthewgreen/Library/Logs/Java/JavaNativeCrash_pid381.crash.log
    # File report at: http://bugreport.apple.com/
    Java Result: 138
    BUILD SUCCESSFUL (total time: 5 seconds)
    Any idea what could be wrong? Could it just be because its the preview release?
    Cheers

  • Icons to tree?

    root
    |_root1
    | |_root11
    | |_root111
    |_root2
    Like this my tree stucture is there.
    for root1, root2 same icon
    for root11 different icon
    for root111 different icon.
    How to set icons to this structure.
    i think it was not sutiable in my case
    ImageIcon leafIcon = createImageIcon("images/btn1.gif");
              ImageIcon parentIcon = createImageIcon("images/bullet.gif");
            if (leafIcon != null) {
                DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
                renderer.setLeafIcon(leafIcon);
                   renderer.setClosedIcon(parentIcon);
                m_tree.setCellRenderer(renderer);
            } else {
                System.err.println("Leaf icon missing; using default.");
    protected static ImageIcon createImageIcon(String path) {
            java.net.URL imgURL = ConstructTree.class.getResource(path);
            if (imgURL != null) {
                return new ImageIcon(imgURL);
            } else {
                System.err.println("Couldn't find file: " + path);
                return null;
        }thanks in advance
    hc827

    Hi, PhHein,
    i didnt get u, iam new to java, how to set icon to this code.
    import java.awt.Container;
    import java.awt.Font;
    import javax.swing.JApplet;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTabbedPane;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeModel;
    public class Console extends JApplet {
         public void init() {
              setSize(800, 600);
              consoleframe();
         }// init
         public void consoleframe() {
              Container container = getContentPane();
              JTabbedPane jtp = new JTabbedPane();
              jtp.setFont(new Font("Lucida Grande", Font.BOLD, 12));
              // adding panels to the tabbedpane
              jtp.addTab("console", new ConstructTree());
              container.add(jtp);
              JScrollPane scrollPane = new JScrollPane(jtp);
              container.add(scrollPane);
              scrollPane.getViewport().add(jtp);
              setSize(805, 600);
         }// consoleframe
    /** Creating tree based on user */
    class ConstructTree extends JPanel {
         // Global Variables declaration
         /** constuctor to the ConstructTree class */
         public ConstructTree() {
              setLayout(null);
              try {
    DefaultMutableTreeNode Main_root = new DefaultMutableTreeNode("console");
    //for node1
    Main_root = addRoots(Main_root);
    //for node2
    Main_root = addRoot1(Main_root);
         DefaultTreeModel treeModel = new DefaultTreeModel(Main_root);
         JTree m_tree = new JTree(treeModel);
                   m_tree.setEditable(false);
                   /** adding scrollpane to the tree */
                   JScrollPane pane = new JScrollPane(m_tree);
                   add(pane);
                   pane.setBounds(30, 20, 203, 403);
                   pane.setVisible(true);
                   m_tree.setBounds(30, 20, 200, 400);
              }// try
              catch (Exception ee) {
                   ee.printStackTrace();
              }// catch
         public DefaultMutableTreeNode addRoots(DefaultMutableTreeNode main_root) {
              String str[] = { "sample1", "sample2", "sample3", "sample4" };
              DefaultMutableTreeNode Node1[] = new DefaultMutableTreeNode[str.length];
              for (int i = 0; i < str.length; i++) {
                   Node1[i] = new DefaultMutableTreeNode(str);
                   main_root.add(Node1[i]);
              return main_root;
    public DefaultMutableTreeNode addRoot1(DefaultMutableTreeNode main_root) {
              DefaultMutableTreeNode node2 = new DefaultMutableTreeNode();
              for (int i = 0; i < main_root.getChildCount(); i++) {
                   node2 = (DefaultMutableTreeNode) main_root.getChildAt(i);
                   String sample = (String) node2.getUserObject();
                   if (sample == "sample1") {
                        node21 = addnode(node21);
              main_root.insert(node21, i);
              return main_root;
    public DefaultMutableTreeNode addnode(DefaultMutableTreeNode node21) {
              String str[] = { "sample11", "sample12", "sample13", "sample14" };
              DefaultMutableTreeNode Node2[] = new DefaultMutableTreeNode[str.length];
              for (int j = 0; j < str.length; j++) {
                   Node2[j] = new DefaultMutableTreeNode(str[j]);
                   node21.add(Node2[j]);
              }// inner for
              return node21;
    }// ConstructTree class
    thanks in advance
    hc827

  • ElementChange interface and accessing those methods..

    Hi all, I'm stuck on accessing the three methods contained in ElementChange (below). This interface class is supposed to be an inner class interface of DocumentEvent, if that helps? This is more a java question about the API (which is not so documented in this area of ElementChange. If someone can lead me down the right path, it would be fantastic!! Thanks so much! Sorry I'm not able to provide my attempts with ElementChange, as I'm so lost at how I can access it.. :(
    Element[] getChildrenAdded();
    Element[] getChildrenRemoved();
    Element[] getElement();So far I have my DocumentListener ( which is added to my JEditorPane - separate class)
    public class Changes implements DocumentListener {
        public Changes() {
        //----------------------Inferface Methods Start-----------------------//
        //Method from DocumentListener
        public void changedUpdate( DocumentEvent e ) {
            pushEditInfo( e );
        //Method from DocumentListener
        public void insertUpdate( DocumentEvent e ) {
            pushEditInfo( e );
        //Method from DocumentListener
        public void removeUpdate( DocumentEvent e ) {
            pushEditInfo( e );
        //----------------------Inferface Methods Finish-----------------------//
        //Method to handle DocumentEvents
        private void pushEditInfo( DocumentEvent e ) {
                Document doc = ( Document )e.getDocument();
                Element elem = doc.getDefaultRootElement();
                //get hold of element change - need this for elementchange class' methods
                e.getChange( elem );
    }

    Mistake: methods are:
    Element[] getChildrenAdded();
    Element[] getChildrenRemoved();
    Element getElement();

  • Problem adding a table to scrollpane

    Hi:
    I have created a JTable that I want to be in a scrollpane. When I tried to add this JTable to a scrollpane I get a null pointer error at execution time. But when I add this table directly to the frame I get no error at execution time.
    Here is my code:
    import java.awt.*;
    import java.awt.event .*;
    import javax.swing.*;
    import java.util.*;
    import javax.swing.event.*;
    import java.io.*;
    import javax.swing.table.*;
    import javax.swing.BorderFactory;
    import javax.swing.border.Border;
    import java.net.*;
    import java.util.regex.*;
    // METHODS
    // =======
    // private String returnSelectedString( int col ))
    public class DialogFrame extends JFrame
    {     //===================
    //MEMBER VARIABLES
    //===================
    public JLabel topClassifiedLabel, bottomClassifiedLabel,printerCountLabel,defaultPrinterLabel ;
    public JPanel panelForLabel,topClassificationPanel , bottomClassificationPanel, SecBotPanel, ClassificationPanel,Classification_botPanel,firstTopPanel, titlePanel,titlePanel2,displayPanel,labelPanel,buttonPanel;
    public DefaultListModel listModel;
    public final String screenTitle = "Printer Configuration "
    + " CSS - 105";
    public JLabel localDisplay = new JLabel("Local: Printer directly connected to this computer");
    public JLabel remoteDisplay = new JLabel("Remote: Printer connected to another computer");
    public JLabel networkDisplay = new JLabel("Network: Printer connected to the LAN");
    public char hotKeys[] = { 'A', 'D', 'Q','T','R','I','Q','H' };
    public JPanel ConnectTypePanel = null, printCountPanel;
    public JScrollPane tabScrollPane;
    public JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,TitleLabel;
    public JButton addPrinterButton,setDefaultButton,restartPrintSystemButton, deletePrinterButton, displayQueueButton,
    ToggleBannerButton, RestartPrintSystemButton, InstallOpenPrintButton, QuitButton, continueButton,CancelButton,HelpButton;
    public Vector columnNames;
    public String line2 = "";
    public addPrinterDialog aPDialog;
    public printQueueDialog dQDialog;
    public String nextElement,name,Type,Interface,Description,Status,Queue,BannerPage;
    public JRadioButton networkButton, localButton, remoteButton;
    public JLabel nameLabel, descriptionLabel, modelLabel,ClassificationLabel,ClassificationLabel_bot,setL,defaultL;
    public JTextField nameTextField, descriptionTextField, modelTextField;
    private int printerCount = 0;
    static DefaultTableModel model;
    public JTable table;
    //=======================//
    //**Constructor
    //=========================//
    public DialogFrame()
    createTable();
    public void createTable()
    defaultPrinterLabel = new JLabel();
    printerCountLabel = new JLabel();
    //COLUMN FOR TABLE
    columnNames = new Vector();
    columnNames.add("Name");
    columnNames.add("Type");
    columnNames.add("Interface");
    columnNames.add("Description");
    columnNames.add("Status");
    columnNames.add("Queue");
    columnNames.add("BannerPage");
    Vector tableRow = new Vector();
    //tableRow = executeScript("perl garb.pl");
    // tableRow = executeScript("perl c:\\textx.pl");
    model = new DefaultTableModel( tableRow, columnNames ){
    public boolean isCellEditable(int row,int col) {
    return false;
    public Dimension getPreferredScrollableViewportSize() {
    return getPreferredSize();
    table = new JTable(model);
    JTableHeader header = table.getTableHeader();
    TableColumnModel colmod = table.getColumnModel();
    for (int i=0; i < table.getColumnCount(); i++)
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setHorizontalAlignment(SwingConstants.CENTER);
    colmod.getColumn(i).setCellRenderer(renderer);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setShowGrid( false );
    table.getTableHeader().setReorderingAllowed( false );
    table.setIntercellSpacing(new Dimension(0,0) );
    table.addMouseListener( new MouseAdapter () {
    public void mouseClicked( MouseEvent e) {
    if ((e.getModifiers() & InputEvent.BUTTON1_MASK) !=0)
    printSelectCell(table);
    this.setSize(900,900);
    //========================================//
    // Technique for centering a frame on the screen
    //===========================================//
    Dimension frameSize = this.getSize();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation((screenSize.width - frameSize.width)/2,
    (screenSize.height - frameSize.height)/2);
    setResizable(false);
    // CREATE A FEW PANELS
    firstTopPanel = new JPanel();
    BoxLayout box = new BoxLayout(firstTopPanel, BoxLayout.Y_AXIS);
    firstTopPanel.setLayout(box);
    topClassificationPanel = new JPanel();
    topClassificationPanel.setBackground(new Color(45,145,71));
    bottomClassificationPanel = new JPanel();
    bottomClassificationPanel.setBackground(new Color(45,145,71));
    SecBotPanel = new JPanel();
    SecBotPanel.setLayout(new BorderLayout());
    buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(1,8));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
    buttonPanel.setBackground(new Color(170,187,119));
    panelForLabel = new JPanel();
    // panelForLabel.setBackground( Color.white );
    //Border etchedBorder = BorderFactory.createEtchedBorder();
    printerCountLabel.setHorizontalAlignment(SwingConstants.LEFT);
    printerCountLabel.setPreferredSize(new Dimension(700, 20));
    //printerCountLabel.setBorder(etchedBorder);
    printerCountLabel.setForeground(Color.black);
    defaultPrinterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    defaultPrinterLabel.setText("Default Printer: " + name);
    defaultPrinterLabel.setForeground(Color.black);
    panelForLabel.add(printerCountLabel);
    panelForLabel.add(defaultPrinterLabel);
    titlePanel = new JPanel( );
    titlePanel.setBackground( Color.white );
    ConnectTypePanel = new JPanel();
    ConnectTypePanel.setBackground(new Color(219,223,224));
    ConnectTypePanel.setLayout( new GridLayout(3,1) );
    //CREATE A FEW LABELS
    topClassifiedLabel = new JLabel("UNCLASSIFIED", SwingConstants.CENTER );
    topClassifiedLabel.setForeground(Color.white);
    bottomClassifiedLabel = new JLabel("UNCLASSIFIED", SwingConstants.CENTER );
    bottomClassifiedLabel.setForeground(Color.white);
    TitleLabel = new JLabel( screenTitle, SwingConstants.CENTER );
    //ADD LABELS TO PANELS
    topClassificationPanel.add( topClassifiedLabel );
    bottomClassificationPanel.add( bottomClassifiedLabel );
    titlePanel.add( TitleLabel, BorderLayout.CENTER );
    ConnectTypePanel.add(localDisplay );
    ConnectTypePanel.add(remoteDisplay );
    ConnectTypePanel.add(networkDisplay );
    //Create the scrollpane and add the table to it.
    tabScrollPane = new JScrollPane(table);
    JPanel ps = new JPanel();
    ps.add(tabScrollPane);
    getContentPane().setLayout(
    new BoxLayout( getContentPane(), BoxLayout.Y_AXIS ) );
    getContentPane().add(firstTopPanel);
    getContentPane().add(panelForLabel);
    getContentPane().add(header);
    getContentPane().add(ps);//contain table
    getContentPane().add(SecBotPanel);
    WindowListener w = new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    DialogFrame.this.dispose();
    System.exit(0);
    this.addWindowListener(w);
    //==================================//
    // AddPrinterButton
    //==================================//
    addPrinterButton = new JButton();
    addPrinterButton.setLayout(new GridLayout(2, 1));
    l1 = new JLabel("Add", JLabel.CENTER);
    l1.setForeground(Color.black);
    l2 = new JLabel("Printer", JLabel.CENTER);
    l2.setForeground(Color.black);
    addPrinterButton.add(l1);
    addPrinterButton.add(l2);
    addPrinterButton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent event)
    //(aPDialog == null) // first time
    aPDialog = new addPrinterDialog(DialogFrame.this);
    aPDialog.setLocationRelativeTo(null);
    aPDialog.pack();
    aPDialog.show(); // pop up dialog
    //======================================
    // DeletePrinterButton
    //=====================================
    deletePrinterButton = new JButton();
    deletePrinterButton.setLayout(new GridLayout(2, 1));
    l1 = new JLabel("Delete", JLabel.CENTER);
    l1.setForeground(Color.black);
    l2 = new JLabel("Printer", JLabel.CENTER);
    l2.setForeground(Color.black);
    deletePrinterButton.add(l1);
    deletePrinterButton.add(l2);
    deletePrinterButton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent event)
    int sr = table.getSelectedRow();
    if (sr == -1)
    JOptionPane.showMessageDialog(null, "You have not selected a printer for this operation","NOSELECT",JOptionPane.INFORMATION_MESSAGE);
    else
    name = returnSelectedString(0);
    int ans = JOptionPane.showConfirmDialog(null,"Are you sure you want to delete printer " + name + "?","Delete",JOptionPane.YES_NO_OPTION);
    switch(ans) {
    case JOptionPane.NO_OPTION:
    return;
    case JOptionPane.YES_OPTION:
    // String machineName = returnSelectedString(0);
    int rowNumber = table.getSelectedRow();
    model.removeRow(rowNumber);
    //TiCutil.exe("/usr/lib/lpadmin -x " + machineName);
    decreasePrinterCount();
    JOptionPane.showMessageDialog(null, "Printer " + name + " have been successfully deleted","SUCCEED",JOptionPane.INFORMATION_MESSAGE);
    return;
    //==============================//
    //DisplayQueuePrinter //
    //================================//
    displayQueueButton = new JButton();
    displayQueueButton.setLayout(new GridLayout(2, 1));
    l5 = new JLabel("Display", JLabel.CENTER);
    l5.setForeground(Color.black);
    l6 = new JLabel("Queue", JLabel.CENTER);
    l6.setForeground(Color.black);
    displayQueueButton.add(l5);
    displayQueueButton.add(l6);
    displayQueueButton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent event)
    Vector tab = new Vector();
    int sr = table.getSelectedRow();
    if (sr == -1)
    JOptionPane.showMessageDialog(null, "You have not selected a printer for this" +
    "operation","NOSELECT",JOptionPane.INFORMATION_MESSAGE);
    else
    name = returnSelectedString(0);
    //PASS TABLE HERE
    /*tab = executeScript("lpstat -o " + name + " | sed \'s/ on$//\'");
    System.out.println("lpstat -o " + name + " | sed \'s/ on$//\'");
    dQDialog = new printQueueDialog(DialogFrame.this, name, tab);
    dQDialog.setLocationRelativeTo(null);
    dQDialog.pack();
    dQDialog.show(); // pop up dialog */
    //===================================
    // SetDefaultButton
    //================================//
    setDefaultButton = new JButton();
    setDefaultButton.setLayout(new GridLayout(2, 1));
    setL = new JLabel("Set", JLabel.CENTER);
    setL.setForeground(Color.black);
    defaultL = new JLabel("Default", JLabel.CENTER);
    defaultL.setForeground(Color.black);
    setDefaultButton.add(setL);
    setDefaultButton.add(defaultL);
    setDefaultButton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent event)
    int sr = table.getSelectedRow();
    if (sr == -1)
    JOptionPane.showMessageDialog(null, "You have not selected a printer for this operation","NOSELECT",JOptionPane.INFORMATION_MESSAGE);
    else
    name = returnSelectedString(0);
    JOptionPane.showMessageDialog(null, "printer " + name + " is now the default.","Succeed",JOptionPane.INFORMATION_MESSAGE);
    defaultPrinterLabel.setText("Default Printer: " + name);
    //==============================//
    // ToggleBannerButton
    //==============================//
    ToggleBannerButton = new JButton();
    ToggleBannerButton.setLayout(new GridLayout(2, 1));
    l7 = new JLabel("Toggle", JLabel.CENTER);
    l7.setForeground(Color.black);
    l8 = new JLabel("Banner", JLabel.CENTER);
    l8.setForeground(Color.black);
    ToggleBannerButton.add(l7);
    ToggleBannerButton.add(l8);
    ToggleBannerButton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent event)
    int sr = table.getSelectedRow();
    System.out.println("sr :" + sr);
    if (sr == -1)
    JOptionPane.showMessageDialog(null, "You have not selected a printer for this operation","NOSELECT",JOptionPane.INFORMATION_MESSAGE);
    else
    String banner = returnSelectedString(6);
    name = returnSelectedString(0);
    String machineName = returnSelectedString(0);
    Type = returnSelectedString(1);
    if ( !(Type.equals("Remote")) )
    if( banner.equals("Yes") )
    JOptionPane.showMessageDialog(null,"Banner page will NOT be printed for printer "+ name ,"Succeed",JOptionPane.INFORMATION_MESSAGE);
    //TiCutil.exe("sed -e 's/^BANNER=\"yes\"/BANNER=\"\"/' /etc/lp/interfaces/" + machineName + " > /tmp/delete.txt" );
    //TiCutil.exe("mv /tmp/delete.txt /etc/lp/interfaces/" + machineName);
    table.setValueAt("No",sr,6);
    DefaultTableModel model = (DefaultTableModel)table.getModel();
    model.fireTableCellUpdated(sr,6);
    table.requestFocus();
    else
    JOptionPane.showMessageDialog(null,"Banner page WILL be printed for printer "+ name ,"Succeed",JOptionPane.INFORMATION_MESSAGE);
    //TiCutil.exe("sed -e 's/^BANNER=\"\"/BANNER=\"yes\"/' /etc/lp/interfaces/" + machineName + " > /tmp/delete.txt");
    //TiCutil.exe("mv /tmp/delete.txt /etc/lp/interfaces/" + machineName);
    table.setValueAt("Yes",sr,6);
    DefaultTableModel model = (DefaultTableModel)table.getModel();
    model.fireTableCellUpdated(sr,6);
    table.requestFocus();
    else
    JOptionPane.showMessageDialog(null,"Operation failed system respond \n" + "was:\n" + "cannot toggle the banner page for a\n" + "REMOTE printer." ,"OPFAIL",JOptionPane.INFORMATION_MESSAGE);
    //==================================//
    // RestartPrintSystemButton
    //==================================//
    restartPrintSystemButton = new JButton();
    restartPrintSystemButton.setLayout(new GridLayout(2, 1));
    l3 = new JLabel("Restart Print", JLabel.CENTER);
    l3.setForeground(Color.black);
    l4 = new JLabel("System", JLabel.CENTER);
    l4.setForeground(Color.black);
    restartPrintSystemButton.add(l3);
    restartPrintSystemButton.add(l4);
    restartPrintSystemButton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent event)
    //==============================
    // InstallOpenPrint
    //================================
    InstallOpenPrintButton = new JButton();
    InstallOpenPrintButton.setLayout(new GridLayout(2, 1));
    l11 = new JLabel("Install Open", JLabel.CENTER);
    l11.setForeground(Color.black);
    l12 = new JLabel("Print", JLabel.CENTER);
    l12.setForeground(Color.black);
    InstallOpenPrintButton.add(l11);
    InstallOpenPrintButton.add(l12);
    InstallOpenPrintButton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent event)
    int ans = JOptionPane.showConfirmDialog(null,"Are you sure you want to install OPENPrint?","Delete",JOptionPane.YES_NO_OPTION);
    switch(ans) {
    case JOptionPane.NO_OPTION:
    return;
    case JOptionPane.YES_OPTION:
    int cd,opinstall,banner_var,pwd;
    opinstall = runIt("open_print.ksh");
    banner_var = runIt("banner_var.ksh");
    System.out.println("opinstall: " + opinstall );
    System.out.println("banner_var: " + banner_var);
    if ( opinstall == 0 && banner_var == 0)
    JOptionPane.showMessageDialog(null, "OPENprint successfully added"
    ,"SUCCEED",JOptionPane.INFORMATION_MESSAGE);
    return;
    //==========================
    //QuitButton
    //============================
    QuitButton = new JButton("Quit");
    QuitButton.addActionListener (new ActionListener ()
    { public void actionPerformed (ActionEvent e){
    System.exit (0); }
    HelpButton = new JButton("Help");
    //ADD BUTTONS TO PANEL
    buttonPanel.add( addPrinterButton );
    buttonPanel.add( deletePrinterButton );
    buttonPanel.add( displayQueueButton );
    buttonPanel.add( setDefaultButton);
    buttonPanel.add( ToggleBannerButton );
    buttonPanel.add( restartPrintSystemButton );
    buttonPanel.add( InstallOpenPrintButton );
    buttonPanel.add( QuitButton );
    //buttonPanel.add( HelpButton );
    //END OF BUTTONS CREATION
    //ADD PANEL ON TO PANEL
    SecBotPanel.add(ConnectTypePanel, BorderLayout.CENTER);
    SecBotPanel.add(bottomClassificationPanel, BorderLayout.SOUTH);
    firstTopPanel.add(topClassificationPanel);
    firstTopPanel.add(titlePanel);
    firstTopPanel.add(buttonPanel);
    //===========================================================
    // METHODS
    //==========================================================
    public int runIt(String targetCode)
    int result = -1;
    try{
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec( targetCode );
    // Thread.sleep(20000);
    p.waitFor();
    result = p.exitValue();
    catch( IOException ioe )
    ioe.printStackTrace();
    catch( InterruptedException ie )
    ie.printStackTrace();
    return result;
    //====================================================
    public void increasePrinterCount()
    printerCount++;
    printerCountLabel.setText("Printer: " + printerCount);
    //===========================================================
    public void decreasePrinterCount()
    printerCount--;
    printerCountLabel.setText("Printer: " + printerCount);
    private String returnSelectedString( int col )
    int row = table.getSelectedRow();
    String word;
    //javax.swing.table.TableModel model = table.getModel();
    word =(String)model.getValueAt(row, col);
    return word; //return string
    //==============================================================================
    private Vector executeScript(String str)
    Vector tableOfVectors = new Vector();
    try{          
    String line;
    Process ls_proc = Runtime.getRuntime().exec(str);
    //get its output (your input) stream
    BufferedReader in = new BufferedReader( new InputStreamReader( ls_proc.getInputStream() ));
    //readLine reads in one line of text
    int k = 1, i = 0;
    //LOOK FOR THE "|"
    Pattern p = Pattern.compile(" ");
    while (( line = in.readLine()) != null)
    Vector data = new Vector();
    Matcher m = p.matcher(line);
    if(m.find() == true)//find " "
    line = line.replaceAll(" {2,}?", "|");
    //creates a new vector for each new line read in
    StringTokenizer t = new StringTokenizer(line,"|");
    while ( t.hasMoreTokens() )
    try
    nextElement = t.nextToken().trim();
    //add a string to a vector
    data.add(nextElement.trim());
    catch(java.util.NoSuchElementException nsx)
    System.out.println(nsx);
    tableOfVectors.add(data);
    //COUNT THE NUMBER OF PRINTER
    printerCount = k;
    printerCountLabel.setText("Printer: " + printerCount);
    k++;
    }//END OF WHILE
    in.close();
    }//END OF TRY
    catch (IOException e1) {
    System.err.println(e1);
    System.exit(1);
    return tableOfVectors;
    //==========================================================================================================
    private String getDefaultPrinter(String str)
    String groupStr = null;
    try{          
    String lin;
    Process ls_proc = Runtime.getRuntime().exec(str);
    BufferedReader in = new BufferedReader( new InputStreamReader( ls_proc.getInputStream() ));
    Pattern p2 = Pattern.compile("system default destination: (\\S+)");
    while (( lin = in.readLine()) != null)
    Matcher m2 = p2.matcher(lin);
    m2.reset(lin);
    if (m2.find() == true )
    groupStr = m2.group(1);
    in.close();
    catch (IOException e1) {
    System.err.println(e1);
    System.exit(1);
    return groupStr;
    //================================================================================
    public synchronized void clearTable()
    int numrows = model.getRowCount();
    for ( int i = numrows -1 ; i >= 0 ; i--)
    model.removeRow(i);
    //=======================================================================================================
    private void printSelectCell(JTable table )
    int numCols = table.getColumnCount();
    int row = table.getSelectedRow();
    System.out.println(row);
    javax.swing.table.TableModel model = table.getModel();
    for(int j=0;j < numCols; j++)
    System.out.println(" " + model.getValueAt(row,j));
    System.out.println();
    System.out.println("-----------------------------------------------");
    //CREATE ADD PRINTER DIALOG
    class addPrinterDialog extends JDialog
    public addPrinterDialog(JFrame owner)
    super(owner, "ap1", true);
    final ButtonGroup rbg = new ButtonGroup();
    JPane

    Ok  I have the table  on the page  I created a css with a background image called .search  How to I link that to the table so It shows the image
    I am only used to doing certain css items   Never didi this before
    THXS STeve

  • Adding a progress loader to a dynamic text field / scrollPane

    I have a dynamic text field which is loading images from an external html.  This text is named scrollPaneImage and is a child of a movieClip called scrollPaneContent.  I then load scrollPaneContent into a scroll pane named scrollPane
    When the user interacts with my swf different images are loaded into scrollPaneImage.  Since some of the images take a few seconds to load, I'd like there to be a progress loader displayed in the scrollpane.
    I have tried adding the progress event listner to the dynamic text, the movie clip and the scrollpane and cannot get it to respond or track the loading.
    scrollPaneContent.addEventListener(ProgressEvent.PROGRESS,reportProgress);
    function reportProgress(e:ProgressEvent):void {
        trace(e.bytesLoaded + " loaded out of " + e.bytesTotal);
         trace("LOADED");
    Can anyone suggest what I might be doing wrong or of another approach?
    thanks in advance,
    Josh

    Hi KGLAD.  Thanks for the response.  Yes my code is a little messy.  Here I have included everything and tried to do a little cleaning.  Is there enough code here for you to get an idea of how/when things are firing?
    import com.google.maps.LatLng;
    import com.google.maps.Map;
    import com.google.maps.MapEvent;
    import com.google.maps.MapType;
    import com.distriqt.gmaps.kml.utils.*;
    import com.greensock.*;
    import com.greensock.easing.*;
    import com.greensock.TweenLite;
    import flash.geom.Point;
    import com.greensock.plugins.*;
    TweenPlugin.activate([AutoAlphaPlugin]);
    import com.google.maps.controls.NavigationControl;
    import com.google.maps.controls.MapTypeControl;
    import com.google.maps.controls.OverviewMapControl;
    import com.google.maps.overlays.GroundOverlay;
    import com.google.maps.overlays.GroundOverlayOptions;
    import com.google.maps.LatLng;
    import com.google.maps.LatLngBounds;
    import com.google.maps.MapMouseEvent;
    import com.google.maps.controls.*;
    import com.google.maps.overlays.Marker;
    import com.google.maps.InfoWindowOptions;
    import com.google.maps.overlays.MarkerOptions;
    import com.anttikupila.utils.JPGSizeExtractor;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.net.URLLoader;
    import fl.controls.UIScrollBar;
    import flash.events.Event;
    import fl.events.ScrollEvent;
    import flash.sampler.NewObjectSample;
    [Embed(source="ICONS/PHOTO_BLACK.png")]var photoIcon:Class;
    [Embed(source="ICONS/BLOG_BLACK.png")]var blogIcon:Class;
    scrollPane
    // GMAP PARAMETERS
    var map:Map = new Map();
    map.key = "map key";
    //map.key = "api key";
    //define the size of the map extent....
    map.sensor = "false";
    map.setSize(new Point(stage.stageWidth, stage.stageHeight));
    map.addEventListener(MapEvent.MAP_READY, onMapReady);
    map.addEventListener(MapEvent.MAP_READY, createmarkers);
    map.addEventListener(MapEvent.MAP_READY, createMarkerArrays);
    map.addEventListener(MapEvent.MAP_READY, createPhotoPingers);
    this.addChild(map);
    map.setSize(new Point(stage.stageWidth, stage.stageHeight));
    //on map ready params
    function onMapReady(event:Event):void
    map.setCenter(new LatLng(48,-113.5), 8, MapType.PHYSICAL_MAP_TYPE);
    map.enableScrollWheelZoom();
    map.disableContinuousZoom();
    //Marker options for a photo piece
    var photoMarkerOptions:MarkerOptions = new MarkerOptions();
    photoMarkerOptions.icon = new photoIcon();
    photoMarkerOptions.hasShadow=false;
    //Marker options for a blog piece
    var blogMarkerOptions:MarkerOptions = new MarkerOptions();
    blogMarkerOptions.icon = new photoIcon();
    blogMarkerOptions.hasShadow=false;
    //load xml tester
    var pntloader:URLLoader = new URLLoader();
    var pntxml:XML = new XML();
    pntloader.addEventListener(Event.COMPLETE, loadpntXML);
    pntloader.load(new URLRequest("map_feed.xml"));
    // create an array of jpgs to index
    var JPGIndexArray:Array = new Array();
    //Create array that will be populated with points
    var pointsArray:Array = new Array();
    //Load the XML
    function loadpntXML(e:Event):void {
        pntxml=new XML(e.target.data);
        pntxml.ignoreWhite = true;
         for (var i:int = 0; i< pntxml.row.length(); i++){
         pointsArray[i]="mrk"+i;
         JPGIndexArray[i]="JPG"+i;
         //trace(pntxml);
    //Create the markers and add them to the map
    function createmarkers(event:Event):void
         for (var i:Number = 0; i < pntxml.row.length(); i++) {
         var markerOptions:MarkerOptions = new MarkerOptions();
          if (pntxml.row[i].TYPE=="PHOTO")
               markerOptions.icon = new photoIcon();
               markerOptions.tooltip = "Photo";
               markerOptions.hasShadow=false;
          else if(pntxml.row[i].TYPE=="BLOG")
               markerOptions.icon = new blogIcon();
               markerOptions.tooltip = "Blog Entry";
               markerOptions.hasShadow=false;
          else
               null     
          pointsArray[i] = new Marker(new LatLng(pntxml.row[i].LAT,pntxml.row[i].LONG),markerOptions);
         markerA.push(pointsArray[i]);
          map.addOverlay(pointsArray[i]);
          pointsArray[i].addEventListener(MapMouseEvent.CLICK,indexCalledMarkerRecord);
          pointsArray[i].addEventListener(MapMouseEvent.CLICK,scrollPanePopulate);
    // PING PHOTO DIMENSIONS BEFORE LOADING //
    var je : JPGSizeExtractor = new JPGSizeExtractor( );
    je.addEventListener( JPGSizeExtractor.PARSE_COMPLETE, jeLoadHandler );
    je.addEventListener( JPGSizeExtractor.PARSE_FAILED, jeParseFailed );
    function createPhotoPingers(event:Event):void{
         for (var k:Number=0; k <pntxml.row.length(); k++){
         JPGIndexArray[k]=new JPGSizeExtractor();
         JPGIndexArray[k].debug = false;
         JPGIndexArray[k].addEventListener(JPGSizeExtractor.PARSE_COMPLETE, jeLoadHandler );
         trace("madeit");
         pingPhotoUrls();
    function pingPhotoUrls():void
         for (var i:Number = 0; i < pntxml.row.length(); i++) {     
          var calledMarkerUrl=pntxml.row[i].URL_OF_CONTENT;
          JPGIndexArray[i].extractSize(calledMarkerUrl);     
    var JPG1=null;
    function jeLoadHandler(e:Event) : void {
         trace(e.currentTarget.width + "x" + e.currentTarget.height );
         imageWidths.push(e.currentTarget.width);
    function jeParseFailed( event : Event ) : void {
         trace( "Parse failed" );
    var imageWidths = new Array;
    // FUNCTIONS FOR INDEXING CALLED MARKERS//
    //Create blank array for use in indexing
    var markerA:Array=[];
    //VAR FOR USE IN INDEXING CALLED MARKER
    var pointindex=null;
    //INDEX CALLED MARKER POINT XML RECORD
    function indexCalledMarkerRecord(e:MapMouseEvent):void{
         pointindex=genIndexPos(markerA,Marker(e.currentTarget));
         //trace(pntxml.row[pointindex].DESC);
    //FUNCTION FOR INDEXING CALLED MARKER
    function genIndexPos(a:Array,e:Marker):uint{
         for(var i:uint=0;i<a.length;i++){
              if(a[i]==e){
                   return i;               
                   return null;
    //           SCROLLPANE FUNCTIONS              //
    this.addChild(scrollPane);
    scrollPane.setSize(255,300);
    scrollPane.x=-200;
    scrollPane.y=-200;
    scrollPane.alpha=0;
    scrollPaneContent.mouseEnabled=false;
    spHeader.closeBox.addEventListener(MouseEvent.CLICK, function(eMouseEvent):void
                                                                TweenLite.to(scrollPane, .5,{autoAlpha:0,overwrite:true});                                                            
    spHeader.forDrag.addEventListener(MouseEvent.MOUSE_DOWN, function (e:MouseEvent):void
              scrollPane.startDrag();          
    spHeader.forDrag.addEventListener(MouseEvent.MOUSE_UP, function (e:MouseEvent):void
              scrollPane.stopDrag();
    spHeader.forDrag.buttonMode=true;
    spHeader.forDrag.useHandCursor=true;
    spHeader.width=300;
    scrollPane.source = scrollPaneContent;
    scrollPaneContent.scrollPaneText.autoSize='left';
    scrollPaneContent.scrollPaneImage.autoSize='center';
    scrollPaneContent.scrollPaneImage.autoSize=TextFieldAutoSize.CENTER;
    scrollPaneContent.mouseEnabled=false;
    scrollPaneContent.scrollPaneText.condenseWhite = true;
    // Add listener.
    scrollPane.addEventListener(Event.COMPLETE, completeListener);
    scrollPaneContent.addEventListener(ProgressEvent.PROGRESS,reportProgress);
    function completeListener(event:Event):void {
    trace('Scrollpane content loaded');
    function reportProgress(e:ProgressEvent):void {
        trace(e.bytesLoaded + " loaded out of " + e.bytesTotal);
        trace("LOADED");
    function scrollPanePopulate(event:Event){     
         //show scroll pane
         scrollPane.x=33;
         scrollPane.y=33;
         TweenLite.to(scrollPane, .5,{autoAlpha:1,overwrite:true});
         TweenLite.to(spHeader, .5,{autoAlpha:1,overwrite:true});
         //create the temp variables
         var calledMarkerIndex=pntxml.row[pointindex].ID;
         var calledMarkerDate=pntxml.row[pointindex].DATE;
         var calledMarkerDescription=pntxml.row[pointindex].DESC;
         var calledMarkerContent=pntxml.row[pointindex].URL_OF_CONTENT;     
         var imgWidth=JPGIndexArray[pointindex].width;
         var imgHeight=JPGIndexArray[pointindex].height;
         scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription;
         var imgBoxHeight=scrollPaneContent.scrollPaneImage.height;
        var txtHeight=scrollPaneContent.scrollPaneText.height;
        var contentHeight=(imgBoxHeight+txtHeight);
        scrollPane.setSize(300,(contentHeight+15));     
         //size the text box
         scrollPaneContent.scrollPaneText.width=270;
         //if image is wide or tall, scale accordingly and create a string that will be used
         if(imgWidth>=imgHeight){          
              var imgSource:String = "<img src="+"'"+calledMarkerContent+"'"+"width='"+250+"'"+"height='"+150+"'"+"/>";                    
              var calledImgHgh=160;          
         else
              var imgSource:String = "<img src="+"'"+calledMarkerContent+"'"+"width='"+110+"'"+"height='"+167+"'"+"/>";          
              var calledImgHgh=177;          
         //fill in the text
         scrollPaneContent.scrollPaneImage.htmlText=imgSource;
         //scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription;     
         //pan the map to the called position
         map.panTo(pointsArray[calledMarkerIndex-1].getLatLng())
         //add the header to the SP and scale accordingly
         scrollPane.addChild(spHeader);
         spHeader.x=-1;
         spHeader.y=1;
         spHeader.width=299;
         if (txtHeight>=250){          
              scrollPane.setSize(300,275);          
              scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription+"<br><br>";
         if (txtHeight<=5){
              scrollPane.setSize(300,200);
              scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription;
         if (txtHeight>=5){
              scrollPane.setSize(300,275);
              scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#000000'>"+calledMarkerDescription+"<br><br>";
         // CREATE TEMP VARIABLES FOR POSITIONING AND PLACE DYNAMIC TEXT
         var scTextY=scrollPaneContent.scrollPaneText.y;
         var scImageY=scrollPaneContent.scrollPaneImage.y;
         var scTextHeight=scrollPaneContent.scrollPaneText.height;
         scrollPaneContent.scrollPaneText.y=scImageY+calledImgHgh;
         //update the scrollpane and reset the scrollbar
         scrollPane.update();
         scrollPane.verticalScrollPosition=(0);
         scrollPane.verticalScrollBar.height=270;
         scrollPane.verticalScrollBar.x=281;
         scrollPane.verticalScrollBar.y=3;
    spHeader.alpha=0;
    this.addChild(spHeader);
    var photoMarkersArray=new Array();
    var photoMarkersIndexArray=new Array();
    //CREATE ARRAY OF PHOTO MARKERS
    function createMarkerArrays(e:Event):void{
    for (var j:int=0; j<pntxml.row.(TYPE=="PHOTO").ID.length(); j++){
              var tempMarkerIndex=pntxml.row.(TYPE=="PHOTO").ID[j];
              var tempMarkerRef="mrk"+tempMarkerIndex;
              photoMarkersArray.push(tempMarkerRef);
              photoMarkersIndexArray.push(tempMarkerIndex);

Maybe you are looking for

  • Customize fields for BP in CRM 4.0

    Hi all, I would appreciate if you could provide me the best practice for customizing, i.e. remove, add and rename fields for a BP in CRM 4.0. As I can see, for one single change in a standard view, e.g. remove a field group, a new dataset has to be c

  • Issue in WS based on FM with data declared as TABLES

    Dear all, I created enterprise WS with endpoint as function module. The FM has a date declared as TABLES. I see the table data under Output section of External and Internal view in SE80. Also the data is being exposed (check box set). However if I co

  • After updating my iPhone 4S to IOS6 my iPhone does not appear in iTunes.

    After I updated my iPhone 4S to IOS6, I experienced the following issues. 1. My iPhone would not connect to WIFI, even though the WIFI icon on my iPhone indicated that it was. This in it self cost me $239.00 in excess data usage. I have since got the

  • Issue with Accessing Home Media DVR via web

    I recently had Fios installed (TV, Internet, Phone). Everything seems to be working fine so far. When I try to access my Home Media DVR via the web portal, I get time out messages, and errors saying that the DVR isn't responding. I get similiar error

  • Downloding data to excel

    Dear Experts, PATH for download to excel:List-exportlocal file-spreadsheet-save At the time of data downloding to excel format some data will missing. Best Regards, Sachin Shelke.