Score: 164°       Point: 39814       Stars: 0        




vBulletin 4.0 Publishing Suite with CMS

Get Adobe Flash player


StdDraw & Arrays

I have to make the game Flood-It for a project and I'm struggling with the blocks you have to make.
This is my code so far, basically all I have done is drawn random colored blocks to see if I can do it, now the problem I have is how do I assign say grid[0][0] one of the random colors. In the end I want every block that was drawn to be assigned to a different grid[i][j].
public class Colours {
public static void main(String[] args) {
int N = 5;
double xpos = 0.0;
double ypos = 0.0;
double size = 0.05;
double[][] grid = new double[N][N];
for (int i = 0; i < N; i = i + 1) {
for ( int j = 0; j < N; j = j + 1) {
grid[i][j] = 5;
System.out.println(i + " " + j + " " + grid[i][j]);
for (double c = 0.0; c < 1; c = c + size) {
for (double z = 0.0;

2013-03-15 17:57:27

Problems using a Light weight font with java.awt

On my Mac, GraphicsEnvironment.getLocalGraphicsEnvi ronment(). getAllFonts() returns for the Helvetica font family :
Font[family=Helvetica,name=Helvetica,sty le=plain,size=1]
Font[family=Helvetica,name=Helvetica-Bol d,style=plain,size=1]
Font[family=Helvetica,name=Helvetica-Bol dOblique,style=plain,size=1]
Font[family=Helvetica,name=Helvetica-Lig ht,style=plain,size=1]
Font[family=Helvetica,name=Helvetica-Lig htOblique,style=plain,size=1]
Font[family=Helvetica,name=Helvetica-Obl ique,style=plain,size=1]
It thus contains a Light and a LightOblique font (with weight set to 1.0f).
However, when drawing with Java 2D, the Helvetica-Light output is obviously that of the
Helvetica font.
Deriving a new font from Font("Helvetica-Light") with weight 0.75 (or even less) does not change that b

2013-03-13 22:12:15

How to remove/replace Swing component object which the new one

Hello :)
I made a dynamic JPanel to hold the picture, where the picture came from the selected user ID in the JTable.
For example:
When I select ID 1 in the JTable, it will come out images A, B and C. But when I select ID 2 in JTable, that comes out is a picture of D, E and F
I made ​​it using a loop to make the JPanels that contain images A, B, C and so on.
The problem is, when I select ID 1 it display A, B and C image and create a JPanel object A, B and C or
whatever java sequence object name
When I chose ID 2 it shows D, E and F and JPanel objects D, E and F are created, I would like object A, B and C is removed / replaced / destroyed.
So that the view in Application does not increase the number of JPanels but replacing the previous created JPanel.
This is the code that I created to dis

2013-03-12 12:32:38

Need a java code to read 2-dimensional excel file and write as 1-dimensional file

I have tried vba macro it was working fine and as i am new to java i am unable to write code to convert 2-dimensional excel file and write as 1-dimensional file
here by i attached the sample excel - i need the java code to convert it and also i attached the vba code which i used - please help me to sort it out
Sub format_data()
Dim ws As Worksheet
Dim i As Long, j As Long, lrow As Long, lcol As Long, lastrow As Long
Application.ScreenUpdating = False
Set ws = Worksheets("Sheet2")
ws.Range("A1:I1").Value = Split("Name,Name Code,Family Code,Family name,Location Code,Apartment Location, Apartment Logo, Facility, Cost", ",")
ws.Rows(1).Font.Bold = True
With Worksheets("Sheet1")
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
lcol = .Range("IV1").End(xlToLeft).Column
For j = 5 To lcol
For i

2013-03-12 09:37:47

Java Heap Space Error...

Hi All
This is the error I'm getting. It happens when I'm trying to create a 6 dimensional array...
I've changed my config and the properties for the project:
netbeans_default_options="-J-client -J-Xmx1600M -J-Xss2m -J-Xms512m -J-XX:PermSize=500m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true"
but still I get...
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Any ideas?

2013-03-11 23:00:49

Error: Main method not found! Please help!

Main Assignment:
Write a class named Rectangle to represent rectangles. The data fields are width, height, and color. Use double for width and height, and String for color. Suppose that all the rectangles are the same color. You need to provide the accessor methods for the properties and a findArea() method for computing the area of the rectangle.
Write a client program(test class) to test the class Rectangle. In the client program, create two Rectangle objects. Assign any width and height to the two objects. Assign the first object the color red, and the second, yellow. Display the properties of both objects and find their areas.
Error: Main method not found in class Rectangle, please define the main method as:
public static void main(String[] args)
Java Result: 1
public class Rec

2013-03-11 22:36:22

setting a boolean field when being read from a file

i need help when i am reading in a file one of the tokens is either "yes" or "no" , i need to set the boolean field to true if it is yes.
and false if it is no. how do i do it ?
this is my code > public void readData(Scanner scanner)
group = scanner.next();
vehID = scanner.next();
regNo = scanner.next();
make = scanner.next();
model = scanner.next();
airCon = true; // where i have to change the boolean to true if it is yes
engineSize = scanner.nextDouble();
fuelType = scanner.next();
gearbox = scanner.next();
transmission = scanner.next();
mileage = scanner.nextInt();
dateFirstRegistered = scanner.next();

2013-03-09 10:58:04

Problem: Fill a comboBox from another combobox

I have 3 combobox.
I would fill the 2nd ComboBox depending on the element in the first select. Then the same thing for the third based on the 2nd.
I used action listener and I called in actionPerformed
My code runs fine but I have a problem to remove the old items in each combobox, I received the following error message:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at test.Prin$Deuxieme_combo.actionPerformed (Prin.java:154)
the error is in the second combo
java : 154
my code for the first combobox is as follows:
lass Premier_combo implements ActionListener
public void actionPerformed(ActionEvent e) {

2013-03-08 11:37:11

Aspose Eclipse Plugin is Released: Manage Java Components & Code Samples

What’s new in this release?
Aspose development team is happy to announce the release of
Aspose Eclipse Plugin
. This plugin is for those Java developers who don’t want to leave their Eclipse IDE to try out Aspose Java components. Using the Aspose Eclipse plugin you can download components and examples and easily explore powerful libraries for documents manipulation. Download the plugin from the Eclipse marketplace. This plugin is set of two wizards. A description of each wizard follows.
The new project wizard helps you setup project references properly.
Select components from the Aspose Java product line, like Aspose.Cells for Java and Aspose.Words for Java etc.
Once a component is selected, its reference is automatically downloaded from Aspose servers and added to the project’s classpa

2013-03-08 11:05:24

How to Bind form data in Struts 1.3 and jQuery

I am going to develop mobile apps... I have knowledge in struts1.3. I want to know how to bind data from Action Layer to Presentation layer. I have data in Action class, then i want to know to render data in jQuery form elements. It is great, If sample code available.

2013-03-07 08:28:31

How to login to a secure website

Hi There,
I am trying to create a code which can login to a user/password secure website using Java.
The problem which I am facing here is that my login URL gets redirected to some other URL as soon as I enter the login credentials and I am not able to figure out how can I keep the Cookies or Headers or anything constant so that I can verify that the script is able to login successfully.
I am able to get the source of my login page but I am not able to redirect to the page post login.
Can anyone please suggest me a way to create this script.
Thanks in advance,

2013-03-06 10:16:21

Problem in using javascript file in Eclipse Indigo

I am adding a javascript file in my Eclipse Indigo web project.
On the first line of javascript it is giving me following error:
Internal validation error java.lang.NullPointerException at org.eclipse.wst.jsdt.core.infer.Inferred Type.resol veType(InferredType.java:309) at
org.eclipse.wst.jsdt.internal.compiler.a st.LocalDe claration.resolveVarType(LocalDeclaratio n.java:128 ) at
org.eclipse.wst.jsdt.internal.compiler.l ookup.Comp ilationUnitScope$DeclarationVisitor.visi t(Compilat ionUnitScope.java:83) at
org.eclipse.wst.jsdt.internal.compiler.a st.LocalDe claration.traverse(LocalDeclaration.java :305) at
org.eclipse.wst.jsdt.internal.compiler.a st.SwitchS tatement.traverse(SwitchStatement.java:2 10) at
org.eclipse.wst.jsdt.internal.compiler.a st.Compila tionUnitDeclaration.traverse(Compilation Unit

2013-03-05 07:41:56

Java JCE File Encryption/Decryption?

I was just wondering how to encrypt and decrypt entire files with other files with JCE? I have custom files that hold other files and I was wondering how to encrypt them so people can't access it, and also how to decrypt it so I can read the contents in the program.

2013-03-04 02:33:31

Powers without Math.pow ???

I am having trouble with this, finding powers without math.pow does not really make sense. any help with this would be great.
instructions are:
File PowersOf2.java contains a skeleton of a program to read in an integer from the user and print out that many powers of 2, starting with 2^0.
1. Using the comments as a guide, complete the program so that it prints out the number of powers of 2 that the user requests. Do not use Math.pow to compute the powers of 2! Instead, compute each power from the previous one (how do you get 2n from 2n–1?). For example, if the user enters 4, your program should print this:
Here are the first 4 powers of 2:
2. Modify the program so that instead of just printing the powers, you print which power each is, e.g.:
Here are the first 4 powers of 2:
2^0 = 1
2^1 = 2

2013-03-03 21:07:44


Hi all,
I am taking a simulation test online. Ever since and I disable and re-enable Java, the page won't load on chrome. Keeps saying ""
Can anyone help?

2013-02-25 04:45:36

Does a 2D Arraylist exist?

I have created 2 regular 1-D Arrays but I want to stick them all into 1 ArrayList. Is this even possible. I want to tidy up the whole thing if possible. I am new to Java and this is for a homework assignment. My three arrays are all Integer Arrays so the ArrayList of Arrays would be of Integers if that makes any sense to anyone. Any help would be greatly appreciated!

2013-02-23 22:25:17

Jackless 1.2.10

Jackess is a pure Java library for reading and writing MS Access databases (currently supporting versions 2000-2007).
This release added optional support for enforcing foreign key constraints/cascading. This feature is disabled by default (for backwards compatibility), but can be controlled globally via a system property and/or on a per-Database basis using the setEnforceForeignKeys() method. MEMO columns now have additional metadata indicating if they are hyperlink fields

2013-02-21 22:38:05

Affichage des décimaux avec point et non pas virgule

je suis entrain de développer une application avec Netbeans et base des données Oracle XE.
j'ai une problème dans l'affichage des données enregistrer dans la base :
les nombres décimaux ont affiché avec point (Ex : 12.50) malgré qu'ils sont enregistré dans la base avec virgule(12,50).
Est ce que vous avez une idée pour changer l'affichage des décimaux.

2013-02-21 09:23:18

Need help with program for Hailstone Sequence

The Question:
Hailstone Sequence (Due 22 February 2013)
Take any natural number n. If n is even, divide it by 2 to get n / 2. If n is odd, multiply by 3 and add 1 to obtain 3 n + 1. Repeat the process indefinitely. The conjecture is that no matter what number you start with, you will eventually reach 1.
This conjecture has never been proved. But it has been verified on the computer for all starting values up to 20 * 258. To disprove this conjecture one has to find a single starting number that goes into a cycle that does not contain 1.
The function can be written as follows:
f ( n ) = ( n / 2 ) if n is even
f ( n ) = ( 3 * n + 1 ) if n is odd
For a given starting number, this function generates a series of numbers ending at 1 that is called the hailstone sequence. The hailstone sequences

2013-02-21 06:47:47

How to test set methods in JUnit

How do I test a set method in JUnit? Because whenever I try to make the test case I get an error that says "Type mismatch: cannot convert from void to int"?

2013-02-20 19:38:10

View More (Log In and Will Fans)

Win the T-shirt

with only 4000 points

Who We Are Partner Advertising Contacts Privacy terms Help & FAQ

© Copyright 2010-2017 Fabrizio Fichera. All rights reserved.

© 2010-2018 Fabrizio Fichera


Fill out the form you see below. Registration is free, fast and simple.
If you are already registered, sign in page login.

Web Site :
Required Field
First Name :
Required Field
Last Name :
Required Field
Email :
Required Field
Sex :
Required Field

evolveStar.com is free for ever !

evolveStar.com provides a search engine that allows you to gather information to write their own blog.

evolveStar.com enhances the sources displaying the logo of the site.

If you want to remove your site or you believe a site listed infringes copyright, please report it to: info@evolvestar.com

Specifies the subject copyright violation and the url of the page

evolveStar.com respecting the law DMCA (Digital Millennium Copyright Act) will immediately remove whatever its merits.

Next will be effectual and relevant checks.