Image Loads In IDE But Not When Exported - Creating Referred Library

May 6, 2014

So I am making a basic game and i am loading the images as such :

try {
background = ImageIO.read(new File(res/textures/bg.jpg"));
buildingManager.getButton().setCupcake_normal(ImageIO.read(new File("res/textures/cupcake normal.png")));
buildingManager.getButton().setCupcake_clicked(ImageIO.read(new File("res/textures/cupcake clicked.png")));
} catch (IOException e) {
e.printStackTrace();
}

A lot of sites say i have to add the folder where the folders are in as an class folder. So i did that but i dont get the same icon with the folder. i get this instead : code.PNG

Also i see the images inside the exported jar but they cant be reached, how do i fix this?

View Replies


ADVERTISEMENT

Software To Display Image On Screen Using Particular Library

Jul 30, 2014

I am writing a piece of software to display an image on the screen using a particular library. The library lets me create an Atlas out of texture file data, to fetch Textures out of the Atlas using the textures' names, and to draw the textures by calling Renderer.draw(texture). It doesn't make a great deal of sense to create more than one of an Atlas or Renderer. I previously designed my code as follows:

public class SystemAssets {
static Atlas atlas;
public static void initializeAtlas(String pathToTextureFiles) {
atlas = new Atlas(pathToTextureFiles);
}
public static Texture getTexture(String textureName) {
return atlas.getTexture(textureName);
}
}

Similarly, I made a TextureRenderer class whose sole purpose is to provide static access to a Renderer. But many people seem to say that opening up a class like this to global access is bad. I cannot think of any better alternative, however. My core update/draw logic currently works something like this:

public class Game extends AbstractGame {
public void init() {
Screen current = new FirstScreen();
TextureRenderer.initialize();

[code]...

Making a Renderer object belong to the Game or Screen class doesn't make much sense to me, as there doesn't seem to really be a 'has-a' relationship between them; it's more of a 'uses-a', so that seems to imply that it would be best to just call Renderer.draw(thing) from outside the class rather than making it a data member. This would make my main code essentially call the various methods in order to get or print some form of data, much like System.out.println(). And of course, making one of the classes a subclass of Renderer makes even less sense. But making data members static for the purpose of global access and using singletons are often cited as 'bad' programming practices. This problem also arises in a lot of other scenarios in my program, ie. when I want to serialize Thing data members like texture filenames; do I put the serializer as a static data member in a class for global access and call it like I would a function, or do I put it in a class? And it seems like the Renderer will have to be initialized at the start of the program, which would take place in the init() method in Game, then be used to draw Textures in the Screen, so it would have to be accessible from both locations.

edit: In case it's suggested to put these in the main class, that's unfortunately going to be difficult without using static variables; the library recommends having the main class creating an Application object, which is essentially a black box that actually does all the work of calling Game's init() and draw() methods (via a Game object passed into its constructor) and looping until the program exits. AbstractGame and Screen are classes supplied by the library, so it doesn't seem like I can easily give Game any data that AbstractGame doesn't specifically ask for.

View Replies View Related

Servlets :: Website Loads Correctly Only After A Refresh?

Jan 16, 2015

find out why when I access the site for the first time, it loads a blank white page, but when I reload it, it forwards me to the home page as it should.

I doubt that the reason is nothing else than the code below (in the doGet method):

String email = (String) request.getSession().getAttribute("email");
String cookieValue = null;
System.out.println(email);
// first, checking the session
if (email != null) {
request.getRequestDispatcher("/homelogged").forward(request, response);

[code].....

I suppose it's something with the session... because after I reload it, it works. But! When I close the browser and start all over again, the main page is white-blank again... And after a reload it works.

The exception:

SEVERE: Servlet.service() for servlet [first] in context with path [/MYSITE] threw exception
java.lang.NullPointerException
at controller.Controller.doGet(Controller.java:42)
Line 42 of the Controller is "for (int i = 0; i < cookies.length; i++) {"

P.S. I cleared all the cookies, but the problem persists.Also, the first it loads, it prints in console:

"null
been here 4!"

But, if I reload further, it prints:

"null
been here 4!
been here 2!
No Email! Literally, doGet!"

View Replies View Related

Creating Application Which Detect Image And Process It?

Oct 24, 2013

i want to create an application which detect an image which took from camera and to process it so that it can be verified ..for example number plate of the vehicle ..if i need to extract the numbers from the image ..

View Replies View Related

Swing/AWT/SWT :: Image Manipulation - Create Application Where Image Is Displayed On One Label

Apr 7, 2014

Sir, I'am new to Swing Programming. I have to create an application where an image is displayed on one Label. The same image has to be split in parts and stored in database pert wise. Later the user has to retrieve the entire image by viewing a small part of the image. I have already displayed the full image on the Label, now i don't know how to split the image and store it part wise in the database.

View Replies View Related

Retrieve Image From MySQL DB And Display In Jtable If Image Type Is Medium Blob Using Swings And Hibernate

Jan 5, 2015

I stored an image into MySQL database using swings and hibernate but I am struggling to retrieve that image from MySQL database and display same image in the jTable cell and same as on jLabel whatever I retrieve from the database using swings and hibernate .

View Replies View Related

JSP :: String URL For Image In Database And Show Image In File

Dec 24, 2014

I had string url for image in mysql database and I want show image in mu jsp file bu I can't.

<c:forEach var="urun" items="${listUrun.rows}">
<tr>
<td><c:out value="${urun.kitapresim}" /></td>
<img src="<c:url value="${urun.kitapresim}" /> " width="270" height="190"/>

URL...

View Replies View Related

JButton Image Does Not Show On Background Image

Feb 23, 2014

I successfully added a background image on the Panel but I can't create my JButton image on top of my background image.

ImageIcon piano = new ImageIcon("src/img/piano_backgrd.png");
JLabel backlabel = new JLabel(piano);
panel.add(backlabel, new Integer(Integer.MIN_VALUE));
backlabel.setBounds(0, 0, piano.getIconWidth(), piano.getIconHeight()); 
JButton volup = new JButton(new ImageIcon("src/img/volup.png"));
volup.setLocation(10, 0);
panel.add(volup);

View Replies View Related

How To Turn Image Into Tiled Image

Nov 21, 2014

I'm trying to make a method that takes an image and turns it into a tile image. So if the original image looks like this:

[URL] ....

then the output image should look like this:

[URL] ....

Here's a method that's supposed to do that but for some reason the output image looks the same as the original:

public static int[][] tile(int[][] arr){
int[][] tile = new int[arr.length][arr[0].length];
for (int i = 0; i < arr.length; i++) {
 tile[i]=arr[i];
}
return tile;
}

I recently changed the method and the error message I'm getting is "bad operand types for binary operator '+'. Here's the method:

public static int[][] tile(int[][] arr){
int[][] tile = new int[arr.length][arr[0].length];
for (int i = 0; i < arr.length; i++) {
for(int j=0; j<arr[i].length;j++){
tile[j]=(tile[j])+(arr[i]);
}
}
return tile;
}

View Replies View Related

Import All Library Within Directory

Sep 1, 2014

I see you can import in 2 ways:

import java.util.*;

or

import java.util.Scanner/Random/etc;

if I used the first one it imports all the librarys within that (directory?). If so would that add to a bigger file size?

View Replies View Related

How To Access Webcam Without A Library

Feb 13, 2015

how to access the webcam without a library

View Replies View Related

Java Simulation Library

Mar 12, 2014

I am trying to work on a project that involves Java Simulation Library, the imported library jslCode.jar cant be found ...

package jslx.forecasting.demandgeneration;
import jsl.utilities.random.distributions.Binomial;
import jsl.utilities.random.distributions.Constant;
import jsl.utilities.random.distributions.Exponential;
import jsl.utilities.random.GetValueIfc;

[Code] ....

View Replies View Related

How To Run Main Class With Jar Library

Aug 7, 2014

I have 3 source file below

//Hello.java
public interface Hello {
public void sayHello();
}
//Espanol.java
public class Espanol implements Hello {

[Code] ....

View Replies View Related

Stardict Java Library

Jun 16, 2014

I have stardict files and i want to use it in java. what is the library to use in java?

View Replies View Related

JVM Crashes When Calling JNI Library

Jan 8, 2015

The following error occurs when calling the JNI library . Also i attached the log file .

#
# An unexpected error has been detected by Java Runtime Environment:
#
# Internal Error (0xb), pid=855638038, tid=4
#
# Java VM: Java HotSpot(TM) Server VM (1.6.0.00 svcnedccadmin:01.23.09-18:04 IA6
4 mixed mode)
# Problematic frame:
# C 7e1809e0

#
Abort(coredump)
*** Error code 9

Stop.

View Replies View Related

Cannot Load Library JDIC

Jun 17, 2014

When I try to create a WebBrowser object

WebBrowser browser = new WebBrowser ();

I get this error

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't load library: C:UsersChris.m2
epositoryorgjdesktopjdicjdic.9.5windowsamd64jdic.dll

The problem is that the path does not exists after windowsamd64jdic.dll

So i cant put the dll file there..its the first time i use dll files ....

View Replies View Related

Facial Aging Library

Jun 6, 2014

i am developing a lost people app, i need a library to make a facial aging in pictures.

View Replies View Related

Object Library Hashmap

Jul 16, 2014

My perfect idea is to have a Hashmap that would increase size each Key & value added, it's almost like a self-increasing array. I mean I could just create a very large Hashmap for me to add objects to anytime I want with a key to be able to find the object. Is this the most efficient way, because I'm trying to make my Object Library compatible with any amount of Objects, however, I know there's a limit to how many values you can have in an array, but it's larger than I'll ever need.

Let's say I'm making a number storage program, and I may need from 3 to 8 numbers to be stored with a key to find them easily using a Hashmap, rarely I may need below 3 or above 8. So is it efficient for me to create a Hashmap that has 10 placeholders? Or can I make this more efficient. Note, my Library is static.

View Replies View Related

Trying To Import Library (Via Maven)

Feb 12, 2015

I have written a library in one project but cannot seem import to import it into my main project whenever I try Maven says it cant find it though it is installed in the repository and the .jar file is in the classpath.
 
mvn -v
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: c:Mavenbin..
Java version: 1.8.0_31, vendor: Oracle Corporation
 
Stack trace
org.jclarion.clarion.lang.ClarionCompileError: Class Not Found:com.MyProj.app.MyClass near line:310 (selma012.clw)
        at org.jclarion.clarion.lang.Lexer.error(Lexer.java:190)
        at org.jclarion.clarion.compile.grammar.AbstractParser.error(AbstractParser.java:111)
        at org.jclarion.clarion.compile.grammar.AbstractParser.importJava(AbstractParser.java:463)
        at org.jclarion.clarion.compile.grammar.AbstractParser.emptyLex(AbstractParser.java:258)

[Code] .... 

Library POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.MyProj.app</groupId>
  <artifactId>MyClass</artifactId>
  <packaging>jar</packaging>

[Code] ....

View Replies View Related

Download Object Using URL With Socket Library

Sep 21, 2014

I want to download objects (css , jpeg, html ,png ) using sockets in java without using httpurlconnection . How can i do this with simple socket library ?

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

2D Game - How To Create A Library Of Tiles

Apr 8, 2014

So I'd like to make like a library of tiles, and it isn't too big, which I could just call using a method, and I would specificy what information I need to get, and it would return that information.

For example, a small section of the tiles library is grass_tile, I call this library and specify what I need, and in this case let's say I need the width, or can the character enter it from north? or can the character just stand on it? So it's like a library or array, with sections of it being named by tiles, and by mentioning these tiles I can information about them.

gTile("grass","walkon") will return true, first because I specifiy grass, and yes the character can walk on grass, so it returns a boolean value of true.

gTile("stone","width") will return 16, first because I specify stone, and the stone's png image size is 16.

What I'm asking is not for how to work out if the character can walk on the tile, or read the width of a tile, but can I create like a library from which I can obtain information by giving the name of the tile, and then telling it what info I need.

If up key pressed && gTile((yTILE + 1).name(),"walkon") == true then moveChar("up")

View Replies View Related

How To Create Jar Library With Console Command

Apr 22, 2015

How to do create jar library with console system Windows .?

View Replies View Related

Implementing A Java Class Library?

Apr 18, 2014

i have been given a homework assignment where I have to get rid of a stack object I wrote for a program and replace it with the Stack<E> library java offers ie:

public class Stack<E> extends Vector<E> {
public Stack(); // constructor
public Boolean empty();
public E peek();
public E pop();
public E push(E item);
}

my question is do i have to actually write all these methods? Or can i just construct a stack and use the methods?

View Replies View Related

Could Not Locate OpenAL Library Error

Oct 20, 2014

On the first run, everything loads perfectly. The second run, I get the "Could not locate OpenAL library." error. I have the most updated version of slick/lwjgl. I have no clue why this is happening.I should also say, this error only happens if I get a message in the console saying "1 device not closed.." message for OpenAL. Here's the error message:

Quote
Mon Oct 20 16:39:35 EDT 2014 INFO:Initialising sounds..
AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80004005
AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80004005
Mon Oct 20 16:39:35 EDT 2014 ERROR:Sound initialisation failure.
Mon Oct 20 16:39:35 EDT 2014 ERROR:Could not locate OpenAL library.
org.lwjgl.LWJGLException: Could not locate OpenAL library.
at org.lwjgl.openal.AL.create(AL.java:151)
at org.lwjgl.openal.AL.create(AL.java:102)

[code]....

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







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