Dynamic construction of GUI



  • Hello! I don't know if I'm right about the term dynamic, but that's the point.

    A method should be implemented to remove components of different types over the cycle in a certain manner. Let's say there are three JText Fields first (Imah, Familia, Fatherland) - then two JComboBox (Paul, Country) and the other text fields. The track and text field (or list) shall be turned into JPanel. Each mark shall be given a name and a text. A name is assigned to the texting field or list.

    введите сюда описание изображения

    First, I think we need to keep the names of the mark and text fields somewhere. Also the text of the mark:

    Multimap<String, String> labels;
    List<String> componentsName;
    List<String> componentsList //список выводимых компонентов: "JTextField","JTextField","JComboBox" etc.. 
    

    public void drawComponents(Multimap<String, String> labels, List<String> componentsName, List<String> componentsList ) {
    /do something/
    }

    How do you create a beautiful cycle of the components and take the components to shape?



  • I'll offer you this option:

    1. Create a class that describes the stage. It will contain fields describing each stage (name + element to be created + a result field may be added)
    2. the stage number - key, stage object - meaning
    3. In the phase index cycle, remove the object from the mask,
      • Initiate all elements (label, JText Field ...) to make them visible
      • to wait for the user to enter, to press the bottom button, to produce the result of the introduction of the phase
      • make invisible all elements of GUI.

    By the end, you'll get a mapu, with all phases + input results at these stages.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2