Results 1 to 4 of 4
- 03-05-2011, 01:58 AM #1
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 ...
How can I do to create something like the pictures up????? :(:(:(:confused::confused:
Thanks in advance. Best regards, Ali.
- 03-05-2011, 02:16 AM #2
Which part of this are you stuck on? The layout looks like a job for a BoxLayout. Just keep a List of JPanels or elements or whatever, and add them to the JPanel in the order you want them.
Asking "how do I do this" isn't really a question we can answer. If you want help, you'll have to ask a more specific question that has to do with one part of this problem.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 03-05-2011, 03:10 AM #3
I get an idea,

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.
Java Code: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(); } }); } }
- 03-05-2011, 03:33 AM #4
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
Trigger cmd to delete a file in java program
By hari.kr in forum Advanced JavaReplies: 4Last Post: 04-28-2010, 07:37 PM -
How to delete a JLabel by using the keyboard 'delete' key?
By Suren in forum AWT / SwingReplies: 2Last Post: 04-20-2009, 08:00 AM -
[SOLVED] delete elements
By kuhok in forum New To JavaReplies: 3Last Post: 03-31-2009, 08:33 PM -
delete a line from a text file in Java
By ddatta8 in forum New To JavaReplies: 2Last Post: 01-24-2009, 05:08 AM -
Can I delete/uninstall older versions of Java?
By LudwigKarl in forum New To JavaReplies: 3Last Post: 03-19-2008, 10:23 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks