Changes between Version 23 and Version 24 of mvc


Ignore:
Timestamp:
06/14/22 09:15:43 (3 years ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • mvc

    v23 v24  
    8989||EditableListViewPanel||As a ListViewPanel, but with additional add and delete buttons. When add is clicked, the addItem function is called, which is to be implemented by the programmer. This gives maximum flexibility for creating new entries||
    9090
    91  
     91= Usage, Example
     92Usage is very simple, basically the same as standard java panels but you always need to create a model. We look at the [source:mvc/src/test/java/tudelft/utilities/mvc/panels/SliderPanelTest.java] example:
     93{{{
     94                RestrictedNumberModel model = new RestrictedNumberModel(
     95                                new BigDecimal("1.2"),
     96                                new NumberModel(new BigDecimal("1.1"), log),
     97                                new NumberModel(new BigDecimal("1.3"), log), log);
     98                panel.add(new SliderPanel(model), BorderLayout.CENTER);
     99                panel.add(new NumberPanel(model), BorderLayout.SOUTH);
     100
     101}}}
     102
     103We left out the standard boilerplate to create the window.
     104The RestrictedNumberModel is initialized with the number 1.2, and the range is set to [1.1, 1.3].
     105Then we add a SliderPanel and a NumberPanel, both showing the same number. This allows the user to change the number either by dragging the slider or by typing the exact number.
     106
     107There are many more examples in the