All Questions
31 questions
0
votes
0
answers
36
views
Can Card Layout show Card Layout
I'm learning how to use CardLayout right now and I've found out that my project could use a possibillity of inserting CardLayout into CardLayout. As I've learned I can set any JPanel or container as a ...
0
votes
0
answers
59
views
How to add back and next button for CardLayout?
I want to add a 'back' and 'next' button for my gui but it doesn't seem to work. It feels like I'm missing something important in my code. I tried using cl.next(ImagePanel); but the method is not ...
1
vote
2
answers
215
views
wrong parent for CardLayout in java
I want to change cards in my CardLayout (which contains labels) for every choice in my combo box. So when I select Item2 in the combo box it should show the second card but it returns error instead.
...
0
votes
1
answer
487
views
How to make TextArea and list fill panel?
I am creating a java chat application and am having issues with a TextArea and a list in the client GUI. I am using a cardlayout to have the login on one panel and the chat on another.
For some ...
0
votes
0
answers
259
views
How to divide a panel into 2 panels by using cardLayout?
I tried to divide a big panel into 2 panels and display them in the big pannel but it didn't work..However, when I played the program, it just showed last panel, even though the 2 panels are set to ...
1
vote
1
answer
1k
views
Java Card Layout with Background Image
I am creating a Flight Reservation system for a project, having trouble with the GUI of the app. I am using a CardLayout to manage the multiple cards for this program.
In the login card I am trying ...
0
votes
0
answers
75
views
JFrame doesn't respond to pressed keys after switching JPanels in CardLayout
I'm new to java and I'm trying to create a Space Invaders game as my first "bigger" desktop project. Currently I've added some design patterns to Space Invaders Tutorial, but I've been trying to add a ...
0
votes
1
answer
226
views
JMenuBar doesn't show when switching Cards in a Cardlayout
I'm working on a Java desktop Application that uses multiple Jpanels as cards in a CardLayout, the problem is that when I switch between the cards the JmenuBar disappears totally or just parts of it.I ...
0
votes
1
answer
1k
views
Using CardLayout for multiple JPanels and nothing displays
I'm making a simple (and bogus) computer power consumption calculator. I'm using a card layout to put multiple panels in but when I run it, there's just a small window not displaying anything. Here's ...
-2
votes
1
answer
45
views
CardLayout, how to let it work?
When I run this program, there is nothing in the applet. No labels, no buttons, no anything. I don't know how to use CardLayout but it seems that this is the only way to work my program, so help ...
0
votes
1
answer
88
views
Attempting to get cardLayout to work
All I am trying to do is set up a card layout style buttons. In theory you are suppose to click the button and another (in this case) name is suppose to come up until finished. (when user is to close)
...
1
vote
1
answer
137
views
CardLayout syntax // .add()
From following code snippet which I taken from CardLayoutDemo.
final static String BUTTONPANEL = "Card with JButtons";
final static String TEXTPANEL = "Card with JTextField";
-
//Create the panel ...
0
votes
0
answers
53
views
Show a panel in CardLayout in Java
I wrote the following code for showing three panels depending upon which of the three buttons is clicked which are at the bottom.
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt....
0
votes
1
answer
77
views
Using card layout, cards not swapping?
I want to keep my Controller panel as type JPanel as I will be incorporating into a tab later, I want to swap between Main and NextPage using buttons on those specific screens, I don't want to have ...
0
votes
0
answers
148
views
Java KeyListener events sleep for a while after resuming a game
I use a KeyAdapter class for a character movement in a game. Here is a code of it:
public class Keyboard extends KeyAdapter{
private Game game;
public Keyboard(Game game){
this....
2
votes
1
answer
815
views
Java Card Layout. One component in multiple cards
Can one component (e.g. a JLabel) be in multiple cards using CardLayout?
Currently it seems that the component appears only at the last card it was added to.
If there is a way to do this, should I? ...
0
votes
4
answers
2k
views
How do I handle null pointer exception in java applet?
I am running a simple applet in my machine.Note that when executing applet "Null pointer exception" error occurs when the applet is trying to run. The below code is shown
import java.awt.*;
import ...
0
votes
2
answers
2k
views
Change Background and size of panels in card layout
I have some panels in a card layout container (no idea if that is correct terminology). I can't find a way to set the location, or size of these panels inside the container. I tried setBounds and ...
0
votes
1
answer
190
views
CardLayout didn't display JPanel
I'm doing a form for a database and I want to use the CardLayout.
I explain the situation : the user have two choices : either he connects to his accoun or either he's new and he need to create an ...
-1
votes
1
answer
313
views
ListSelectionListener and CardLayout
I'm creating a program that reads data from a file, displays it on a GUI that has a JList and JButtons. I am trying to write it with CardLayout so the appropriate JPanel can be displayed when an item ...
4
votes
1
answer
13k
views
CardLayout, switch between JPanels by ButtonClick
I want to switch between JPanels by clicking buttons on the JPanels.
For example:
I have a JPanel sim with a JButton simknop and a JPanel help with JButton helpknop
I want to switch between these 2 ...
1
vote
1
answer
292
views
Lazy initialization - test if CardLayout has a specific panel added to it
I have a list box with a list of strings. Based on the string selected I need to display a group of text boxes below. My approach is to create a JPanel for each set of text boxes and then put all ...
2
votes
2
answers
839
views
CardLayout using JMenu sending error messages
Hi guys I wanted to create a simple program where I can control each JPanel by using menuItems. For example if I select File->New where New is JmenuItem it will show a JPanel named newPanel. Also if I ...
3
votes
1
answer
4k
views
Positioning component inside card layout
I have a main frame where i want to display object of my NewUser class in center position using card layout.Here is my main class
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
...
0
votes
1
answer
4k
views
Java - CardLayout show() IllegalArgumentException
I have a problem with the CardLayout show method
So I declare my CardLayout and apply it to my JPanel
CardLayout cl = new CardLayout();
panel.setLayout(cl);
Then I add a 2 panels into the ...
3
votes
2
answers
3k
views
CardLayout not working
I'm working on a little game where users login. After you have logged in, you will be able to go to the main menu. I am using a CardLayout which is not working. There are a few final Strings ...
1
vote
2
answers
1k
views
Java can a GridBagLayout be used to organize a JPanel used in a CardLayout
I'm new to layouts and what I'm using now is a CardLayout with two different cards that currently have a background image painted on and a button. As seen below, the button is at the top of the ...
0
votes
2
answers
3k
views
Navigating between multiple panels
Can anyone tell me how to go about coding for navigation between multiple JPanel classes taking the event trigger from JButton from the objects (panels) themselves? I have read about CardLayout. The ...
1
vote
2
answers
4k
views
Using CardLayout in Java
I'm currently trying to make a game with a menu.
Menu looks like this.
http://puu.sh/xGoC
Ideally, when I push a button, it will bring me to the game.
The game looks like this.
http://puu.sh/xGoV
I ...
1
vote
2
answers
864
views
I get NullPointerException using CardLayout
Hey guys I'm trying to make a GUI which can navigate through JTextAreas when a Next or Previous button is pushed. I'm using CardLayout to switch between the JTextArea. I can get the program to compile ...
13
votes
4
answers
11k
views
How to get the top card in Java's CardLayout
Is it possible to get the top card in Java's CardLayout?
I've tried looping through each component to check for visibility with isVisible() but it seems that they're all "visible".
Edit: By "top card"...