Other Classes Not Recognised By NetBeans GUI

Jan 21, 2014

I'm working on a University project creating a simple game using Netbeans but I'm totally stuck. I've created a number of classes to perform various methods, such as throwing back formatted text but I can't get them to work from within a Swing GUI created in Netbeans.

The Main method simply creates an instance of another class called Game which then itself creates instances of a number of other classes (textEngine, timer) and also a Swing GUI Class. The GUI appears on screen ok and I've been able to get methods working inside the GUI such as changing pictures and text when clicking a button. But I CANT get the GUI class to recognise the instances of the other classes or access their methods. I've created an instance of the TextEngine class called tEng. So I type this code in the GUI class:

textField.setText(tEng.getPhrase(2));

getPhrase() returns a String based on the number passed in the argument. But Netbeans reports an error that tEng is not recognised as a symbol despit it being a member of the same package. Creating the instance of the class within the GUI class likewise fails:

TextEngine tEng = new TextEngine();

Again the class is not recognised.

View Replies


ADVERTISEMENT

How To Write All Classes In Just One Tab In NetBeans

Oct 22, 2014

find a way to make all my clases in one single tab and not like this: URL....

because at the end of the exam, we have to paste the whole code (as one) in a specified web page, which instantly shows us the result. We need the whole code to be in just one page (like back in C++).

View Replies View Related

How To Call Classes Within Other Classes

Apr 18, 2014

How do you call classes within other classes? Or can you only call classes through the main?

View Replies View Related

Passing Values To Two Classes And Retrieving Values From Those Classes

Feb 14, 2015

I'm doing an aggregation exercise that's suppose to find the volume and surface area of a cylinder. What I'm trying to do is pass values from one class, to a second class, and that second class passes values to a third class.

This may be a clearer explanation: The first class is the main program which sends values to the second and third class. The second class is used do calculations for a circle (a pre-existing class from another assignment). The third class grabs the values that the second class calculated and calculates those values with the one that was passed from the first class to the third class. The first class then prints the outcome.

Problem is when the program gets to the third class, it just calculates the value from the first class with the default constructor from the second class. It's like the second class never received the values from the first class. I think I'm missing a step, but I don't what it is.

First Class:

