nullpointerexception

How to serialize the JPanel?

余生颓废 提交于 2019-12-24 05:07:05
问题 So I have this code. And I'm trying to implement click to save on the JMenuBar and click to load. I am having trouble serializing the JPanel . How could I save the current plot view? the layout is set to AbsoluteLayout so the GroupLayout issue is not a problem. I've read through Google searches and I know this is not recommended but how else could I save and load it? package tester; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Shape; import java

Java null pointer exceptions - don't understand why

天涯浪子 提交于 2019-12-24 04:42:05
问题 Run time error on main method in MovieList.java. I'm not sure my program design is fundamentally very good, but I'd like to know why it crashes. Thanks in advance. package javaPractical.week3; import javax.swing.*; public class Movie { //private attributes private String title; private String movieURL; private String year; private String genre; private String actor; // constructor Movie(String t, String u, String y, String g, String a) { this.title = t; this.movieURL = u; this.year = y; this

React Native Mobx null pointer dereference

混江龙づ霸主 提交于 2019-12-24 04:02:37
问题 I'm using mobx (and mobx-persist) as my react native app global store (I'm using expo client). First I fetch some data from the server then i save the results in the store and persist them in asyncStorage. It was working fine at first but then suddenly when I try to login the app freezes then crashes with summary containing "Cause: null pointer dereference". Following is my code. The store code: import { observable, computed, action, set } from 'mobx'; import { create, persist } from 'mobx

Android: NullPointerException on getWritableDatabase()

萝らか妹 提交于 2019-12-24 03:23:42
问题 Here is where I try to access the database: UserDataAdapter dbHelper = new UserDataAdapter(this); dbHelper.open(); dbHelper.createNetwork(network); dbHelper.close(); UserDataAdapter.java: public UserDataAdapter open() throws SQLException { dbHelper = new DatabaseHelper(context); // of class DatabaseHelper database = dbHelper.getWritableDatabase(); // this line!! return this; } DatabaseHelper.java: public DatabaseHelper(Context context) { super(context, Defines.DATABASE_NAME, null, Defines

Exception in thread “main” java.lang.NullPointerException : While trying to the run the jar file

Deadly 提交于 2019-12-24 02:44:09
问题 When i run the command java -jar MyJar.jar i get the following errors : Exception in thread "main" java.lang.NullPointerException at sun.launcher.LauncherHelper.getMainClassFromJar(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) What errors are these ? What could be the reason i am getting these errors ? Before I packed the packages in a jar file the scene was : Then i packed the above files along with the packages by entering : jar -cf MyJar.jar .\Design\*

Compile .java file from within a java program?

不打扰是莪最后的温柔 提交于 2019-12-24 02:14:44
问题 I found this code: JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if(compiler.run(null, null, null, fileName) != 0) { System.err.println("Could not compile."); System.exit(0); } However, this returns a NullPointerException Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at net.foxycorndog.foxy.compiler.Compiler.compile(Compiler.java:25) at net.foxycorndog.foxy.compiler.Parser.parse(Parser.java:41) at net.foxycorndog.foxy.Foxy$ActionHandler.actionPerformed

Android: NullPointerException, what could be null here?

会有一股神秘感。 提交于 2019-12-24 02:13:09
问题 From the Logcat: 11-26 06:43:40.643: E/AndroidRuntime(1163): FATAL EXCEPTION: AsyncTask #1 ... 11-26 06:43:40.643: E/AndroidRuntime(1163): java.lang.RuntimeException: An error occured while executing doInBackground() ... 11-26 06:43:40.643: E/AndroidRuntime(1163): Caused by: java.lang.NullPointerException ... 11-26 06:43:40.643: E/AndroidRuntime(1163): at com.example.mymobiletest.SearchTask.doInBackground(SearchTask.java:134) Line number 134 is ed = (EditText) mainActivity.findViewById(R.id

How to add rows to JTable with AbstractTableModel method?

烂漫一生 提交于 2019-12-24 01:25:43
问题 I want to add rows to an already initialized JTable. Apart from other elements I have the following (relevant) code: import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; class sscce extends JFrame { private static final long serialVersionUID = 1L; // Serial

CMU-Sphinx : NullPointerException at recognizer.allocate()

霸气de小男生 提交于 2019-12-24 00:48:27
问题 I've been trying to set up CMU-Sphinx4 on my PC in order to make an application using speech Recognition. I was able to setup most of the parts and configuration and trying to run the HelloWorld application provided by Sphinx, but stuck with NullPointerExcetption at recognizer.allocate(); . Complete Stack Trace : 12:34:45.501 WARNING dictionary Missing word: <sil> 12:34:45.517 WARNING jsgfGrammar Can't find pronunciation for <sil> 12:34:45.517 WARNING dictionary Missing word: <sil> 12:34:45

NullPointerException on setShareIntent using ActionBarSherlock

别来无恙 提交于 2019-12-24 00:43:21
问题 I'm trying to use ActionBarSherlock + ShareActionProvider in a SherlockActivity. I've already checked this ( NullPointerException using ShareActionProvider + actionbarsherlock) but it doesn't solve my problem. I think the code is correct, but I keep getting FC and this logcat: 07-25 15:31:26.758: E/AndroidRuntime(911): FATAL EXCEPTION: main 07-25 15:31:26.758: E/AndroidRuntime(911): java.lang.NullPointerException 07-25 15:31:26.758: E/AndroidRuntime(911): at com.corsalini.david.calcolopesi