Java App - Add, Delete, Reorder elements of the buttons
Hello,
I'm developing a Java application.
I created this interface with MockupScreens.
Please look at these pictures.
At first time, there's only one element, the user have to enter informations (title and description) then he starts adding elements as he needs. He can edit element infomrations at any time by clicking on "Element N" Button.
He can too delete an element or change the order of these elements ...
Let us put these buttons in a JPanel called btnsUnit, then manipulate it by adding, removing and reodering... So a Grid Layout will be efficient to add each panel after each one ..
Thats why I created a new JPanel which will contain an unknown number of ListbtnsUnit JPanel, I fixed 10 as the max number.
I'm just doing these steps when you reply me.
I didn't arrived to add btnsUnit JPanel in ListbtnsUnit JPanel.
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextField;
public class setupDeviceList extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
setupDeviceList frame = new setupDeviceList();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public setupDeviceList() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 742, 335);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
final JPanel ListbtnsUnit = new JPanel();
ListbtnsUnit.setBackground(Color.RED);
ListbtnsUnit.setBounds(55, 56, 243, 191);
contentPane.add(ListbtnsUnit);
ListbtnsUnit.setLayout(new GridLayout(10, 0));
final JButton btnAdd = new JButton("Add");
btnAdd.setBounds(161, 11, 56, 23);
btnAdd.setVisible(true);
btnAdd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
final JPanel btnsUnit = new JPanel();
btnsUnit.setBounds(343, 71, 243, 147);
contentPane.add(btnsUnit);
btnsUnit.setBackground(Color.ORANGE);
btnsUnit.setLayout(null);
btnsUnit.add(btnAdd);
ListbtnsUnit.add(btnsUnit);
ListbtnsUnit.revalidate();
ListbtnsUnit.repaint();
}
});
}
}
View Answers
Related Tutorials/Questions & Answers:
Radio Buttons - Java BeginnersRadio Buttons Hello Sir,
How to create the code for the password recovery page(like forgot gmail password question and answer page)using the radion
buttons in display the same page in jsp.I need only how to make the question
Advertisements
buttons in netbeans,javabuttons in netbeans,java respected sir, i would like to known how to make coding on a button while working on netbeans, so that a new window will open after clicking on that button? thank you
import java.awt.
ButtonsButtons I have created a web page with radio button group with two radio
buttons for accepting the home appliances categories,Kitchen appliances and other appliances.I want to check for the appliance chosen when the required
Java delete file if existsJava delete file if exists Hi,
Hi how to
delete file if exists?
I need example code of
java delete file if exists.
Thanks
Hi,
following code can be used:
String tempFile = "C:/mydir/myfile.txt";
//
Delete java list program for common elementsjava list program for common elements hi
I want program using
java collections list which takes two array list
elements and display common
elements in both the list as an output
Please visit the following link
Java arraylist duplicate elements searchJava arraylist duplicate
elements search hi,
please help me finding the no of duplicates
elements in an arraylist
example an arraylist contains
elements like:
mac raj mohan frank mac tom raj mohan frank
result:
mac 2
raj
What are Basic Java Language Elements?What are Basic
Java Language
Elements? Hello,
I have learned...
Elements.
What are Basic
Java Language
Elements?
Which is good tutorials of
Java Language
Elements?
Thanks
Hi,
Here are the details of Basic
Java How to delete file in Java code?How to
delete file in
Java code? Hi,
From my
Java program I have to
delete a file.
How to
delete file in
Java code?
Thanks
Hi,
Java API provides methods for deleting a file in
Java.
You can use the
delete DELETE DELETE I AM DOING IT IN MYSQL.
DELETE FROM EMP
WHERE SAL>(SELECT SAL FROM EMP WHERE ENAME='MILLAR')
AND ENAME='ALLEN';
THIS IS GIVING THE FOLLOWING ERROR
Error Code : 1093
You can't specify target table 'EMP
Java radio buttons and button groups two valuesJava radio
buttons and button groups two values hi i have a problem.
i have a system to input data from a jform to a mysql database. i have made all of it except the gender radiobuttons. how do i do this? i need when register
Java radio buttons and button groups two valuesJava radio
buttons and button groups two values hi i have a problem.
i have a system to input data from a jform to a mysql database. i have made all of it except the gender radiobuttons. how do i do this? i need when register
java - file delete - Java Beginnersjava - file delete I will try to
delete file from particular folder... will try to
delete these files. But it doesn?t
delete from this folder.
My code...){
try {
File
delete = new File (incurrentFile);
System.out.println
java - file delete - Java Beginnersjava - file delete I will try to
delete file from particular folder... will try to
delete these files. But it doesn?t
delete from this folder.
My code...){
try {
File
delete = new File (incurrentFile);
System.out.println
How to delete file in java ?How to
delete file in
java ?
In this section we will learn how to write a program to
delete a file in
java. You can
delete the file or folder,
java File..._TO_REPLACE_1
Now, here is the code to
delete a file in
java.
import
deletedelete how
delete only one row in the database using jsp.database...;td><input type="button" name="edit" value="
Delete" style="background-color...");
Statement st = conn.createStatement();
st.executeUpdate("
DELETE FROM employee
How to delete .xlsx file in java?How to
delete .xlsx file in
java? Hello Sir,
I am unable to
delete .xlsx file using below code, What is wrong here?
if(myFile != null && myFile.exists() && myFile.canRead() &&
J2ME delete file - Java BeginnersJ2ME
delete file How do i
delete a textfile on a mobile phone using j2me? Hi Friend,
Please visit the following link:
http://www.roseindia.net/j2me/
Hope that it will be helpful for you.
Thanks
How to delete files in Java?
Delete a File using File Class Object
Delete a File using File Class Object
In this section, you will learn how to
delete a file.
Delete specific lines from text in JavaDelete specific lines from text in Java Hi,
beginning in
java, i'm trying to
delete specific line from a text file.
Ex: i want to
delete data... number that i want to
delete.
how could it be possible with
java.
thanks a lot
Client Server Java appClient Server
Java app I developed a client server based
java networking Instant Messaging
app. The client program is needed to be run on the client... heroku techniques for
java but its hard for me to understand
Java file deleteJava file
delete
In this section, you will learn how to
delete a file.
Description of code
Java makes file manipulation easier by providing many useful... we are
going to
delete a file. For this, we have created an object of File
java buttons - Swing AWTjava buttons There are 3
buttons in a window....A,B,C.If a user clicks button A ,a clue is given to him leading to button B.After the user clicks...);
f.getContentPane().
add(p1);
final JPanel p2 = (JPanel) f.getGlassPane
delete a node from singly linked list in javadelete a node from singly linked list in java Write a program(in
java), if given a pointer to a node (not the tail node) in a singly linked list,
delete that node from the linked list.
could you tell your question
Shift Array Elements in JavaJava Shift Array
Elements
This section illustrates you how to shift the array
elements in a circular way. For this, first of all, we have allowed the user to enter the array
elements, the direction of shifting (Right or Left
Remove multiple elements in arraylist Remove multiple
elements in arraylist how can we remove multiple values in arrayList?
only remove method we used for single remove.but i want to
delete multiple value in arrayList
ModuleNotFoundError: No module named 'buttons'ModuleNotFoundError: No module named '
buttons' Hi,
My Python... '
buttons'
How to remove the ModuleNotFoundError: No module named '
buttons... to install padas library.
You can install
buttons python with following command