hey Im trying to make a game of pairs (the memory game) i have set up a grid which displays a graphic for the card back. im trying to link the edit menu to choose the graphic to be displayed. i've set up a string variable called deck which will contain the path to the required image. and actionlisteners DA and DB corresponding to which style is choosen in the menu. I had to declare the deck to some initial image so it can load.
How do i impliment...
User Profile
Collapse
-
Please Help! Changing a graphic via a menu with listeners
-
resizing a graphic inside a JPanel
Hi
I've set up an array of Jpanels in a grid layout. im trying to insert a graphic into each panel using a loop. i can get the graphic in but it sits in the bottom right of each panel, and i've tried setting the layout and the size but nothing happens.
Is there any way which i can set the graphic to be the same size as the JPanel, so when i resize the window the graphic will resize automaticaly.
Any ideas??... -
Ah i see. that worked a treat..thank you
Niall... -
Sub menu in a GUI
Does anyone know how to crewat a submenu? i've got a menu with several items and i want to split it into submenus but cant find a way to do it.
Any suggestion are welcome
Thanks in advance! -
hey thank guys, i managed to do it here wot i did
...Code:public void actionPerformed(ActionEvent event) { String source = event.getActionCommand(); if(source.equals("A")) { newGame(4, 3); } if (source.equals("B")); { newGame(4, 4); } if(source.equals("C")); { newGame(5,Leave a comment:
-
i mean if i had a button in the initial frame class how do i get it to open a new grid frame with a variable size? on the first screen there is three buttons each of which will open a new frame with a grid size depending on which button is pressed.
heres the code for the first window..the A B and C buttons will open new frames.
...Code:import javax.swing.*; import java.awt.*; import java.awt.event.*; import
Leave a comment:
-
action listener and linking classes Please help!
i've just started using java and im trying to develop a GUI that will play a game. i have a start screen with some Jbuttons. The button represent 3 sizes of the game grid, when these are pressed i want a a new frame to open ith the game grid. i've already writen the class containing the game grid, and need to know how to use the actionlistener to relate the initial class to the new class. Also depending on which button is pressed, will change the... -
heres the info i recieved about the question:
The purpose of the EventQueue class is to store all the events that "haven't happened yet" (according to the simulated current time). The events are taken out of the queue in order of increasing time. Here's a starting point for your class:
EventQueue.java
The EventQueue class stores events in an array which is bigger than is needed. For now, you...Leave a comment:
-
hey sorry bout not using th [code] tags. im new to this and didnt know how. I had considered using a tree structure but the question does state the use of an array. I think its more an exercise in manipulating the array resizing and sorting etc.
could you tell me how to add a new event to the array? pleaseLeave a comment:
-
Event Queues
im trying to write a program that store a binary tree of possible events in an array. i need to be able to sort the the Events in the array based on the previous event that caused it by the time which they will occur. After the specific time has passed the event will be removed and all other events will be bumped up, all the while new events will be added to the end and sorted by their time.
Please Help
heres wot i've...
No activity results to display
Show More
Leave a comment: