cardlayout

Card View Click on Card Move To New Activity

泪湿孤枕 提交于 2019-12-03 15:17:09
问题 I am new to Android programming and was working on a card layout. I was wondering, how do I make it clickable? android:clickable="true" android:foreground="?android:attr/selectableItemBackground" I have that on my card widget and then I wanted to know where to put an on clickable action? I want to be able to click the card, it gets the id of the card, and then displays a new intent activity This is my code for the activity to load the adapter setContentView(R.layout.activity_my); RecyclerView

Card View Click on Card Move To New Activity

瘦欲@ 提交于 2019-12-03 05:05:22
I am new to Android programming and was working on a card layout. I was wondering, how do I make it clickable? android:clickable="true" android:foreground="?android:attr/selectableItemBackground" I have that on my card widget and then I wanted to know where to put an on clickable action? I want to be able to click the card, it gets the id of the card, and then displays a new intent activity This is my code for the activity to load the adapter setContentView(R.layout.activity_my); RecyclerView recList = (RecyclerView) findViewById(R.id.cardList); recList.setHasFixedSize(true);

NullPointerException Error with JPanel and CardLayout

佐手、 提交于 2019-12-02 22:22:18
问题 I am working on hotel management software for class and I am running into a few issues with my code. At this point, I am simply trying to add a JPanel I created in a separate class into my main gui. Any Help would be greatly appreciated. ~ Thanks! Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at hotelManage.HotelSystem.showGUI(HotelSystem.java:75) at hotelManage.HotelSystem.<init>(HotelSystem

Navigating between multiple panels

孤者浪人 提交于 2019-12-02 19:08:07
问题 Can anyone tell me how to go about coding for navigation between multiple JPanel classes taking the event trigger from JButton from the objects (panels) themselves? I have read about CardLayout . The panel can be swapped from the events happening in the parent panel. What I want to achieve is on click of a button embedded in the panel, it should should disappear or a desired panel should be displayed. Can't seem to find a solution. 回答1: There is nothing about CardLayout that prevents

Previous function of CardLayout not working?

那年仲夏 提交于 2019-12-02 13:57:25
问题 The next function of my cardlayout is working properly, but previous isnt. As far as I'm concerned, just having "layout.previous( _ );" in the actionPerformed method body in my makePanel() method should work, but when I run my program and click the prev button, nothing happens. What am I doing wrong? – import java.awt.*; import javax.swing.*; import java.util.*; import java.awt.event.*; public class Temp { public static void main (String[] args) { new MakeAQuiz(); } static class MakeAQuiz {

Switching between JPanels in a JFrame

只谈情不闲聊 提交于 2019-12-02 13:55:45
问题 Now I know there are many, many questions on this and I've read a dozen. But I've just hit a wall, I can't make heads or tails of it. Heres my question. I have 3 Panel classes. ConfigurePanel.java ConnectServerPanel.java RunServerPanel.java and my JFrame class StartUPGUI.java This is what is initialised at startup private void initComponents() { jPanel1 = new javax.swing.JPanel(); startUp = new sjdproject.GUI.ConfigurePanel(); runServer = new sjdproject.GUI.RunServerPanel(); serverConnect =

Change current card in card layout with slide effect in swing

我是研究僧i 提交于 2019-12-02 12:13:16
问题 I'm trying to change current visible in card layout with slide effect. But I see a flick at the start of slide which I'm not able to debug/solve. How can I avoid that flick? Here is sample code to reproduce error: import java.awt.CardLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Main { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(new

Using CardLayout for multiple JPanels and nothing displays

冷暖自知 提交于 2019-12-02 12:00:48
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 cl; int motherboardP, oddP, hddP, ssdP, fanP, cpuP, gpuP, monitorP, hoursint; int ramNum, hddNum,

Display cards of CardLayout in random order?

爱⌒轻易说出口 提交于 2019-12-02 06:17:21
问题 I want to have a random order for displaying the cards or screens in my CardLayout. I need guidance on how to accomplish this. What is strategy I should use? I tried using the code below, but it is in a fixed order. I want to be able to choose whichever order I like. EDIT ! Sorry, by random order I did not mean shuffling. But, it is good to know. I want the user of the program to be able to enter some input. Depending on the value of the input, a particular screen/card is displayed. import

Overlap JPanels with WindowBuilder for eclipse

梦想的初衷 提交于 2019-12-02 05:10:42
问题 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, the first panel gets displaced by the second panel. And advice please? 回答1: 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 See: How to Use