View Javadoc
1   package fr.ifremer.reefdb.ui.swing.util;
2   
3   /*
4    * #%L
5    * Reef DB :: UI
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2014 - 2015 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Affero General Public License as published by
13   * the Free Software Foundation, either version 3 of the License, or
14   * (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU Affero General Public License
22   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23   * #L%
24   */
25  
26  import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
27  
28  import javax.swing.JComponent;
29  import java.awt.Dimension;
30  
31  /**
32   * Created: 14/06/12
33   */
34  public final class ReefDbUIs extends ApplicationUIUtil {
35  
36      /**
37       * La largeur des combobox.
38       */
39      public static final int REEFDB_COMPONENT_WIDTH = 200;
40  
41      /**
42       * La hauteur des combobox.
43       */
44      public static final int REEFDB_COMPONENT_HEIGHT = 30;
45  
46      /**
47       * Size of a ReefDb double list
48       */
49      public static final int REEFDB_DOUBLE_LIST_SIZE = 260;
50  
51      /**
52       * Size of a ReefDb checkbox column
53       */
54      public static final int REEFDB_CHECKBOX_WIDTH = 80;
55  
56      /**
57       * Size of a ReefDb image thumbnail
58       */
59      public static final int REEFDB_IMAGE_WIDTH = 200;
60  
61      /**
62       * Affecte une largeur et une hauteur a un composant.
63       *
64       * @param component La combobox
65       */
66      public static void forceComponentSize(JComponent component) {
67          forceComponentSize(component, REEFDB_COMPONENT_WIDTH);
68      }
69  
70      /**
71       * Affecte une largeur et une hauteur a une combobox.
72       *
73       * @param component La combobox
74       * @param width     La largeur
75       */
76      public static void forceComponentSize(JComponent component, int width) {
77          component.setPreferredSize(new Dimension(width, REEFDB_COMPONENT_HEIGHT));
78          component.setSize(component.getPreferredSize());
79          component.setMaximumSize(component.getPreferredSize());
80          component.setMinimumSize(component.getPreferredSize());
81      }
82  
83  
84  }