Ok so I'm not Java expert but I'm just programming this java applet game for fun to test my skills. the hardest part so far has been blocked tiles and coming on and off new maps. Anyways, my current game is located at http://mystikrpg.com/jrpg I know, the design is really really simple and bland but I plan on changing that later. They ar...
OK let's say I have this array:
public int[][] loadBoard(int map) {
if (map == 1) { return new int[][] {
{2,2,24,24,24,24,24,1,3,0,0,0,1 }, {
2,2,24,23,23,23,24,1,3,0,0,0,1 }, {
1,1,24,23,23,23,24,1,3,3,3,3,1 }, {
1,1,24,24,23,24,24,1,1,1,1,3,1 }, {
1,1,1,1,7,1,1,1,1,1,1,3,1 }, {
6,1,1,1,7,7,7,7,7,1,1,1,1 }, {
6,3,3,1,3,3,3...
I'm writing a Swing application that needs to function either as an applet in a browser or as a standalone application, i.e. it may be contained in either a JFrame or a JApplet.
In this context, I'd like to display a custom modal dialog box to the user (i.e. a complex dialog with a custom layout and logic, not just one of the simple JOp...
I am trying to fix a array problem where it stores images into arrays so I don't have to do it individualy.
Here my code:
tiles = new Image[NUM_TILES];
for (int i = 0; i < NUM_TILES; i++) {
tiles[i] = getImage(getClass().getResource(String.format("tiles/t%d.png", i)));
}
weapon = new Image[2];
for (int xi = 0; xi < 2; xi++) {
...
Sorry asking so many questions but believe me.. I tried Google first. :)
When you use the g.drawImage in paint() on an Applet... is there a way you can remove it? What I mean is remove the image that was drawn.
...
I am not good with GUIs or User Interfaces in Java.
Would a Border or JPanel be good for something like the image below?
So, what would be the best option for me? Thank you.
...
I have this applet and within that applet it's within a Borderlayout. Anyway, I'm using KeyEvents on the applet and I make sure the focus stays on THAT by using
this.setFocusable( true );
ok, so i can move around using keyevents. However, if the user ACCIDENTLY clicks on the textarea... there is no more way to go back to the screen...
I'm trying to make a 4x5 Grid within a JPanel that is on a BORDERLAYOUT in EAST... soo here is pic:
Here is the code:
setLayout( new BorderLayout() );
JPanel invOne = new JPanel(newGridLayout(4,5));
JPanel game = new JPanel();
add("Center",invOne);
add("East", game);
add("South", c);
for (int i = 0, j = 2...
OK so I have this applet thats like this
BorderLayout.CENTER - (Within this is JPanel)
BorderLayout.EAST - (Within this is a new GridLayout (4,5)
BorderLayout.SOUTH - (Within this is a TextArea)
Anyway, on the applet, I have to HOVER over the buttons to see them. They don't paint there I guess but I'm adding them in the init() metho...
I want to be able to insert a Java applet into a web page dynamically using a Javascript function that is called when a button is pressed. (Loading the applet on page load slows things down too much, freezes the browser, etc...) I am using the following code, which works seamlessly in FF, but fails without error messages in IE8, Safari...
I just had this error message from one of my users. (IE8, Java 1.6.20 ). It is from an applet which receives instructions from Javascript and executes certain processes on the client.
RangeError
java.lang.RuntimeException: ERROR: Failed to recover corrupt cache entry
at com.sun.deploy.cache.CacheEntry.recover
at com.sun.deploy.cache.Cac...
Can you add an Image to a GridLayout?
...
OK so I'm trying to output the current string from an array that was put into a list...
However when I click on the list I get a NullPointerException... :\
Help? :)
import java.applet.Applet;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class lisTry extends JApplet implements MouseListener {
public static...
OK so I have a JList and the content is provided with an array. I know how to add elements to an array but I want to know how to refresh a JList... or is it even possible? I tried Google. :\
import java.applet.Applet;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class bs extends JApplet implements MouseList...
Is there a way to implement a KeyListener and MouseListener in the same applet? I already tried any ways I thought that would work and I tried Google. :\
my try:
C:\Users\Dan\Documents\DanJavaGen\tileGen.java:23: tileGen is not abstract and does not override abstract method mouseExited(java.awt.event.MouseEvent) in java.awt.event.Mouse...
OK so I'm doing an ArrayList into a (awt) List and I'm getting the following errors when compiling.
C:\Users\Dan\Documents\DanJavaGen\ArrayList_INV.java:29: cannot find symbol
symbol : constructor List(java.lang.Object[])
location: class java.awt.List
list = new java.awt.List(arr.toArray());
^
C:\Users\Dan\Docume...
Simple question: How to change a background color of a Java AWT List? By that I mean the list ITEM *not* the WHOLE list.
SO > Google
:)
...
On every JList I've made... I've had to CLICK on it before ANY of the JList would show up. It was like... invisible but still there... UNTIL I clicked on it...
I have tried list.setVisible(true) and such... but no luck. :\ Help? Yes, I tried the Javadoc, Google, AND SO Search. >_< I have never encountered a problem like this.
Code:
i...
Hi all,
I have been using Stackoverflow for a while to find solutions to my programming questions, but for the current question I haven't found a useful solution. So I joined up.
What would be a good solution to limit a Java applet to only one instance. I'm using php to serve the applet to the end user, so that would be an option.
But...
I am creating a socket connection with an unsigned applet to a different host and I'm getting java.security.AccessControlException: access denied
If I sign this applet with either "self-cert" or "CA cert" does the applet gain the permissions to create a socket connection to a different host (not the same host it was downloaded from) and...