Problem with the Paint method

Hello guys,.

I develop a map-like application,

the screen contains key components of towing,

-on the upper part is an ObjectChoiceField where the user can select a card

- and below which is on the plan that the user has selected

The problem is that I use the paint method to allow the user at the image of pain, what causes my ObjectChoiceField to disappear. Any help? Please be easy on me, I'm totally new

Example Code:

private static final int HORZ_SCROLL_FACTOR   = 10;
    private static final int VERT_SCROLL_FACTOR = 10;
    int left = 0;
    int top = 0;
    int maxLeft = 0;
    int maxTop = 0;

    final String choices[] = {"3", "4", "5", "6", "23"};
    private ObjectChoiceField choiceField;

    private BitmapField imageOutputField;
    Bitmap bitmap;

    public NetworkingMainScreen() {

        setTitle("AUC Maps");
        imageOutputField = new BitmapField();
        choiceField = new ObjectChoiceField("Pick a Map:", choices)
        {
            protected void fieldChangeNotify(int context)
            {
                getURL();
            }
        };

        add(choiceField); // doesn't appear
        add(new SeparatorField()); // doesn't appear

        add(new LabelField("Map retrieved:")); //doesn't appear
        add(imageOutputField);

    }

    protected void paint(Graphics graphics) {
        if (bitmap != null) {
            graphics.drawBitmap(0, 110, imageOutputField.getBitmapWidth(), imageOutputField.getBitmapHeight(),
                    bitmap, left, top);
        }
    }

You try to create a screen where you can move an image larger than the screen?

Try this:

http://supportforums.BlackBerry.com/T5/Java-development/create-a-scrollable-image-field/TA-p/444955

Have the user choose the card before arriving at the screen or use more menu items.

The moving image field must focus to work properly. This scrolling while being able to focus on the ObjectChoiceField image will be delicate.

Tags: BlackBerry Developers

