Swing/AWT/SWT :: Keywords Are All Getting Errors
Mar 17, 2014
I must be missing a bracket or an import somewhere in this small bit of code. What is wrong and why all my swing KeyWords are all getting errors.
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
public class list1 extend JFrame
{
private JPanel deckPanel;
private JPanel selectedDeckPanel;
private JPanel deckList;
[Code] .....
View Replies
ADVERTISEMENT
Feb 10, 2014
I have to build the attached GUI as exercise (exercise.jpg), but I am getting a lot of errors on the console. OK so the code is available on pastebin here: URL>...An excerpt of errors is attached. I don't understand why I get them. Basically the compiler is picking on new GridBagCostraints() and new Insets().
View Replies
View Related
Feb 1, 2014
program to accept string
import java.util.Scanner;
public class accept_string{
public static void main(String[] args)
[code]...
I wrote this program.actually I copy it from webpage this website.Its very cool to wrote programs in java.but I did not understand meaning of string,scanner......
View Replies
View Related
Jul 5, 2013
Keywords are the predefined definition known to compiler like public/static/void/class
And literals are String/init/double/char/ , so here for e.g. String , its also predefined class ..
So will it be right to say that literals are also keywords?
View Replies
View Related
Jan 23, 2014
Which package or class i can find all the predefined keywords in java like "this" etc...
actually i want to know if this operator is itself final in nature or not from its syntax?
View Replies
View Related
Oct 26, 2014
Is there any way to add duplicate keywords (for all java keywords) maybe in a different language such that we can program java in a different language.
View Replies
View Related
Jun 11, 2014
I am wondering if there is a way in jave to use enums WITHIN a class (without creating a separate enum class) without using private static final. Something like as folows:
class My Class {
myEnum {ACTIVE, INACTIVE, PENDING};
}
is there something like this available?
View Replies
View Related
Nov 19, 2014
why my program doesn't work. Here's the code :
public test5 {
public boolean test(int grille[][]){
for (int i = 0 || i < grille.length || i++){
int max = grille[i][0];
for (int e = 1 || e < grille[i].length || j++){
if (grille[i][e]== max && max !=0){
solution = false;
System.exit(1);
[code]....
View Replies
View Related
Feb 9, 2014
I get quite a few errors while trying to compile the BeerSong from the Head First Java book. I copied the text from another person that did the beer song on this forum and it worked as expected. What I can't figure out is why mine is not working when it looks like the text is exactly the same between the two versions. His works, but mine doesn't.
Here is the text and errors that I get:
public class BeerSong
{
public static void main (String[] args)
{
int beerNum = 99;
String word = "bottles";
[code]...
View Replies
View Related
Jun 11, 2014
It's probably really obvious, like it usually is, but I can't figure out why I am getting these errors on multiple functions.
if (!client.lowMem) {
for (int l = this.onDemandFetcher.getVersionCount(2), i2 = 1; i2 < l; ++i2) {
if (this.onDemandFetcher.method569(i2)) {
this.onDemandFetcher.method563(1, 2, i2); //Error
[Code] ....
The error I get on this line of code is 'Custom may not have been initialized', but no matter what I do, the error sticks.
Custom.cacheIndex = (Custom.cacheIndex + 1) % 10;
final Custom Custom = Custom.cache[Custom.cacheIndex];
//^^^^^
View Replies
View Related
Mar 19, 2014
I am making a simple mod/hack for a game programmed in Java. I located the .class file I needed and deobfuscated it and then decompiled it. After that I went in and made a very simple adjustment that I wanted to make. Unfortunately I can across a problem when trying to compile the file! The file won't compile because there are errors. The reason there are errors is because this is just one file out of an entire game. I know this my seem weird, but is there some way I can compile the file with the errors.
View Replies
View Related
Feb 3, 2015
I have the following code snipet and I get the following errors
interface expected here
[javac] private class fileFilter implements FileNameExtensionFilter{
[javac] ^
cannot find symbol
[javac] symbol : method fileFilter(java.lang.Object)
[javac] location: class gui.components.StartupDialog
[code]...
View Replies
View Related
Nov 30, 2014
import javax.swing.*;
public class opt
{
public int code[];
public static void main(String[] args)
{
int xxx = 1;
[Code] ....
Where did I did wrong cus I keep getting these errors: What do I need to do to fix the errors?
F:>javac opt.java
opt.java:25: error: cannot find symbol
cd.checkDeclare<zz>;
^
symbol: method checkDeclare<String>
location: variable cd of type code[]
java:32: error: cannot find symbol
[Code] ....
4 errors
View Replies
View Related
Sep 25, 2014
I'm trying to use a setter method to pick a random integer to be the MPG for a car. However, I'm having major issues in my driver when trying to use that random number in an instance. I'm not finished with the driver yet because I keep getting "cannot find symbol errors"
import java.util.Random;
public class Car {
private String make;
private String model;
private int year;
private int mpg;
private int odometer;
Random generator = new Random();
[code]...
View Replies
View Related
May 6, 2015
I am watching BrandonioProductions on youtube. His videos are pretty good, but he doesn't seem to get errors where I get them. Here is an example.
public class compareUnequal {
public static void main(String[] args){
compareTwo();
}
public static void compareTwo(){
String x = "david";
String y = "Notdavid";
if (!x.equals(y)){
System.out.println("Not equal");
}
}
}
It runs ok, but asked me to proceed when there is an error, but I can`t figure out where the error is!
View Replies
View Related
Apr 7, 2014
Here is my code that is supposed to read a user-selected document, create text boxes from that info, and display them. (There is a lot of code in there that may not be relevent, but just ignore that.) When I compile, I receive errors that it can not find the symbols color, xIn, yIn, w, and h.
Here's my code:
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
public class Ex22 extends Basic {
[Code] ....
View Replies
View Related
Mar 26, 2015
I'm trying to read lines from a textfile and count all the words using String Tokenizer. However I keep getting an error "Unhandled exception type FileNotFoundException" on my IDE(Eclipse) referring to lines 13 and 8. When I let the IDE automatically, and I've even tried typing this manually, insert a try-catch block more errors show up concerning inputFile. When I insert the throws FileNotFoundException for each method it compiles but after running it gives me a FileNotFoundException for textfile.txt. What's even more interesting is that when I copy the .java file out of the IDE project folder, place it in a random empty folder on the Desktop with the textfile.txt, and try running it through command line, it gives a NoSuchElementException: No line found.
import java.util.Scanner;
import java.util.StringTokenizer;
import java.io.*;
[Code].....
View Replies
View Related
Apr 21, 2014
I implemented the new DB, I have changed all the variables accordingly. When I execute the website, I get errors and it keeps referring to the old db.
Using sql langauge, the website has been implemented in Java.
View Replies
View Related
Jun 5, 2014
I have a JSP which will let a user register for an account at my website. If the user submits wrong or illegal info into the JSP, then I want to return the same JSP with an appropriate error message next to/above each wrongly filled (form) fields.
If possible, highlight the wrongly filled form field - this feature is not necessary though.
I have given a sample below to show what I need. I understand that the sample must be using something like javascript, but I don't know all that client side scripting. I only want to use JSP to do it. As I said, I want to sort of return the JSP form to the user after marking all the mistakes and how to correct them.
How do I do this ?
View Replies
View Related
Apr 30, 2014
for my assignment I am to only add the sort and total inventory methods in the inventory class. And not create an array in the inventory class at all. My inventory class should contain all the variables needed to use with the two new methods: sort and calculate total inventory.By not creating any array in the inventory class and not touching the variables at all.For the inventoryTest class, I only need to declare an array of the inventory class by making an instance of the inventory.
public class inventory
{
private int prodNumber; // product number
private String prodName; // product name
private int unitsTotal; // total units in stock
private double unitPrice; // price per unit
private double totalInventory; // amount of total inventory
[code]...
View Replies
View Related
Nov 24, 2014
I need to convert infix To Postfix but have a few errors.
Error msg:
PostFix:
Exception in thread "main" java.util.EmptyStackException
at java.util.Stack.peek(Unknown Source)
at java.util.Stack.pop(Unknown Source)
at assignment4.infixToPostfix.evaluatePostfix(infixTo Postfix.java:129)
at assignment4.infixToPostfix.main(infixToPostfix.jav a:19)
NB:
129 >>return (double) s1.pop(); AND 19>>>double ans = evaluatePostfix(postfixStr);
Deadline = less than 1 hour
View Replies
View Related
May 18, 2014
public void init(Board board) {
JPanel Panel = new JPanel();
Panel.setLayout(new GridLayout(board.getWidth(), board.getHeight()));
getContentPane().add(Panel, BorderLayout.CENTER);
Panel.setBorder(new LineBorder(Color.BLACK)); // it does not work also
[code]....
I have a JFrame. I added two JPanels to the JFrame. The first one is GridLayout and it should be situated at CENTER. Another one is bottomPanel, and that one should be situated at SOUTH.I would like to add two new JPanels(kit and another one) to the bottomPanel.Compiler does not show any warning or errors.The problem is, that bottomPanel situates at NORTH, not at SOUTH. kit situates at CENTER of bottomPanel, not at WEST.
View Replies
View Related
Feb 11, 2015
I created a class Person:
Java Code:
public class Person {
protected static int MAX_AGE = 150;
protected static int MIN_AGE = 0;
private static final String VALID_WORD_REGEXP = "[a-zA-Z]{3,30}";
private String firstName;
private String lastName;
[Code] ....
I'm trying to learn right way how to throw exceptions. I
Besides that I have couple questions:
I can't quite understand throws statement. I'm thinking throws statement is for passing exceptions one level higher(with are not cought in this caller function). So that would mean I need to put throws in this function only:
Java Code: Person(String firstName, String lastName, int age) mh_sh_highlight_all('java');
Am I right or wrong and is there any other use for it? If so that would mean when
Java Code: Person person = new Person(.....) mh_sh_highlight_all('java');
must be in try tags. How can I avoid it?
View Replies
View Related
Oct 17, 2014
protected void randomise() {
int[] copy = new int[];
// used to indicate if elements have been used
boolean[] used = new boolean[array().length];
Arrays.fill(used,false);
for (int index = 0; index < array().length {
[Code] .....
View Replies
View Related
May 2, 2014
Barbara is opening a book store, and she needs an effective, efficient, object-oriented program to keep track of her inventory. Barbara would like to maintain the following information about the books she sells: title, author, price, number in stock, and category. She categorizes her books into fiction, nonfiction and children’s books, because she has a separate room in her store for each category. Each book also needs an inventory number, and Barbara would like these numbers to start with 1000. She also needs to be able to keep track of the total number of books in inventory.
Barbara often facilitate her customers find books, and the program needs search capabilities to do this. Keeping an accurate inventory count of each book in stock is critical; both for accounting purposes and so she will know when to reorder. Barbara expects to have at most 2,000 differet books in her store.Barbara is very organized, and would like a nice menu, from which she can make choices that will enable her to do the following:
Add a new book to inventory
This adds a new Book object (title, author, etc) into inventory
It does not increase the number in stock of an existing book
Search by title
Search by author
Search by inventory number
Search by category
Print out all info for all books
This is the only output that should be on the command line
Please hard code the following book info into your program, so Barbara has some test data avaiable to test your program:
title: Crime and Punishment; author: Dostoevsky; price: 39.95; number in stock: 5; category: fiction
title: Brothers Karamazov; author: Dostoevsky; price 34.50; number in stock: 3; category: fiction
title: Java; author: Liang; price: 59.29; number in stock: 12; category: non-fiction
title: Java, author: Horstmann; price: 14.33; number in stock: 4; category: non-fiction
title: The Lion, the Witch and the Wardrobe; author: Lewis; price: 12.50; number in stock: 3; category: childrens
Here is my code so far. The first one is the "Blueprint" and the second one is the main.
public class Book
{
private String title;
private String author;
private double price;
private int stockNumber;
private String category;
private int inventoryNumber =1000;
private static int numberOfBooks = 0;
public Book(String theTitle, String theAuthor, double thePrice, int theStockNumber, String theCategory)
[code]....
View Replies
View Related
Mar 6, 2014
Why do I see many exceptions for one missing file on the stack trace ? My guess is, where ever that file or methof is being called , all of them will throw exceptions. So, where do I find the root exception, first one which is thrown OR the last one ?
java.io.FileNotFoundException: c: emppw.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at java.util.Scanner.<init>(Scanner.java:636)
at com.rbc.ReportDriverRunner.getPassword(AuditReportDriverRunner.java:39)
[Code] ....
In the above stack trace, "java.io.FileNotFoundException: c: emppw.txt (The system cannot find the file specified)" is the root cause (Assuming there is only one error which causes code to fail) ? Is the first one cause of failure whch then cascades failure of other methods ?
View Replies
View Related