Questions tagged [cardlayout]

A CardLayout is a graphical layout manager for a container. It treats each component in the container as a card. Only one card is visible at a time, and the container acts as a stack of cards.

A CardLayout is a graphical layout manager for a Container. It treats each component in the container as a card. Only one card is visible at a time, and the container acts as a stack of cards.

For Java Swing, see How to Use CardLayout.

562 questions
5
votes
3 answers

Change Panel size on button click

I have the following code: package in.res.num.tapb.ui; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import…
Tapas Bose
  • 28,796
  • 74
  • 215
  • 331
5
votes
1 answer

CardLayout with different sizes

Well I'm having some troubles by making a CardLayout with different sizes on each card. After reading The Use of Multiple JFrames: Good or Bad Practice? I noticed I was doing things in a way that is not the apropiate, so I decided to start learning…
Frakcool
  • 10,915
  • 9
  • 50
  • 89
5
votes
2 answers

Can I set the size of individual panels in a CardLayout?

When I create my GUI I use a cardlayout to hold my different panels as I'm sure many know. This sets my screen to the width and height of my largest panel. This causes problems with the aesthetics of my first to screens, which are much smaller than…
David Parsonson
  • 585
  • 6
  • 23
5
votes
1 answer

How to wait for a JFrame to close before continuing?

My program consists of 3 main 'sections'. Main function, Login form and App form. The main function should do something like: Open Login form, wait for it to close, then open App form. I can't get the waiting part to work, or rather, I don't know…
argoneus
  • 1,097
  • 2
  • 13
  • 24
4
votes
2 answers

Adding JPanels from other classes to the cardLayout

I've got 3 windows in 3 separate classes and I would like to use cardLayout so that when you click the next button, the next window will appear. How do I add JPanels containing different elements to one cardLayout? This is the first window: (the…
Hurdler
  • 891
  • 3
  • 15
  • 30
4
votes
1 answer

Is there an equivalent to the Swing CardLayout in the Qt Framework?

I am designing an Application using the Qt framework, and I want to avoid using multiple dialogs simply because I think it can get messy with having many dialogs open. I was wondering if there was something like Java's CardLayout in the Qt…
W.K.S
  • 9,787
  • 15
  • 75
  • 122
4
votes
2 answers

CardLayout not working properly

I have written this simple Cardlayout example with Splitpane, Combobox and few other panels containing buttons and label. import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Container; import java.awt.EventQueue; import…
kdev
  • 291
  • 1
  • 8
  • 21
4
votes
1 answer

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: private void setBoard(){ reset(); …
Faiq
  • 41
  • 7
4
votes
1 answer

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 next() method is working fine, but calling show()…
user12447991
4
votes
2 answers

CardLayout - making it take the least amount of space necessary

All, I have a form type view I'm creating in Java. Based on the contents of a combobox, I need to switch some aspects of the form. I am using a cardlayout to do this, and it works fine. The problem is that cardlayouts use the maximum of all…
I82Much
  • 26,901
  • 13
  • 88
  • 119
4
votes
1 answer

Java: CardLayout switching between cards

I've got class 'Frame' which extends JFrame and separetad JPanels: MainMenu and SinglePanel I am using CardLayout, but I've got problem when switching back to panels using buttonSingle and powrot buttons. So my question is how can I change/swap…
TOM-12
  • 65
  • 1
  • 1
  • 10
4
votes
1 answer

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 JPanels by clicking the buttons. When I click…
khaled
  • 43
  • 1
  • 1
  • 5
4
votes
2 answers

Card Layout get the current card string

i'm using cardlayout in application and want to get the name of the current active card i tried many methods but with no mean, for example this method seems to be no longer exists panel.getLayout().getActiveItem() also i tried this but it doesn't…
Eslam Hamdy
  • 7,126
  • 27
  • 105
  • 165
4
votes
1 answer

Passing data between classes in CardLayout

Please have a look at the following code WizardPanel.java package wizardGUI; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class WizardPanel extends JDialog { private JPanel cardPanel, buttonPanel; private…
PeakGen
  • 21,894
  • 86
  • 261
  • 463
4
votes
3 answers

Switch to specific JPanel using Cardlayout

I've started working on a Java desktop application using netbeans. I have 7 different screens and to represent them I am using JPanel. One JPanel to represent each of them and one to contain all of them(named as mainPanel), which is inside a JFrame.…
moCap
  • 969
  • 1
  • 14
  • 31
1
2
3
37 38