Similar Questions

  • Problem with the substring method

    I cannot using the substring method results in an "if" statement  To isolate the problem, I run the following code on the 9550 Simulator:

        String buff = "abcdef";
        String B = "";
        B = buff.substring(2, 3);
        Dialog.alert("B = " + B + ",  size = " + B.length());
        if (B == "c") Dialog.alert("Test passed");
        if (B != "c") Dialog.alert("Test failed");
        if (buff == "abcdef") Dialog.alert("xyz passed");
    

    When running I get the message "B = c, size = 1" message tracking "Test failed". and "xyz happened."  This last post seems to indicate that the "if" test is not having problem with channels.

    I tried to copy B on another channel and use it and adding spaces to the front and back and then cut, but none of those who have helped.  I even tried to change the test to B == buff.substring (2.3), but that no longer works.  When I change line 3 to B = 'c', I get the message "Test."

    Can someone tell me what is happening here?

    This seems to be the result wanted for me. The substring is only the letter c, because you start to position 2 (the third character because it is zero-based) and go down to 3 (which is impossible), but you check with the equality operator (==) and not the .equals of the String class that actually controls the characters method, then the test is a failure.

  • Printing problems with the Paint program

    Used the Paint program for years, no problem.  Suddenly, every time I print get a very tiny copy as if it has been reduced by about 75%.  If I try to enlarge before printing, etc., it gives me anywhere between 10 and 20 white sheets before give me a very tiny copy.  I used different printers with the same result.  I love this Paint program and would like to get back to where he was.

    And the program of mystery?

  • Problem with the getCharIndexAtPoint() method.

    Just try to set up a basic script to detect the text when the user clicks on it. The following code:

    trace (caesar_txt.getCharIndexAtPoint (300,300));

    GetCharacter();

    function getcharacter()

    {

    trace (caesar_txt.getCharIndexAtPoint (300,300));

    }

    Produced these results:

    42

    TypeError: Error #1009: cannot access a property or method of a null object reference.

    to fl.text::TLFTextField/getCharBoundaries()

    to fl.text::TLFTextField/getCharIndexAtPoint()

    at Untitled_fla::MainTimeline/getcharacter()

    at Untitled_fla::MainTimeline/frame1()

    If the first command the trace, the character index in this point (42) is returned, but as soon as the trace command is called in a function he faces a null object reference, apparently in the getCharBoundaries method. The field of text in question exist on the stage, it is not created in the code, but I doubt it would be a problem. Appreciate any help you could give me.

    I think you found a bug. I can reproduce it. The reason I think this is a bug is disable Word wrapping (select textfield, go to pass container and flow, defined behavior "Multiline no film"). The bug seems to only happen with active wordWrap.

    I produced the TLFTextField with code and also placed on stage to hand, the two error if the word wrapping is enabled.

    Disable word wrapping made your mistake disappear?

  • Problems with the Paint Bucket fill tool with Windows

    I've searched the forums from Adobe on this problem and I noticed that many of them are still listed as unanswered. There are a lot of good ideas out there, but I'm trying to fill in a form that I created using several strokes that are overlapping with a completely sealed space in which still cannot be completed. I can fill in forms with the form (ie. ellipse, rectangle, etc.) tool, but every time I have to draw a shape by hand or by using the online tool he still doesn't accept the paint bucket. I tried it on a Mac with Flash Professional CS5 (which is what I'm working with on my computer) and the tool works perfectly. Does anyone know what other parameters or options I which can be settled otherwise; the paint bucket tool with a selected color, Alpha for bucket at 100%, the Reading Gap size "close major gaps" or lines do not finish the form? Other ideas would be very useful... Thank you!

    The following worked for me: a high magnification zoom > try to click the lines instead of the empty space of void. I think programmers of Adobe has made some changes to the interactions. It's silly, how the behavior of click of this tool is, but it works. Try zooming in and clicking on the lines - do not forget to use TINY arrowhead in the fill icon. That's the thing.

  • Display problem with the lineTo method

    Hello

    There is a code to draw a horizontal line below. My problem is that the quality of the screen is bad. How to run the code in order to have a better view of the line?

    var monDessin:Shape = new Shape();

    addChild (monDessin);

    monDessin.graphics.lineStyle (1, 0 x 990000, 1);

    stage.addEventListener (MouseEvent.MOUSE_DOWN, clicSouris);

    stage.addEventListener (MouseEvent.MOUSE_UP, relacheSouris);

    stage.frameRate = 2;

    var temp: Number;

    function clicSouris(pEvt:MouseEvent):void

    {

    var positionX:Number = pEvt.stageX;

    var positionY:Number = pEvt.stageY;

    temp = positionY;

    monDessin.graphics.moveTo (positionX, positionY);

    pEvt.currentTarget.addEventListener (MouseEvent.MOUSE_MOVE, bougeSouris);

    }

    function bougeSouris(pEvt:MouseEvent):void

    {

    var positionX:Number = pEvt.stageX;

    var positionY: number = temp;

    monDessin.graphics.lineTo (positionX, positionY);

    pEvt.updateAfterEvent ();

    }

    function relacheSouris(pEvt:MouseEvent):void

    {

    pEvt.currentTarget.removeEventListener (MouseEvent.MOUSE_MOVE, bougeSouris);

    }

    Change the line that defines your lineStyle use pixel reference:

    monDessin.graphics.lineStyle (1, 0 x 990000, 1, true);

  • java.sql.SQLException: problems with the native/lack of loading methods library

    Hi all

    Please let me know how to fix the exception "java.sql.SQLException: problems with the native/lack of loading methods library: no ttJdbc in java.library.path".

    Thank you
    Prabhu

    Published by: Nina Prabhu on November 20, 2012 02:12

    Hi Prabhu,

    Probably, you must specify the LD_LIBRARY_PATH variable. Like the following:

    export LD_LIBRARY_PATH=$TIMESTEN_HOME/ttoracle_home/instantclient_11_1
    

    Best regards
    Gennady

  • Problems with the library missing/native methods: No. ttJdbcCS in loading java.li

    IAM facing a problem when you plug the timesten customer on the server The SQL Exception that Iam is pasted below: -.

    Problems with the native/lack of loading methods library: no ttJdbcCS in java.library.path

    I work with MAC OS X 10.7.2 and my version of timesten customer is 11.2.1.0

    I also changed the preferences of 64-bit to 32-bit Java, but still whenever I tried to connect with the SQL Developer it gives me the error above.

    As far as I see it, the problem here is that, when a native Mac application is launched, it does not inherit together of the usewr that launches it seems to start with some default environments so the parameters such as LD_LIBRARY_PATH, DYLD_LIBRARY_PATH (equivalent on OS X) does not always seem proagate imto the app too, because it has only a TT 32-bit for OS X client to present :-(it is essential that everything runs in 32-bit mode. -d32 must run the JAVA virtual machine in 32 bit mode, but it can be necessary also other things.

    I'm not an expert on Eclipse, but it is very likely that there are too many settings for things like 'path of the native library' and so on...

    Chris

  • Problem with the method. load()

    Hello

    I have a problem with the. jquery load().

    In my composition, in compositionReady, I use. load() to load a file external html in a regular element of edge - no problem here.

    The loaded HTML code contains a div id = 'spot' - I would like to clik top and pull a comand edge, such as 'play symbol' or 'move this item '...

    the problem is: How can I contact this div?

    I tried variuos solutions:

    $("spot")

    sym.getComposition () .getStage (). $("spot")

    ... and mix a lot...

    I originally thought to write something like

    {$("spot").click (function ()}

    Alert ('clicked spot.');

    })


    Thank you for helping me!


    This will not work because the loaded html file is completely external to the project dashboard animate. Elements in this external file, example #spot, is not 'really' connected to the edge project lead.

    Hope this makes some sense.

    Darrell

  • Problem with the rendering of JProgressBar in JTable

    I have some problems with the rendering of JProgressBar in JTable. In the case of several lines, when a progress bar is updated, and its text is changing, then he painted all the progress bars in this column.

    Here is my code I used to create the table:
    --------------------------------------------------------------------------------------
    JTable convertTable = new JTable(convertTableModel) {
    
                public Component prepareRenderer(TableCellRenderer renderer,
                        int rowIndex, int vColIndex) {
                    Component c = null;
                    if (renderer != null) {
                        c = super.prepareRenderer(renderer, rowIndex, vColIndex);
    
                        if (vColIndex == INDEX_CONVERT_STATUS) {
                            //System.out.println("c = "+c.getClass());
                            if(c instanceof JProgressBar) {
                                //System.out.println("inside = ");
                                c.setBackground(Color.BLUE);
                            }
                        }
                    }
                    return c;
                }
    
                public boolean isCellEditable(int rowIndex, int mColIndex) {
                    if (mColIndex == INDEX_CONVERT_SELECT) {
                        return true;
                    } else if (mColIndex == INDEX_CONVERT_STATUS) {
                        return false;
                    } else {
                        return false;
                    }
                }
    
                /*
                 * JTable uses this method to determine the default renderer/
                 * editor for each cell.  If we didn't implement this method,
                 * then the last column would contain text ("true"/"false"),
                 * rather than a check box.
                 */
                public Class getColumnClass(int c) {
                    if (getValueAt(0, c) != null) {
                        return getValueAt(0, c).getClass();
                    }
                    return null;
                }
            };
    --------------------------------------------------------------------------------------

    Then I applied on this table rendering engine

    ---------------------------------------------------------------------------------------
    // Applying JProgressBar Renderer for convert table
            TableColumn col = convertTable.getColumnModel().getColumn(INDEX_CONVERT_STATUS);
            ProgressBarRenderer progressBarRenderer = new ProgressBarRenderer();
            col.setCellRenderer(progressBarRenderer);
    ---------------------------------------------------------------------------------------

    Class code ProgressBarRenderer is as follows:
    ---------------------------------------------------------------------------------------
    public class ProgressBarRenderer extends JProgressBar implements TableCellRenderer {
    
        private Hashtable ht = new Hashtable();
    
        public ProgressBarRenderer() {
            super(0);
            this.setMinimum(0);
            this.setMaximum(100);
            this.setStringPainted(true);
            this.setBorderPainted(true);
    
            UIDefaults defaults = UIManager.getDefaults();
            Font font = new Font("Arial", Font.BOLD, 12);
            defaults.put("ProgressBar.font", font);
        }
    
        public void setRowEnabled(int row, boolean enabled) {
            ht.put(row, enabled);
        }
    
        public void setForeground(Color c, int row) {
            //System.out.println("setString ht = " + ht.size() + "  row= " + row + "  Selected= " + (Boolean) ht.get(row) + " color= " + c);
            if (ht.isEmpty()) {
                this.setForeground(c);
            } else if (ht.size() == 1) {
                this.setForeground(c);
            } else if ((Boolean) ht.get(row)) {
                this.setForeground(c);            
            } else {
                this.setForeground(c);
            }
        }
    
        public void setString(String s, int row) {
    
            //System.out.println("setString ht = " + ht.size() + "  row= " + row + " text= " + s);
            if (ht.isEmpty()) {
                this.setString(s);
            } else if (ht.size() == 1) {
                this.setString(s);
            } else if ((Boolean) ht.get(row)) {
                this.setString(s);
            } else {
                this.setString(s);
            }
    
        }
    
        @Override
        public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            
            //System.out.println("getTableCellRendererComponent = " + table);
            //System.out.println("Renderer ht = " + ht.size() + "  row= " + row + "  Selected= " + (Boolean) ht.get(row));
            
            if (ht.isEmpty()) {
                return this;
            } else if (ht.size() == 1) {
                return this;
            } else if ((Boolean) ht.get(row)) {
                return this;
            } else {
                return null;
            }
        }
    }
    ---------------------------------------------------------------------------------------

    I add the next line and rendered the progress column is follows:
       convertTableModel.addRow(new Vector());
       ((ProgressBarRenderer) convertTable.getCellRenderer(row, INDEX_CONVERT_STATUS)).setRowEnabled(row, false);
    ---------------------------------------------------------------------------------------

    When I add the first row, it works fine, but when I add the second row, he painted the entire column.

    Naturally, you will have problems if you set a string or a color of a table cell value when the class of the column is declared as integer. As I have already said, you need to spend some time with the tutorials.

    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Random;
    import javax.swing.*;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableCellRenderer;
    
    public class ProgressBarTableCellRendererExample {
    
      Random random = new Random();
      JTable table;
    
      public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
    
          public void run() {
            new ProgressBarTableCellRendererExample().makeUI();
          }
        });
      }
    
      public void makeUI() {
        table = new JTable(10, 1) {
    
          @Override
          public boolean isCellEditable(int row, int column) {
            return false;
          }
        };
        for (int i = 0; i < table.getRowCount(); i++) {
          table.setValueAt(0, i, 0);
        }
        table.getColumnModel().getColumn(0).
                setCellRenderer(new ProgressBarTableCellRenderer());
    
        JButton button = new JButton("Increment");
        button.addActionListener(new ActionListener() {
    
          public void actionPerformed(ActionEvent e) {
            increment();
          }
        });
    
        JFrame frame = new JFrame();
        frame.add(new JScrollPane(table), BorderLayout.CENTER);
        frame.add(button, BorderLayout.SOUTH);
    
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 400);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      }
    
      private void increment() {
        for (int i = 0; i < table.getRowCount(); i++) {
          Object value = table.getValueAt(i, 0);
          if (value instanceof Integer) {
            Integer oldValue = (Integer) table.getValueAt(i, 0);
            int newValue = Math.min(100, oldValue + random.nextInt(25));
            switch (newValue) {
              case 13: // and its multiples
              case 26:
              case 39:
              case 52:
              case 65:
              case 78:
              case 91:
                table.setValueAt("Failed", i, 0);
                break;
              case 100:
                table.setValueAt("Completed", i, 0);
                break;
              default:
                table.setValueAt(newValue, i, 0);
            }
          }
        }
      }
    
      private class ProgressBarTableCellRenderer
              extends JProgressBar implements TableCellRenderer {
    
        private TableCellRenderer stringRenderer =
                new DefaultTableCellRenderer();
    
        public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {
          if (value instanceof Integer) {
            setValue((Integer) value);
            return this;
          } else {
            return stringRenderer.getTableCellRendererComponent(table,
                    value, isSelected, hasFocus, row, column);
          }
        }
        // Override void validate(), invalidate(), revalidate(), repaint()
        // and all overloads of firePropertyChange(...) as no-ops
        // for efficiency
      }
    }
    

    DB

  • Problem with the HP G62 recovery disks

    Hello

    I'm having a problem with the restoration of the operating system on your laptop HP G-62. When I first bought the laptop, I was unable to make the recovery discs, so I ordered recently a few new HP. Because I have installed Ubuntu on the laptop, I wiped it from the disk hard drive used Wipedrive to remove the old Ubuntu operating system I had installed.

    Laptop computer reads the first disc ok and installs the component of windows, but when the screen lights up asking the two disc number it freezes and never installs anything when you try to move anything that used to screen it doesn't matter what and he used to install the second disk. He repeats just 'Please wait '.

    Thank you, Robert

    Hi, Robert:

    I can't help you get the recovery disks to work, but if you can read all 25 characters of the product key 7 windows on the bottom of your PC, you can do your own installation disc 7 windows to reinstall the operating system.

    Here's how:

    If you can read the Microsoft windows 7 25-character product key, you can download simple Windows 7 ISO files to burn on a DVD for the version of windows that is installed on your PC, and which is listed on the Microsoft COA sticker on your PC case.

    Burn the ISO with the option to burn the ISO on your DVD burning program and burn it at the slowest possible speed that will allow your program. This will create a bootable DVD.

    Or use the installation of Windows 7 USB/DVD tool to compile the ISO file that you download from Digital River. Link and instructions below. You need a 4 GB flash drive to use the USB compilation method.

    http://www.microsoftstore.com/store/msstore/HTML/pbPage.Help_Win7_usbdvd_dwnTool

    Use 25 characters on the PC product key to activate the installation.

    The key will activate a 32 or 64 bit installation.

    Then go to the support of the PC and driver page to install the drivers you need.

    Link to downloads ISO of W7 is below.

    http://www.mydigitallife.info/official-Windows-7-SP1-ISO-from-Digital-River/

    Paul

  • Problem with the numbers in the rows of cut and paste

    Hey,.

    I'm new to MAC and now have problems with the help of figures, I brought my windows Excel worksheets. On windows, I could cut a line and paste anywhere on this page and by practice that Excel would fill the void rank where I cut the content. but here on MAC it does not work, why?

    anyway I tried to live with it by cutting a line and for the collage, I used Insert > copied lines for paste swath and add a line for her. but last night I updated the numbers and now by the practice precedes the Windrow is stuck this time with a resized form, the line is resized to a big line.

    Why is this happening? If it can't be fixed, I can go back to a previous version of a number? This update of hate.

    Numbers is excellent NO then you should consider to guide your expectations.

    Cut number refers only to the content NOT the line, or cells.  Select when a row, and then use the cut command that you cut the contents of the cells.

    If you try to move a line from one place to another, you should try this method (which can work for you)...

    Select the line, then click and hold on the header line (up to the line "lift" on the table), the operation slide the line to the destination.

    Now drag the line:

    Now drop the line where you want to:

  • Problem with the Lenovo Z510 battery indicator

    I have an old Ideapad of one year z510. Last week, the battery indicator began to stuck on 100%. So not connected, he stops suddenly without notifying me with 10% and 7% remaining notification. I tried to uninstall the Microsoft ACPI control method battery compatible from the Device Manager but no change... Anyone has an idea what should I do otherwise.

    Thank you
    Ahmed

    In response to customer relationships of unexpected problems with the performance of the batteries portable Z500 and Z510, Lenovo made an update of the firmware of battery available via download on the Lenovo Forums.

    This battery firmware is intended to solve unexpected load following symptoms when a Z500 and Z510 mobile phone is turned on:

    • Battery is dead

    • Battery is not detected

    • Battery is detected and charged 100%, but when the power is removed, the laptop turns off immediately

    • When the battery is fully charged and the AC power is removed, the battery level falls considerably less than 10 minutes

    Please note a procedure step by step for the upgrade of the firmware is included in the .zip file, found in the file "ReadMe".

    The battery firmware update can be downloaded here: https://download.lenovo.com/lenovo/content/sm/z500_z510_battery_firmware_update.zip

    Thank you

  • Problems with the Power Manager 1.51 new T60 has

    I've updated Power manager version 1.51 has and I have problems with the gauge of Power Manager in the task bar. Life remaining battery is not updated once more. Is there any chance I can find an earlier version of the software that worked perfectly before? Or there is a method to solve the problem?

    Sincerely,

    Nikita Septucha


  • Problems with the display of the 3D graph

    Hello world

    I use a 3-d chart in one of my screws and I have problems with the display. See what it shows by yourself:

    So, as you can see, the chart does not correctly display the data. But one thing I know, is that the data are sent correctly, because when I copy the LabVIEW graphic and paste it into paint, what I see, this is the graph displayed correctly:

    Anyone know what may cause the problem? I also have a similar problem with a waterfall in 3D.

    You can always download the updates of ni.com so.

    I also went through a documentation on known LV 2011 issues. I was able to find something interesting onthis page:

    3D image controls can display transparently or LabVIEW crash on some graphics cards

    The 3D Picture Control is based on an OpenSceneGraph that uses OpenGL. It was noted several reports of the 3D image control crashing LabVIEW. In almost all cases, it was an Intel graphics integrated into question. This accident is due to a mismatch of the graphic material. Note: most 3-d charts use the 3D picture control

    Some possible workarounds are:

    • Update the video driver
    • Enable/disable hardware acceleration
    • Enable Aero in Windows 7
    • Disable Aero in Windows 7

    I might try these workaround solutions and see if any of them work for you.

Maybe you are looking for