All Questions
Tagged with cardlayout java
521 questions
0
votes
0
answers
82
views
Switching JPanels in a CardLayout using buttons inside the panel itself
I am trying to create a simple Java program with GUI, using Swing as the primary tool. I've trying to use CardLayout to handle switching "screens" (panels) within the same Frame and while ...
-1
votes
1
answer
133
views
How to switch from a JPanel to another
I'm developing a game, written in java swing.
I create a class MainGUI that extends JFrame, to contain the multiple screens of the application. In other classes, I create different JPanels, like ...
1
vote
1
answer
51
views
JPanel CardLayout causes visual glitch between swaps
I am trying to create a JPanel with a CardLayout that switches between a menu and a forum when a button is pressed, but I am encountering a visual error where elements of the menu are still displaying ...
-1
votes
1
answer
67
views
Java cardlayout setting focus on a panel so key listener will work in another class
I have an issue using Keylistener so I can have things move around on the screen, for now I just make so it print out text so it shows that it works.
The issue is that nothing happens when I press the ...
0
votes
0
answers
23
views
Java cardlayout performence issues, is it the code or caused by something else? [duplicate]
So in my previous question I was informed of cardlayout and I tried to implement it in my code but I am having quite severe issues running the code. I am running Linux mint and visual studio code if ...
0
votes
0
answers
52
views
How to switch JPanel with buttons on each individual panel?
I'm new to Swing and I'm trying to figure something out. I'm having difficulty explaining what I'm trying to do and I can't find anything online so I wrote a program demonstrating what I want to have ...
1
vote
1
answer
197
views
Attempting to change grid size based on which RadioButton is selected - Java Swing GUI - SOS board game
This project revolves around a game that is a variation of TicTacToe called SOS. One of the requirements is that the game grid needs to have two size options. The smaller grid is 5x5 and the larger is ...
1
vote
1
answer
3k
views
Adding to specific position in grid layout in (java swing)
public static void main(String [] args) {
JFrame frame = new JFrame();
JPanel panel= new JPanel();
panel.setLayout(new GridLayout(4,1));
...
0
votes
0
answers
93
views
Java Card Layout only shows the first panel
Hi sorry if this has already been posted but my code doesn't work as it should. I am new to java programming and would like someone to point me in the right direction on how I could change to desired ...
1
vote
2
answers
79
views
GUI components not aligning vertically inside JPanel in Card layout
Image of my GUI.
I am trying to add components to two JPanel containers and then add those panels as cards. I want the checkboxes after labels in a vertical manner. The problem I am facing is that the ...
0
votes
0
answers
158
views
MVC pattern with CardLayout
I have a Java Swing application with a single large class that via CardLayout replaces the various JPanels based on the various buttons. Each JPanel is built in its own class. I would like to divide ...
-2
votes
1
answer
41
views
I'm having issues with CardLayout and one of the JPanels not receiving Keyboard events
I will only supply the relevant parts of the code as it is quite large. Help me figure out why I never get keyboard events to the GameBoard JPanel. The game code runs just fine until I added the new ...
0
votes
1
answer
485
views
How do you add a JPanel from another class to a panel with CardLayout?
I'm working on a group project and I'm the one making the GUI figuring it'd be good to practice with it. The program is supposed to be a pizza ordering system (pretty standard stuff) and what I'm ...
1
vote
1
answer
190
views
Switch Case In ActionPerformed?
Ive gone through some stack overflow questions and found this similar question.
From what I understand using a switch statement in an actionPerformed method for this context will not work and an if-...
0
votes
1
answer
55
views
JTextField doesn't appear after switching panel using CardLayout
i have 4 panels associated to a content panel which uses a card layout. If i try to switch between the cards by using the buttons, i can see the JLabels but no JTextFields. I assume they are there ...
0
votes
1
answer
712
views
Java Swing: Separating the GUI of each screen into separate files/classes
I'm still a newbie in Java Swing, which we have been learning for a class, and I'm doing this for a small project.
So this is kind of what the GUI is like [without the specifications and design] when ...
0
votes
1
answer
337
views
How do you choose a specific card in Java CardLayout?
I am using a card layout as a refreshing element on a JFrame and want to switch to a specific card after the user selects a button. Is there a way to call a specific card in the CardLayout on an ...
0
votes
0
answers
51
views
JButton does not go to next card
I need to switch between multiple panels using a JButton, the fist panel works properly however the button doesn't switch to the other panels.This is the main class with the Cardlayout and the button ...
0
votes
0
answers
55
views
How to switch between two JPanels without CardLayout?
I build a game in swing and I have two JPanels for menu and the game itself. I want to switch from the menu panel to the game panel and from the game to the menu using JButtons. but every time I ...
0
votes
0
answers
124
views
CardLayout Button and TextField Size
I'm trying to fix the size of the text fields, text area and buttons using CardLayout. Currently, they are too big and I want to reduce their size to a more normal size.
So far I have had no luck. My ...
0
votes
0
answers
58
views
How to use CardLayout with JPanels being created in different classes?
I am trying to create a simple Java Swing GUI application. I basically want a main menu with buttons that will display the rules and the games. Say I have 3 classes: Menu, Game, and Rules. Now, I want ...
0
votes
1
answer
149
views
Why isn't the first panel showing in my cardlayout
Sorry for the code dump but Im not sure where is causing the issue. When I click the Round Robin button its supposed to take me to the RoundRobin page (which it does) but then I should be able to ...
1
vote
0
answers
219
views
Getting a NoClassDefFoundError while implementing a TabLayout with fragment and inside that fragments wanted to use a recycler view
Wanted to have a tablayout Activity called from home activity's option menu and my tablayout which is having a fragment for different offers which is to be provided in form a card layout with help of ...
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
1
answer
737
views
Java ActionListener not working but no errors
So, I have been trying to learn how to work with WindowBuilder for the last month. I have watched a few YouTube videos especially about CardLayout, but my buttons don't seem to change the panels.
I'm ...
4
votes
1
answer
56
views
Redraw strings in CardLayout
I have made a game using CardLayout and have one JPanel for the leaderboard. In leaderboard, I read two files (one with names, one with times), sort them and draw the top 5 fastest times like this:
...
0
votes
0
answers
31
views
Setting up CardLayout
I am trying to making a game using CardLayout but can't figure out how to do it. I get the error:
incompatible types: CardLayout cannot be converted to LayoutManager
c.setLayout(cardsL);
...
0
votes
1
answer
344
views
Why the show method of card layout doesn't work in this case?
I am trying to switch between different panels using JComboBox and CardLayout but any switching doesn't occur. Printing the ItemSelected was revealed that ItemListener is working correctly and also ...
0
votes
1
answer
166
views
CardLayout - Won't switch back to the first Panel
I make'd a simple program, almost works everything, except the back switch to the first panel.
So, if I click on the "Druck" button, it will transfer money from a bank account to another bank account, ...
1
vote
1
answer
62
views
Is good to use a CardLayout to switch between a login pane and a working pane?
I'm learning Swing. I have a JFrame which JPanel containers - layout is a CardLayout. Right now, when you fill the user and password fields, the panel switches and the "working" one is displayed.
I ...
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
2
answers
353
views
How to leave MouseListener on ChildComponent but correctly keep track of mouse enter and exit on parent?
I have a JPanel with a CardLayout and two cards. I want the layout to flip the cards each time the mouse enters or exits the panel.
This works fine unless one of the cards is a component that listens ...
4
votes
1
answer
531
views
CardLayout's Show Method Not Doing Anything
So I just started practicing CardLayout, but I can't seem to get it to work. I look at over 10 sites, and I seem to be doing the same thing as them, but for some reason my version isn't working. The ...
0
votes
1
answer
323
views
JAVA SWING - Creating Animation using Swing Timer
I am trying to setup a program that enables the user to display a transition when clicking the next and previous button. When pressing next, the swing timer should trigger and start the animation. ...
0
votes
1
answer
211
views
GUI Card Layout- Action Listener not working [duplicate]
I only have the first button set up to work. It was working fine until I updated panel one to have additional panels (oneTwo,oneThree, etc.). I did this because I have to make the program look like ...
3
votes
3
answers
2k
views
CardLayout - How to Delete current card (Java Swing)
How would one delete the current card that the user is on. I know how to go through a card layout using the next and previous function, but how would one remove the current frame that the user is on? ...
-1
votes
1
answer
69
views
JComboBox showing only if it has a single item
I have a JPanel with a CardLayout and a JComboBox inside it. They are dinamically filled with data taken from a JTable. If the JComboBox has a single item it shows just fine, but if I fill it with ...
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
18
views
How to properly implement a CardLayout on abstract parent class [duplicate]
Im trying to dynamically change a JPanel containing a form, as the user clicks different tabs the JPanel should present different forms fields.
I've Read the best way to implement dynamic changes ...
0
votes
0
answers
22
views
Program "freezing" after pressing start button Java [duplicate]
I'm trying to implement a start button that when pressed brings the user to another page where you can play a simple game. However, each time I press the start button, the program does not run ...
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 ...
0
votes
0
answers
50
views
Switch Between JPanels With Use of JButton?
Trying to make flashcard application. The JButton b_switchmode will be used to switch between panels (an edit mode and a test mode, both have panels created for separate use). Not quite sure how to go ...
0
votes
1
answer
396
views
How do I switch between panels using a CardLayout?
I have made a parentPanel that has a CardLayout on it, and under this I've made 4 more JPanel containers.
On the left side I have 4 buttons that when I press "Forside" (button) I want to switch to ...
0
votes
2
answers
133
views
Graphic Not Appearing on CardLayout
I'm building a GUI that uses a CardLayout to switch between screens. I want one of the screens to have a graphic on it. I've successfully been able to put a rectangle onto a panel with a GridLayout, ...
0
votes
1
answer
244
views
How to Count Number of Cards in a CardLayout
I have a JPanel which uses a CardLayout to have a number of pages, and to make a progress bar that fills up as pages are defined, I would like to count the number of cards added to my CardLayout. Is ...
0
votes
1
answer
218
views
Understanding CardLayout and panel visibility
Consider the following:
JFrame frame = new JFrame();
frame.setLayout(new CardLayout());
JPanel panel1 = new JPanel();
panel1.setPreferredSize(new Dimension(1000, 1000));
panel1....
0
votes
1
answer
42
views
CardLayout button changes after 6 clicks
I am trying to create a quiz. The quiz starts by reading a file. The file has 6 questions. Each question gets its own card in the cardlayout. Each card has a button to the next CardLayout. Questions 1 ...
-1
votes
1
answer
588
views
How to make panel fit parent in card layout?
I have a JFrame with CardLayout that contains 2 JTappedPane components and 2 JPanel and a side panel with buttons to control switching between panels in the card layout, my problem is when I switch ...
0
votes
0
answers
224
views
Why pack() is not resizing both ways (size up and shrink) - Swing
I have a GUI with a JFrame with a JPanel that is being switched with a CardLayout manager. The code is this one:
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util....