Class Is Moving Extremely Slow

Dec 8, 2014

I'm currently taking a computer science class but the class is moving extremely slow and I'm not learning much, so I've started to program on my own. The most recent project I've done is a tic tac toe game, and I'm looking for something else to do now. I can do with an increased difficulty from this project, but not extremely difficult.

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.reflect.Array;

[code]...

View Replies


ADVERTISEMENT

Accurately Converting Units Involving Extremely Small Numbers?

Jun 16, 2014

I need to convert units accurately. Some of these units include angstroms (0.1nm) and astronomical units or light years. I can't seem to accurately perform these equations (probably mostly because of lack of a proper conversion formula). For example:

1 angstrom = 1.79985601 × 10^-14 leagues (or, 0.00000000000001799856 leagues).

To perform the conversion right now, I'm simply multiplying the angstroms by 0.00000000000001799856. However, inputting 55560000000000 (angstroms in one league) results in 0.9999999936. Why is this? Is it possible to work around it? I believe there's a term for the inability for a computer to process 1/3rd properly, but I can't remember what it's called - is that the problem?

I am using BigDecimals for all equations.

Edit: a mod can change the title if they think another is more fitting.

View Replies View Related

Applets :: Loading Is Too Slow

Jan 31, 2014

We are using an applet in our web application. The applet of our application is dependent on bouncycastle jar,bcprov-jdk15.jar and few other jar's whose size comes around 4 mb. When using the appliaction on jre7, the applet is taking too long time to load than usual time. Is there any way to place these jar's in client machine? Will it improve the performance? Is there any other way to reduce the loading time of applet apart from placing jars in client machine?

View Replies View Related

X3D File Parser Is Way Too Slow

Nov 9, 2014

I've recently tried to write a file parser for the .x3d file type as it's one of the few 3d model types I can find written in easy to understand (and interpret) English. While it technically does work (or what I have so far), the issue is that it takes far too long (17 minutes) to parse just a part of the file (the vertices of the model).This is the code for the object itself:

import java.io.*;
import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
import javax.vecmath.*;
public class ModelLoader {
BranchGroup object = new BranchGroup();
BufferedReader reader;
String line = "start";

[code]....

Anyway, here are some observations I've made about the file:

-The line in the file itself that contains all the vertices is all one giant string according to the file.
-There are apparently 18,000 vertices in all (according to the command at line 18).
-Unless Netbeans automatically terminates infinite loops after a certain amount of time, it is most definitely NOT an infinite loop as I have seen the program terminate on its own (after 17 minutes, though).

I had a theory that maybe organizing each vertex into its own line and then having the program switch to the next line when it's done reading that vertex might make the program run faster, but I'm not sure why it would, so I thought I'd come here in case that theory turned out to be a dead end.

View Replies View Related

EJB / EE :: Deploy Slow Using 3.1 And JPA In Rational Application Developer?

May 13, 2014

I have a large scale enterprise application (5 modules) project using RAD, WAS v7, Java EE 6 (EJB 3.1, JPA), ZK framework.

The project is using RAD as IDE. The problem is that it takes too long to deploy (more than 5 min) when changes are made to the EJB's (although the changes are minor in only one file) but when changes are made to zk framework (the web & presentation layer), it is fast to deploy.

Don't know what cause the problem. Is it because of EJB 3.1/ JPA or RAD/ WAS?

Is it happening in other IDE or applcation server also?

View Replies View Related

I/O / Streams :: Java Reading And Output Is Too Slow

Sep 17, 2014

I have a code below that is reading large image size and writing them to file however the process is too slow. how can i refine this code in such a way that it will work faster?

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.HttpURLConnection;

[code]....

View Replies View Related

I/O / Streams :: Java Reading And Output Too Slow

Sep 17, 2014

I have a code below that is reading large image size and writing them to file however the process is too slow. how can i refine this code in such a way that it will work faster?

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.HttpURLConnection;

[code]...

View Replies View Related

Java Streaming Project Getting Slow After Hosting

May 20, 2014

I am working on a Java Streaming Networking ( Client Serve ) project , among remote client can:

1 ) chat,

2 ) Share files,

3 ) Share Screen live streaming,

4 ) Access the remote system.

All are working well faster & live on networking. But if i host on the Hosting server the all process are working but in deadly slow streaming is not live..,

View Replies View Related

JavaFX 2.0 :: Slow GUI Response When First Displaying Controls

Jun 15, 2015

I have been using JavaFX for some time now and have encountered many performance issues, mainly with the initial display of GUI elements.  For example, a simple stage with a table view (with about 10 columns) and chart takes about 5 seconds to display.  A color picker will take about 3 seconds from the time I click the control to when it displays the pallet.  This only happens when the controls are first displayed.  This can't be right.  I have searched and none seems to have a similar problem so I thought I would ask here just to make sure.  Here is a sample Hello world that shows the problem with the color picker (takes ~ 3 seconds to show pallet when clicked). 
 
