Changeset 14826 in osm for applications/editors/josm


Ignore:
Timestamp:
2009-04-29T23:58:54+02:00 (15 years ago)
Author:
hampelratte
Message:

improved layout, so that the icon is always visible and combobox and cancel button are aligned on the right

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/dialogs/TextInputDialog.java

    r14755 r14826  
    108108
    109109    private void initGUI() {
    110         BorderLayout thisLayout = new BorderLayout();
    111         getContentPane().setLayout(thisLayout);
    112         thisLayout.setHgap(5);
    113         thisLayout.setVgap(5);
    114         {
    115             pnlMain = new JPanel();
    116             GridBagLayout pnlMainLayout = new GridBagLayout();
    117             pnlMainLayout.rowWeights = new double[] {0.1, 0.1, 0.1};
    118             pnlMainLayout.rowHeights = new int[] {7, 7, 7};
    119             pnlMainLayout.columnWeights = new double[] {0.1, 0.1};
    120             pnlMainLayout.columnWidths = new int[] {7, 7};
    121             getContentPane().add(pnlMain, BorderLayout.CENTER);
    122             pnlMain.setLayout(pnlMainLayout);
    123             pnlMain.setPreferredSize(new java.awt.Dimension(487, 132));
     110        getContentPane().setLayout(new BorderLayout());
     111        {
     112            lblIcon = new JLabel();
     113            lblIcon.setVerticalAlignment(SwingConstants.TOP);
     114            lblIcon.setVerticalTextPosition(SwingConstants.TOP);
     115            lblIcon.setPreferredSize(new java.awt.Dimension(22, 109));
     116            lblIcon.setMinimumSize(new java.awt.Dimension(22, 100));
     117            JPanel pnlIcon = new JPanel(new GridBagLayout());
     118            pnlIcon.add(lblIcon, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));
     119            getContentPane().add(pnlIcon, BorderLayout.WEST);
     120        }
     121        pnlMain = new JPanel();
     122        GridBagLayout pnlMainLayout = new GridBagLayout();
     123        getContentPane().add(pnlMain, BorderLayout.CENTER);
     124        pnlMain.setLayout(pnlMainLayout);
     125        pnlMain.setPreferredSize(new java.awt.Dimension(487, 132));
     126        {
     127            lblText = new JLabel();
     128            pnlMain.add(lblText, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
     129        }
     130        {
     131            input = new SuggestingJHistoryComboBox();
     132            pnlMain.add(input, new GridBagConstraints(1, 1, 1, 1, 0.9, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 10), 0, 0));
     133            input.setSize(503, 22);
     134        }
     135        {
     136            pnlButtons = new JPanel();
     137            FlowLayout pnlButtonsLayout = new FlowLayout();
     138            pnlButtonsLayout.setAlignment(FlowLayout.RIGHT);
     139            pnlMain.add(pnlButtons, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
     140            pnlButtons.setLayout(pnlButtonsLayout);
    124141            {
    125                 lblIcon = new JLabel();
    126                 pnlMain.add(lblIcon, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));
    127                 lblIcon.setVerticalAlignment(SwingConstants.TOP);
    128                 lblIcon.setVerticalTextPosition(SwingConstants.TOP);
     142                btnOk = new JButton();
     143                pnlButtons.add(btnOk);
     144                btnOk.setText(tr("OK"));
     145                btnOk.setPreferredSize(new java.awt.Dimension(100, 25));
    129146            }
    130147            {
    131                 lblText = new JLabel();
    132                 pnlMain.add(lblText, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
    133             }
    134             {
    135                 input = new SuggestingJHistoryComboBox();
    136                 pnlMain.add(input, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    137                 input.setSize(503, 22);
    138             }
    139             {
    140                 pnlButtons = new JPanel();
    141                 FlowLayout pnlButtonsLayout = new FlowLayout();
    142                 pnlButtonsLayout.setAlignment(FlowLayout.RIGHT);
    143                 pnlMain.add(pnlButtons, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    144                 pnlButtons.setLayout(pnlButtonsLayout);
    145                 {
    146                     btnOk = new JButton();
    147                     pnlButtons.add(btnOk);
    148                     btnOk.setText(tr("OK"));
    149                     btnOk.setPreferredSize(new java.awt.Dimension(100, 25));
    150                 }
    151                 {
    152                     btnCancel = new JButton();
    153                     pnlButtons.add(btnCancel);
    154                     btnCancel.setText(tr("Cancel"));
    155                     btnCancel.setPreferredSize(new java.awt.Dimension(100, 25));
    156                 }
     148                btnCancel = new JButton();
     149                pnlButtons.add(btnCancel);
     150                btnCancel.setText(tr("Cancel"));
     151                btnCancel.setPreferredSize(new java.awt.Dimension(100, 25));
    157152            }
    158153        }
Note: See TracChangeset for help on using the changeset viewer.