cardlayout

JAVA SWING - Creating Animation using Swing Timer

你离开我真会死。 提交于 2021-01-29 10:01:52
问题 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. When transitioning, there should be a flag that states it is in the transition period. The Swing timer should fire once every tenth of a second and essentially last 1 second. public class guiCreation { static Timer timer; static boolean flag = false; private static void guiInterface() { next

wrong parent for CardLayout in java

孤街浪徒 提交于 2020-05-30 11:27:13
问题 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. Inside the method initComponents() I successfully showed the first card using cardLayout.show(imagePanel, "1"); but when I tried to do the same inside private void comboMenuActionPerformed() , it returns the error "IllegalArgumentException: wrong parent for CardLayout". Why is this happening?

Allign bootstrap rows horizontally

|▌冷眼眸甩不掉的悲伤 提交于 2020-04-30 06:35:06
问题 I have created the following(in the image below) card layout using bootstrap the .card-columns class is adding my cards vertically so that i am loosing some part of the card. i want my cards alligned horizontally and exactly 3 cards per row without chaning the size of the card. here is my code. <body> <div class="card-columns"> <?php $conn=new mysqli("localhost","root","","dbname"); if(!$conn) { echo "connection_failed"; } else{ } $query= "select title,description,id from problems where

Scrollable JPanel in a CardLayout?

自古美人都是妖i 提交于 2020-01-16 01:05:13
问题 I have been looking for a way to add a vertical scroll bar to a JPanel that in turn is added to a CardLayout panel. I looked up all the posts around here that were concerned with implementing a scrollable JPanel but I couldn't figure out how to implemented it with this specific CardLayout . Oracle doesn't give an example that I could use either. Perhaps I don't use the right configuration for the JWindow or any other component that Im using. I have placed below a stripped-down version of my

frame 2 inside frame 1

天大地大妈咪最大 提交于 2020-01-11 07:43:08
问题 I have 2 classes; Students and RegisterStudents, and hence 2 different main_panel(Class 1) and panel_1 (Class 2). What I am trying to do is, when a button on the Students Interface is pressed, the whole panel_1 should appear within main_panel. I have set both to same size already. is that possible? The code i got so far is: JButton btnNewButton = new JButton("Register Student"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { Students

Design Issue: MVC model with Java CardLayout application

你说的曾经没有我的故事 提交于 2020-01-05 08:34:05
问题 Sorry for the vague title, I am trying to layout an application i have unfortunately starting coding without following proper MVC architecture rules. I have an application that has the following structure. JFrame with a JPanel ("MainPanel") added as a component and the MainPanel has a CardLayout structure. The MainPanel then has several JPanel's that are flipped through using buttons, Jcombo Box and List selections. I want to implement the MVC model using this structure and i am having

Using CardLayout for multiple JPanels and nothing displays

心已入冬 提交于 2019-12-31 05:11:32
问题 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 my long code, I put it all in one class. package my.Project; import java.awt.*; import java.awt.event.*; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.text.DecimalFormat; import javax.swing.*; public class MainProject extends JFrame { CardLayout

Using CardLayout in Java

落爺英雄遲暮 提交于 2019-12-31 04:11:11
问题 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 currently initialize a JFrame() in my main class which runs either the menu class or the game class (Both of which are JPanels). How would I go about using CardLayout to make it so that I can initialize the game menu and when I click a button, change the panel to the game panel? 回答1: I've got some

Resizing a JPanel inside a JFrame

血红的双手。 提交于 2019-12-31 01:40:26
问题 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 different layouts and have come to the CardLayout now. In the above, there is a JPanel being used for a status panel. That is what I want to do as well, but when I drag a JPanel onto my blank JForm it takes up all the space and I don't see any

Resizing a JPanel inside a JFrame

主宰稳场 提交于 2019-12-31 01:40:05
问题 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 different layouts and have come to the CardLayout now. In the above, there is a JPanel being used for a status panel. That is what I want to do as well, but when I drag a JPanel onto my blank JForm it takes up all the space and I don't see any