public class HelloWorld extends Application
{
    @Override
    public void start(Stage primaryStage) {
        StackPane root = new StackPane();
        ColorPicker cp = new ColorPicker();
        root.getChildren().add(cp);

[Code] .....

View Replies View Related

JavaFX 2.0 :: Slow Performance On Linux For Visual Effects

Mar 6, 2015

Visual effects such as Transitions perform very poor on linux "wheezy" compared to windows. I noticed this on different PC's, checked for Java7 and Java8. If the UI contains many objects then the transition sometimes does not even appear.
 
I do not think this is graphic card related since videos play quite ok.
 
I use the default ATI driver without Xorg.conf file and  installed the xcompmgr
 
and tried several options, such as
 
Option "Composite" "Enable"
or
Option        "backingstore" "true"   
Option        "AllowGLXWithComposite" "true"
 
This did not speed up things, are there other things that I could do to improve the performance ?

View Replies View Related

Networking :: Socket Creation Too Slow Versus URLConnection

Oct 27, 2014

I'm trying to write a transparent proxy like polipo. Polipo is written in C and I want to have the same result in java.
 
A simple program that can filter/monitor all connections created and closed by the browser.
 
To do so, I've chosen to work with sockets, because that's the only way i know to read and write raw data to and from the browser in a completely transparent way.
 
In this moment my code reads and writes every couple of request/response but I've noticed profiling it that the time needed to create the socket is a bottleneck.

Using URLConnection to create the same connection I need much less time than sockets.
 
When socket creation implies 50ms URLConnection implies only 1ms.

View Replies View Related

Servlets :: Fetch Data From Backend (DB2) And Export To Excel - Slow File Download

Jan 31, 2014

Recently we got an issue about file download. We are using below code to fetch the data from backend(DB2) and export to excel.

Before Jan 15 it use to take 2 minutes to download the file (2 MB size). But now its taking half an hour to download.

response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition","attachment; filename=Attendance_Report.xls");

We have restarted server, system but still problem exists. We found that there is no code level or data base level or network level issues.

Now we have to see server level issue. What are the factors which effects the file downloading at server level.
We are using websphere 6.1 ,java1.4

View Replies View Related

Moving A Map In A Game

Jul 22, 2014

I've been at this for a while and I would like to make the Camera in my game follow the player and I know the way to do this would be to move the map and not the player. How would I do this if my map is rendered from a text file using for loops. Here is my code for the map.

package Game;
import java.awt.Graphics;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Map {

[Code] .....

View Replies View Related

Moving Object In Y Axis

Jul 10, 2014

I just have one problem with a "car" program in java. The objective is to move the car in the direction it is facing. Moving forward in the normal position (when the angle is zero) means moving in the x-axis. Choosing to turn the car function (for example: 90 ) and then using the forward function should move up or down the car in the y-axis. However the y-axis is not working.

Car2 Demo.rar
JPGMoveforwardfunction.jpg

View Replies View Related

Moving Oval Around The Frame

Feb 3, 2014

I'm trying to understand and learn Java for GUI but I'm stacked around a project. I had done some other "test app" but on this, I can't figure out what I had done. I can't move my circle around the panel.... Where I had made some errors?

Main class
package main;
// imports
import javax.swing.JFrame;
import java.awt.Dimension;
public class Main {
public static final int WIDTH = 320;
public static final int HEIGHT = 240;
public static final int SCALE = 2;

[Code] .....

View Replies View Related

Moving Object In Java?

Feb 21, 2014

Basically I have a program that paints a simple object image. There are 5 of these objects altogether and different classes and methods have been set up to do this and this works correctly. The program currently also asks the user if they would like to change the colour of this object shape, and which shape they would like to change (user inputs a number 1-5) then the program will change the colour of this shape.

But the new task is for the user to input a number (1-5) to which shape they would like to MOVE position of. Hhow this would be done? Would there need to be different methods for changePositionX, changePositionY? The user needs to input the X and Y co ordinates and then this will move the selected shape to its NEW position in the current JFRAME.

View Replies View Related

Timer - Why Does Square Not Moving

Sep 7, 2014

Why does my program write that i have problem in Timer?

public class Ball extends JPanel implements ActionListener {
Timer timer = new Timer (3, this);
int x = 0, y = 0, aX = 2, aY = 2;
public void PaintComponent(Graphics g){
Graphics2D g2 = (Graphics2D) g;

[Code] ....

View Replies View Related

Error While Moving The Tiles In Frame

Jan 17, 2014

I was following a tutorial on how to make a game when i suddenly got an error concerning moving tiles. i get this error when i tried to use a and d to move:

Exception in thread "Display" java.lang.ArrayIndexOutOfBoundsException: 48600
at com.cherno.graphics.Screen.render(Screen.java:44)
at com.cherno.Game.render(Game.java:124)
at com.cherno.Game.run(Game.java:87)
at java.lang.Thread.run(Unknown Source)

I do not get the error while using w or s but the tiles are still not moving when pressing them.

I have three classes at work here.

The main, Game.java;

package com.cherno;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;

[Code] .....

View Replies View Related

Swing/AWT/SWT :: Moving Image Left Or Right

Mar 11, 2014

I can't find any resource on the net about a simple Java code just to move a gif image left or right. I've already accomplished the up, down, and center and they're working fine, thus, I'm still struggling with moving the image left or right. Here's the code.

public class MoveIt extends Applet implements ActionListener
{
private Image cup;
private Panel keypad;
public int top = 10;
public int left = 10;

[Code] ....

I remember in Visual BASIC it's easily achieved by NameOfImage.left = NameOfImage.left - 10 to move left and NameOfImage.left = NameOfImage.left + 10.

View Replies View Related

Application Crashes When Moving From One View To Another

Jun 6, 2014

So I've been working on a music player in android studio and I've created two java classes. One for Main Start Screen(StartScreen.Java) and one for the main player (player.Java). I have an onClicl event associated with a button as shown below.

public void onclick(View view) {
Intent detailIntent = new Intent(this, main_player.class);
startActivity(detailIntent);
}

The code for the second Java Class is as below. There is nothing in the java class as for now.

package com.example.musicplayer.app;
import android.app.Activity;
import android.os.Bundle;
public class main_player extends Activity {
protected void onCreate(Bundle savedInstanceState) {

[Code] .....

Where is the actual mistake because the app works fine until i click the button that is suppose to take me to the main player screen?

View Replies View Related

Moving Rectangle In Diagonal Line

Jul 24, 2009

I am just trying to move a rectangle in a diagonal line. When the applet pops up, the rectangle is there but doesn't move. If I drag the sides of the applet to make it bigger or smaller the rectangle will redraw itself and move, but I want it to move without touching the window.

Java Code:

package javaapplication3;
import java.applet.Applet;
import java.awt.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Random;

[Code] .....

Why does it only repaint when I resize the window?

View Replies View Related

Program Not Moving To The Next Line Properly?

May 14, 2014

I am trying to only allow the user to input numbers. But I need to enter a number twice before it moves to the next line statement and also skips a line when i enter th number a second time.

How can I go around fixing this.

My code for this is

case 1:
do{
Event event = new Event();
out.println("Please Enter the name.");
event.setEvent(input.next());
input.nextLine();

[Code]...

View Replies View Related

Java DLL - UnsatisfiedLinkError When Moving To Package

Jan 13, 2015

I have a class that works only when in the default package. If I move the class to a package I receive UnsatisfiedLinkError.

This is the class in the default package(this works fine):

[code]
public class CsharpConsumer {
    private native int reigsterAssemblyHandler(String str);
    public CsharpConsumer() {
            String dir = System.getProperty("user.dir");
            System.load(dir+"dllscardJNICsharpBridge.dll");
            int reigsterAssemblyHandler = reigsterAssemblyHandler(dir+"dllscard");
    }
}
[/code]
 
If at the top of this class I add "package DLLUtils;"

the error is "Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError:

DLLUtils.CsharpConsumer.reigsterAssemblyHandler(Ljava/lang/String;)I"

I tried a lot of things but none solved the problem. I must move the class to o package because I cant "import CsharpConsumer;" from default package.

View Replies View Related

Moving Object In A Frame - Code Not Working

May 7, 2014

I have made a code that should allowed me to move an object in a frame, using the arrow keys. But I don't know why, is not working.

package joc;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.ImageIcon;

[Code] ....

View Replies View Related

2D Side Scroller Moving Background In Java

Jan 18, 2014

I have been following a 2d side scroller tutorial in java and have got the basics working, I changed the code a bit to make it so that the tiles and background are always moving, this worked as i intended.Within the character class:

if (speedX < 0) {
centerX += speedX;
}
if (speedX == 0 || speedX < 0) {
bg1.setSpeedX(0);
bg2.setSpeedX(0);
 
[code]....

I wanted a way to make it so that if the character moves left, the tiles + background move slower. I am having issues with variable scope and setters/getters. Within the main game class, I have the code:

case
KeyEvent.VK_LEFT:
character.moveLeft();
character.setMovingLeft(true);
break;

How can i include an if statement within the tile class that reads whether the character is moving left (determined from a keyPressed event in the main game class) and adjusts the speed of the tiles accordingly?I want to write something to the effect of:

if (setMovingLeft = true){
speedX = bg.getSpeedX() * 3;
tileX = tileX + speedX - 1; << changed from - 4

View Replies View Related

Java Game In Eclipse Mouse Not Moving

Apr 24, 2015

try to make a game in this code i am trying to make the basics i have made a mouse it should move the game code is

import java.applet.Applet;
import java.awt.*;
public class Game extends gameLoop {
public void init()
{
setSize( 854 , 480);
Thread th = new Thread (this);

[code]...

View Replies View Related







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