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
3
votes
4 answers

JFrame whose content changes as we click on the different buttons

I am using Java's Swing here to make a UI application. I have a created a JFrame, with some buttons. When I click on this button, I want a new JFrame with some different content at this place. However, I do not want a new JFrame to load here. One…
OneMoreError
  • 7,518
  • 20
  • 73
  • 112
3
votes
1 answer

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.*; public class CardLayoutDemo implements…
Logic-Seeker
  • 57
  • 2
  • 10
3
votes
1 answer

Resizing a JPanel inside a JFrame

I am new to Java, started learning swing and have a problem with resizing a JPanel inside a JFrame. I am following this tutorial: http://vincentramdhanie.blogspot.com/2009/11/cardlayout-with-netbeans.html because ultimately I am learning each of the…
Matt
  • 6,787
  • 11
  • 65
  • 112
3
votes
1 answer

Why are the cards not appearing on JPanel CardLayout?

My application consists of two JPanels that will be cards on a MainPanel. The code is as below. For some reason, the panels don't appear. I'd be very grateful for your help :) MainPanel.java: public class MainPanel extends JPanel{ private final…
W.K.S
  • 9,787
  • 15
  • 75
  • 122
3
votes
2 answers

CardLayout in Java change by action in one of the 'cards'

I am making a simple game using a JFrame. I have made a simple "Start" screen which basically consists of a String and a JButton. I am picking up the button click with the actionPerformed(ActionEvent e) method. I don't know how to change the cards…
imulsion
  • 8,820
  • 20
  • 54
  • 84
3
votes
2 answers

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 containing the panel names. I have been debugging for a…
Rick Slinkman
  • 643
  • 10
  • 23
3
votes
4 answers

How to Integrate Multi-page Java Desktop Application from Multiple GUI Classes

I am working on a Java Swing desktop application project. The application has about 15 GUI pages. I can use Layered Panes and Tabbed Panes to put all the GUI components in one class. But that class will be huge. It would be idea if I can divide…
David
  • 149
  • 2
  • 3
  • 8
3
votes
1 answer

how to show next Card Item using CardLayout?

I have created a class which has a panel named cards and its layout is CardLAyout. I have added card items. In this class I want to create a separate method by calling which, layout switches to next card. import java.awt.CardLayout; import…
Sourav Ganguly
  • 329
  • 2
  • 14
3
votes
1 answer

Java switch between cards using jbutton

I'm using a cardlayout and I want to make it so that the first card has a button and when clicked it will take it to card 2 which has a button that will take it back to card 1. Here is my current code, and I've tried putting a few things in the…
Jarod
  • 157
  • 2
  • 4
  • 12
3
votes
3 answers

Make an added JPanel visible inside a parent JPanel

How to make an added JPanel visible inside a parent JPanel? I am using Netbeans for designing my UI. I have a MainFrame.java, which contains two panels; namely headerPanel and bodyPanel. In headerPanel I have put three buttons,let it be button1,…
Abhinav
  • 1,720
  • 4
  • 21
  • 33
3
votes
2 answers

Cardlayout draw

I made a former post explaining a problem I had drawing a image in a cardlayout. I received limited help and did not solve the problem. So I am making this post explaining it again hoping for some valid help. I am trying to make a title screen for…
2
votes
4 answers

What can be used to restrict navigation from panel to panel in a java cardlayout?

I have two cards in a cardlayout and a button that allows one to go back and forth. How can I make the button inactive once it is clicked once so that the user can't go back to the previous card?
Maydayfluffy
  • 427
  • 1
  • 7
  • 16
2
votes
2 answers

How do I show text field value of one card to other card on CardLayout Swap

I'm trying to display user name on the next card after user logged in, and having no luck. I'm using CardLayout and have defined two cards - one card for user to input name & password and 2nd to display welcome message with logged in uner name. I'm…
2
votes
3 answers

Overlap JPanels with WindowBuilder for eclipse

I am using WindowBuilder Pro for eclipse, and I would like to have two Jpanels that perfectly overlap each other. I would then be able to toggle their visibilty based on the selection of a combox box. When I try and acheive this in the gui builder,…
pingu
  • 8,719
  • 12
  • 50
  • 84
2
votes
1 answer

Java swing card layout - show function

I'm using the card layout to create my app, 2 of my cards are shearing the same information (in one you enter data to textarea and in the other the data is printed). The data is been saved in the Frame. I have added a refresh function to the second…
guy ergas
  • 135
  • 3
  • 10