package circle;
import java.util.Scanner;
public class CylinderInput
{
static Scanner in = new Scanner(System.in);
public static void main(String[] args)
{
//user defined variable

[Code]...

View Replies View Related

2D Array In NetBeans GUI

Aug 9, 2014

I am trying to create a program in NetBeans GUI builder and I am having trouble creating the 2D array. Here is what I have come up with so far:

private void enterButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
double time = 0;
try{
time = Double.parseDouble(timeText.getText());

[Code] ....

Right now it is printing what i need but I need to separate columns, not rows.

View Replies View Related

End Is Not Working In Netbeans

Jun 2, 2014

Currently the while near the end is not working in netbeans. It is saying illegal start of type. This whole section was working before when it was within the public static void method. I moved it to a separate class to try and clear up a, static variable problem. My question is can i fix it to keep it structured this way. Or do I have to put it back into the main method and try to work out the static variable problem a different way.

public class InventoryProgram {
double[] dvdprice; // defines variables
int[] dvdnum;
int[] dvdstock;
String[] dvdnames;
int count;
double total;

[code]....

View Replies View Related

Difficult To Create JAR In NetBeans

May 5, 2014

I'm trying to create a JAR in NetBeans, but I get messages.:

C: Users Administrator Desktop Project nbproject build-impl.xml: 993: The Following error occurred while executing this line:

C: Users Administrator Desktop Project nbproject build-impl.xml: 837: copylibs does not support the "excludeFromCopy" attribute

NetBeans does not generate the. JAR because disses errors.

My specs

Version of OS = Windows 7 64 Bit
Java version = 1.7.0_55
Netbeans version = 7.0.1

View Replies View Related

Stopwatch Program In Netbeans

Oct 18, 2014

This is a stopwatch program. Somehow, the run method in the displayUpdater does not get called. Overall, the program should have a start button and when the user clicks start, the button changes into a timer. My timer doesn't count here because the run method is not called.

import java.awt.event.ActionEvent;
import javax.swing.SwingUtilities;
public class StopWatchNew extends javax.swing.JFrame {
/**
* Creates new form StopWatchNew
*/
public StopWatchNew() {
initComponents();

[Code] ....

View Replies View Related

How To Link Netbeans To Netlogo

Mar 9, 2015

I want to connect netbeans to netlogo. I have a class: NetLogoConnection I want to call the class when I click on OK btn in my GUI. The codes are as following:

XML Code: import org.nlogo.app.App;
public class NetLogoConnection {
public static void main(String[] argv) {
App.main(argv);
try {
java.awt.EventQueue.invokeAndWait(
new Runnable() {
public void run() {

[code]....

View Replies View Related

Add XLSX Files To Netbeans

Sep 5, 2014

I'm running Netbeans 8.0 and attempting to use Apache POI to read various .xlsx files.

Currently, I'm getting a java.io.FileNotFoundException.

I'm using a Mac. What is the correct way to list the file path for my files in Netbeans? Also, is it possible to add the files to my actual project and access them inside the project?

View Replies View Related

NetBeans Quiz Game

Oct 27, 2014

I are having some trouble with our quiz that we made in NetBeans. The problem we have is that when we press play the question opens in a new window ( if we klick this button imgur: the simple image sharer this happens imgur: the simple image sharer but we want it to look like this imgur: the simple image sharer when we press the button). the code we are using for the button is imgur: the simple image sharer.

View Replies View Related

Netbeans - Calculation In GUI Interface

May 12, 2014

I'm trying to create a GUI interface in Netbeans that calculates a phone bill.

I created a GUI interface that input:
- Account Name.
- Account Number.
- Number of Minutes the phone was used. (with a textarea so the user input the minutes)
- 2 JRadioButtoms so the user can chose the regular or premium service.
- Amount Due (+10% taxes) (also with a textarea)
- Clear/Enter/Result/Done Buttoms

And I need to output:
- Account Name.
- Account Number.
- Number of Minutes.
- Taxes
- Total Amount Due.

I have a couple of math formulas I have to add them to output the above however I'm new to java so I don't know which code to use.

The math formulas are:
-Regular charges = 20 + ( No. Minutes - 50 ) * 0.20
-Premium charges = 50 + ( No. Minutes - 75 ) * 0.50
-Taxes = ( Regular charges + Premium charges ) * 0.10
-Amount Due = Regular charges + Premium charges + Taxes

View Replies View Related

Netbeans And Non-static Variables

Feb 11, 2014

I'm doing in this small piece of code -

JavaApplication3.java

package javaapplication3;
public class JavaApplication3 {
public class robot {
int xlocation;
int ylocation;
String name;
static int ccount = 0;

[Code] .....

When I'm trying to compile it with netbeans i get these errors and i just can't figure why is that!

C:UsersuserDocumentsNetBeansProjectsJavaApplication3srcjavaapplication3JavaApplication3.java:16: error: Illegal static declaration in inner class JavaApplication3.robot
static int ccount = 0;
modifier 'static' is only allowed in constant variable declarations

C:UsersuserDocumentsNetBeansProjectsJavaApplication3srcjavaapplication3JavaApplication3.java:30: error: non-static variable this cannot be referenced from a static context
robot firstrobot = new robot(34,51,"yossi");

View Replies View Related

How To Use Break Points In Netbeans 8

Aug 19, 2014

I want to know that how can i use break points in net beans 8. I'm able to put break point by clicking at the line but don't know how to use it..Actually i'm getting wrong output of my code and i want to know my line by line execution of the code so i can get better idea of where is my code going from one line to other. I have used break point in micro soft visual studio2010 and that was easy after puting break point run the project then f11 to get line by line execution...I want to know any method exist in java net beans (i'm doing GUI swing controls)...

View Replies View Related

To Get A Single Jar File With NetBeans?

Mar 31, 2013

When I click on "Clean and Build" NetBeans generates a .jar file and inside the folder "dist" it add a directory called "lib" with all the java libraries used to implement the program. I would like to achieve with this IDE an unique .jar file that includes everything you need such as Eclipse does by default. Is it possible?

View Replies View Related

How To Disable USB Port In Netbeans (Java)

Dec 3, 2014

If this is the C Programming codes for disabling the USB port:

system("reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetSer vicesUSBSTOR /v Start /t REG_DWORD /d 4 /f");

How can I use the codes below in Java using Netbeans?

View Replies View Related

Netbeans IDE 7.4 Does Not Recognize Swing Apps

Jan 9, 2014

my IDE doesn't seem to recognize that my program is a Swing app.I get the following error message when I run the app: "jtabledemo.JTableDemo class wasn't found in JTableDemo project."It compiles successfully though.Here is the code verbatim:

package jtableDemo;
// Demonstrate JTable.
import java.awt.*;
import javax.swing.*;
/*
<applet code="JTableDemo" width=400 height=200>

[code]....

View Replies View Related

Swing/AWT/SWT :: ActionPerformed And ActionListener On Netbeans Are Same?

Mar 3, 2014

ActionPerformed and ActionListener on Netbeans...If I create a ComboBox on Netbeans using GUI design, then I right click over the Combobox I can find Events - Action - ActionPerformed... but I can't find ActionListener...

Are ActionPerformed and ActionListener the same?

or...

where is ActionListener on GUI Netbeans? Do I need to manualy write the ActionListener part?

View Replies View Related

Netbeans - How To Remove Added Library

Feb 13, 2014

I'm just a java beginner. I've spent a lot of time installing and configuring software. I'm using Netbeans 7.3 on Windows 7, 64 bit. Recently, I downloaded opencsv from sourceforge.

With no previous experience adding libraries, I read a blog post on adding the library. I think that I then:

Start a new project.

Right click on libraries

Add jar/folder

Gave the temporary path to the .jar file

After, I read the blog post again, and realized I'd missed it. This time I did:

Right click library, Add library, Create library

However, I kept getting a message that the same library already existed. If I do the first process above, I will find the same library.

However, I see no way in Netbeans to remove it. I've deleted the test projects. And started a new one. But the library now exists for all projects it seems.

I've grepped all the files under the Netbean directory, searching for "opencsv", but found nothing. The only things in the Windows registry were locations of files.

How can I delete this library permanently from Netbeans? Short of, uninstall, then reinstall? Is there a way to list all the libraries that Netbeans has?

View Replies View Related

Swing/AWT/SWT :: How To Implement JTextArea In Netbeans

Apr 20, 2014

I have dragged and dropped a jTextArea from netbeans palette onto my form. But when I right clicked for Event > action > actionPerformed for implementation, I realized such was not there, unlike the jTextField component. For example, I have tried this but it didn't work:

//{
Import java.swing.*;
JTextArea txa = new JTextArea();
txa.getText(jTextArea1);
txa.setText(jTextArea1);
txa.setTextWrap(true);
//}

View Replies View Related

How To Access Combobox From Another Class In Netbeans

Aug 17, 2014

I make a coding a subject system for my internship project, I use JComboBox to choose name of faculty. I want to call selected item of faculty from another class to choose subject under the selected faculty.

How can I call selected item from another class?

This is my coding for select faculty.

public class lectInterface(){
private void saveDataActionPerformed(java.awt.event.ActionEvent evt) {
String staff_id=staffID.getText();
int staff_Id=Integer.parseInt(staff_id);
String Name=staffName.getText();

[Code] ....

and below is coding for another class

try{
LectInterface lI = new LectInterface();
String host = "jdbc:derby://localhost:1527/STUDLECDB";
String uName = "studlecdb";
String uPass = "studlecdb";
Connection con = DriverManager.getConnection( host, uName, uPass );

[code]....

View Replies View Related

NetBeans JFrame Form With Loop

May 14, 2015

I am trying to create an application in java with jframe form and i am also running certain code in for loop. Here is the trick. I want to stop the operation in the middle of for loop by click a button and start it again by click another button if we want.

My problem i can't do anything while the for loop is running.

View Replies View Related

Finding JRE System Library On NetBeans?

Oct 6, 2014

I want to follow this tutorial on YouTube but I cant seem to find the JRE System Library on NetBeans? So I decided to just get Eclipse but when I unzip the download and click either .exe files(I only see two .exe files) it gives me this message:

"The Eclipse executable launcher was unable to locate it's companion shared library."

Which ultimately prevents me from using the software completely.

View Replies View Related

Create A Java Application In NetBeans

Mar 9, 2015

Create a Java Application in NetBeans with the following two classes.

1. A Java class College
o Use the following data fields:
College Name
College City
Number of Tracks
Number of Students
Number of Faculty
Number of Staff
o Implement an empty constructor
o Implement a full constructor
o Implement Setters and Getters (Mutators and Accessors)
o Implement SetAll() method with all data members as parameters

2. Another Java class called CollegeDemo with the main() method:
o In the main():
o Read the values of the fields of 3 colleges from a text file and for
each create a College object.
Filename: colleges.txt
IT Dubai 7 200 50 20
ENG Abudhabi 4 400 60 20
SCIENCE Sharjah 3 300 40 20
 First with empty constructor then uses setters.
 Second with full constructor (no need to use setters).
 Last one with empty constructor and SetAll() setter.
o Display the average number of students for all the 3 colleges.
o Change the value of ‘Number of Students’ in the SCIENCE College to
500, and display the average number of students again.

here my code :

public class Demo {
private String name ;
private String city;
private String cname ;
 
[code]....

View Replies View Related

Store The Image Into Database In Netbeans?

Jan 28, 2014

I have a image package consisting of images and they are displayed in a jlabel.I used the code below for that

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Image im=new ImageIcon(this.getClass()
.getResource("/images/" + imageNames[index])).getImage();
ImageIcon iconLogo = new ImageIcon(im);
jLabel5.setIcon(iconLogo);
}

Now I want to store the image displayed in the jlabel into the database(oracle).From the above code I dont know how to get the absolute path of the images.

View Replies View Related

Swing/AWT/SWT :: Java Built By Netbeans

May 2, 2015

I would like a small box to be able to enter a contacts information and I started with building it thru netbeans. Now I am thinking I should start from scratch so I understand everything. What should I do? I am having trouble making the buttons at the bottom work. All I would like to be able to do is setFrameVisible(false); but I can't seem to be able to do that without loosing the whole project not just the frame I am working on.

The buttons I am referencing are the Cancel & Accept

public class pa4GUI extends javax.swing.JFrame
{
String ph;
String ln;
String fn;
String em;
String or;

[code]....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved