Note that there are some explanatory texts on larger screens.

plurals
  1. PONullPointerException error
    primarykey
    data
    text
    <p>I have a created a class that inherits from the Manager class that will act as a holder for <strong>four</strong> other abstract classes called AbstractColumn.</p> <p>Imagine a table with 4 columns, the table itself is the main class, and each column is AbstractColumn.</p> <p>I don't understand why I would get this error.</p> <p>Here are my classes.</p> <p><strong>The Main ColumnHolder.java class</strong></p> <pre><code>package tec.expenses; import net.rim.device.api.system.Bitmap; import net.rim.device.api.ui.Manager; import net.rim.device.api.ui.component.BitmapField; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.container.VerticalFieldManager; import net.rim.device.api.ui.decor.Background; import net.rim.device.api.ui.decor.BackgroundFactory; public class ColumnHolderManager extends Manager{ private AbstractColumn Entry; private AbstractColumn Category; private AbstractColumn Date; private AbstractColumn Amount; protected ColumnHolderManager(long style){ super(style); Background mainBackground = BackgroundFactory.createSolidBackground(0xEEEEEE); setBackground(mainBackground); AbstractColumn Entry = new AbstractColumn("Entry", NO_HORIZONTAL_SCROLL); AbstractColumn Category = new AbstractColumn("Category", NO_HORIZONTAL_SCROLL); AbstractColumn Date = new AbstractColumn("Date", NO_HORIZONTAL_SCROLL); AbstractColumn Amount = new AbstractColumn("Amount", NO_HORIZONTAL_SCROLL); add(Entry); add(Category); add(Date); add(Amount); } protected void sublayout(int width, int height) { /*layoutChild(this.Entry, 85, 50); setPositionChild(this.Entry, 10, 10 ); layoutChild(this.Category, 85, 50); setPositionChild(this.Category, 40, 0 ); layoutChild(this.Date, 85, 50); setPositionChild(this.Date, 70, 0 ); layoutChild(this.Amount, 85, 50); setPositionChild(this.Amount, 100, 0 );*/ setExtent(360, 203); } } </code></pre> <p><strong>The abstract AbstractColumn class</strong></p> <pre><code>package tec.expenses; import net.rim.device.api.system.Bitmap; import net.rim.device.api.ui.Manager; import net.rim.device.api.ui.component.BitmapField; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.decor.Background; import net.rim.device.api.ui.decor.BackgroundFactory; public class AbstractColumn extends Manager { LabelField labelHeader; protected AbstractColumn(String header, long style){ super(style); Background mainBackground = BackgroundFactory.createSolidBackground(0xCACACA); setBackground(mainBackground); this.labelHeader = new LabelField(header); add(labelHeader); } protected void sublayout(int width, int height) { layoutChild(labelHeader, 80, 30); setPositionChild(labelHeader, 5, 5); setExtent(90, 50); } } </code></pre> <p>As you can see the classes are very simple yet I cannot understand why I would get this error. </p> <p>I'm making this application for Blackberry using Eclipse as the IDE.</p> <p>When I comment out the Sublayout methods' setPositionChild methods I no longer get the exception which means that in the constructor of the ColumnHolderManager class, creating the new AbstractColumn objects aren't really getting created.</p> <p>Any help?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload