[nbj2ee] Re: Set jLable text from another class

  • From: John Yeary < >
  • To:
  • Subject: [nbj2ee] Re: Set jLable text from another class
  • Date: Tue, 16 Oct 2012 15:41:09 -0400

This is the wrong forum for GUI based questions, please use the  " target="_blank"> mailing list.

____________________________

John Yeary
____________________________ 
NetBeans Dream Team
President Greenville Java Users Group
Java Users Groups Community Leader
Java Enterprise Community Leader


____________________________ 

       

"Far better it is to dare mighty things, to win glorious triumphs, even though checkered by failure, than to take rank with those poor spirits who neither enjoy much nor suffer much, because they live in the gray twilight that knows not victory nor defeat."
-- Theodore Roosevelt



On Mon, Oct 15, 2012 at 8:24 PM, Kwauhn < " target="_blank"> > wrote:
so I'm trying to create an error message for a program, and the dialog window is displayed when the error java.util.NoSuchElementException is caught. Just before that though, I try to change the text in the jLabel from the Notice class to "The chunks.dat file provided is corrupt, Fethr can not read the world.". When I have this code here is the only time I get this error:


Code:
Exception in thread "main" java.lang.NullPointerException
        at src.ChunksReader.main(ChunksReader.java:13)
Java Result: 1



The problem is, I have gone into the jLabel's declaration and changed the identifiers the "public static", and NetBeans says the code is fine when viewing the source. If anyone knows why I get this error, and how to fix it, that would be really helpful :)

source:


Code:

package src;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class ChunksReader {
    public static void main(String[] args) throws FileNotFoundException {
        try{
            String output = new Scanner(new File("C:\\Program Files\\Fethr\\Worlds\\Mill\\chunks.dat")).useDelimiter("\\Z").next();
            System.out.println(output);
        }catch(java.util.NoSuchElementException e1){
            Notice.jLabel2.setText("The chunks.dat file provided is corrupt, Fethr can not read the world.");
            Notice.main(args);
        }
    }
}










[nbj2ee] Set jLable text from another class

Kwauhn 10/16/2012

[nbj2ee] Re: Set jLable text from another class

John Yeary 10/16/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close