java - Trying to add a JPanel that uses CardLayout to a JFrame -


I can not make a mistake, when I get it, I get a blank frame

I try am are 4 buttons at the first screen that you see where to make an applet, each sorting to be implemented I algorithm, once it is clicked the button, you are taken to a new panel In which an array is a graphical representation (I Initiative Already has a small Aepplet)

Here is my code:

  import java.awt. *; Import java.awt.event.ActionEvent; Import java.awt.event.ActionListener; Import javax.swing *; Public Class Nukleauttest Jepinel (private Jepianel holder, panel, bubble Ponel selection panel, Mrgpanel, Kvikpanel; private Jebtn Bubble Buttons, Cynbtn, Mrgbtn, Kvikbtn; private Kardleaut card layout = new Kardlaut (); public Nyaleauttest () {J label = new Jeelab ( "labels"), holder panel = new Jepinl (); Mukypanel = new Jepinl (); Bblpanel = new Jepinl (); SelectionPanel = new Jepinl (); Mrgpanel = new Jepinl (); Quickpanel = NY Received Jepinl (); HolderPanelksetLayout (CardLayout); bubble button = new Jebtn (); Cynbtn = new Jebtn (); Mrgbtn = new Jebtn (); Quickbutton = new Jebtn (); // Manpanelksetleaut (new grid layout (2,2)); mainPanel.add (bubbleButton); mainPanel.add (selectionButton); mainPanel.add (mergeButton); mainPanel.add (quickButton); bubblePanel.add (label); holder Panel.add (Mukypanel " 1 "); holder Panel.ad (Bblpanel," 2 "); cardLayout.show (holderPanel," 2 ");}}  

and controller classes:

  import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.SwingUtilities; Public Class Test Control Extends JFrame {/ ** * * / Private Static Last Long Serial VERSIONUID = 1 L; Public Static Zero Main (String [] Args) {Swing-UtilitiesInkwiler (New Runnabal) (Public Zero) {Nuclear OutTech Panel = New New Outout (); Jeffre Frame = New Jeffram ("This Work"); // frame.SsetLayout (new border layout ()); Frame.ede (panel); //frame.getContentPane().add(panel); Frame.Set DefaultCallOffnation (JFARAM.EXIT_ON_CLOSE); Frame.Sets (600, 400); Frame.Seasible (true); }}); }}  

holder panel was not added to the panel In which component ie newCLayoutTest

  addition (holder panel);  

Note that there is no need for subclass JPanel because you are not adding any new functionality to the panel, you can simply create a panel and component can add. Also follow the Java Naming Conventions i.e. use the upper-case initial letter for class names, e.g. Nuclear Outfit


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -