Changeset 206


Ignore:
Timestamp:
Feb 23, 2012, 11:37:32 AM (5 years ago)
Author:
tim.te.beek@…
Message:

Layout components in a more compact fashion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/piqc-plugin/src/main/java/nl/nbic/brs/piqc/tableimport/views/ParseOptionsPanel.java

    r194 r206  
    88import javax.swing.ButtonGroup;
    99import javax.swing.GroupLayout;
     10import javax.swing.GroupLayout.Alignment;
    1011import javax.swing.GroupLayout.ParallelGroup;
    1112import javax.swing.GroupLayout.SequentialGroup;
     
    7475        private void initComponents() {
    7576                // Select table file button
    76                 selectFileButton = new JButton(new AbstractAction("Select table file") {
     77                selectFileButton = new JButton(new AbstractAction("Open table file") {
    7778                        @Override
    7879                        public void actionPerformed(final ActionEvent e) {
     
    214215                layout.setHorizontalGroup(horizontalParallelGroup);
    215216
    216                 horizontalParallelGroup.addComponent(selectFileButton);
    217 
    218                 SequentialGroup delimiterHorGroup = layout.createSequentialGroup();
    219                 delimiterHorGroup.addComponent(tabButton);
    220                 delimiterHorGroup.addComponent(commaButton);
    221                 delimiterHorGroup.addComponent(semicolonButton);
    222                 delimiterHorGroup.addComponent(spaceButton);
    223                 delimiterHorGroup.addComponent(otherButton).addPreferredGap(ComponentPlacement.RELATED);
    224                 delimiterHorGroup.addComponent(delimiterTextField, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE);
    225                 horizontalParallelGroup.addGroup(delimiterHorGroup);
    226 
    227                 SequentialGroup startFromGroup = layout.createSequentialGroup();
    228                 startFromGroup.addComponent(startFromLabel).addPreferredGap(ComponentPlacement.RELATED);
    229                 startFromGroup.addComponent(startFromSpinner, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE);
    230                 horizontalParallelGroup.addGroup(startFromGroup);
    231 
    232                 horizontalParallelGroup.addComponent(firstRowHeaderCheckbox);
    233 
    234                 SequentialGroup commentGroup = layout.createSequentialGroup();
    235                 commentGroup.addComponent(commentLabel).addPreferredGap(ComponentPlacement.RELATED);
    236                 commentGroup.addComponent(commentTextField, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE);
    237                 horizontalParallelGroup.addGroup(commentGroup);
     217                SequentialGroup firstLineGroup = layout.createSequentialGroup();
     218                // File button
     219                firstLineGroup.addComponent(selectFileButton).addPreferredGap(ComponentPlacement.UNRELATED);
     220                // Delimiters
     221                firstLineGroup.addComponent(tabButton);
     222                firstLineGroup.addComponent(commaButton);
     223                firstLineGroup.addComponent(semicolonButton);
     224                firstLineGroup.addComponent(spaceButton);
     225                firstLineGroup.addComponent(otherButton).addPreferredGap(ComponentPlacement.RELATED);
     226                firstLineGroup.addComponent(delimiterTextField, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE);
     227                horizontalParallelGroup.addGroup(firstLineGroup);
     228
     229                SequentialGroup secondLineGroup = layout.createSequentialGroup();
     230                // Comment
     231                secondLineGroup.addComponent(commentLabel).addPreferredGap(ComponentPlacement.RELATED);
     232                secondLineGroup.addComponent(commentTextField, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.UNRELATED);
     233                // Start from
     234                secondLineGroup.addComponent(startFromLabel).addPreferredGap(ComponentPlacement.RELATED);
     235                secondLineGroup.addComponent(startFromSpinner, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.UNRELATED);
     236                // Header checkbox
     237                secondLineGroup.addComponent(firstRowHeaderCheckbox);
     238                horizontalParallelGroup.addGroup(secondLineGroup);
    238239
    239240                // Vertical
     
    241242                layout.setVerticalGroup(verticalSeqGroup);
    242243
    243                 verticalSeqGroup.addComponent(selectFileButton).addPreferredGap(ComponentPlacement.UNRELATED);
    244 
    245                 ParallelGroup delimiterVertGroup = layout.createParallelGroup();
    246                 delimiterVertGroup.addComponent(tabButton);
    247                 delimiterVertGroup.addComponent(commaButton);
    248                 delimiterVertGroup.addComponent(semicolonButton);
    249                 delimiterVertGroup.addComponent(spaceButton);
    250                 delimiterVertGroup.addComponent(otherButton);
    251                 delimiterVertGroup.addComponent(delimiterTextField);
    252                 verticalSeqGroup.addGroup(delimiterVertGroup).addPreferredGap(ComponentPlacement.UNRELATED);
    253 
    254                 ParallelGroup startFromVertGroup = layout.createParallelGroup();
    255                 startFromVertGroup.addComponent(startFromLabel);
    256                 startFromVertGroup.addComponent(startFromSpinner);
    257                 verticalSeqGroup.addGroup(startFromVertGroup).addPreferredGap(ComponentPlacement.UNRELATED);
    258 
    259                 verticalSeqGroup.addComponent(firstRowHeaderCheckbox).addPreferredGap(ComponentPlacement.UNRELATED);
    260 
    261                 ParallelGroup commentVertGroup = layout.createParallelGroup();
    262                 commentVertGroup.addComponent(commentLabel);
    263                 commentVertGroup.addComponent(commentTextField);
    264                 verticalSeqGroup.addGroup(commentVertGroup);
     244                ParallelGroup firstLineVertGroup = layout.createParallelGroup(Alignment.BASELINE);
     245                firstLineVertGroup.addComponent(selectFileButton);
     246                firstLineVertGroup.addComponent(tabButton);
     247                firstLineVertGroup.addComponent(commaButton);
     248                firstLineVertGroup.addComponent(semicolonButton);
     249                firstLineVertGroup.addComponent(spaceButton);
     250                firstLineVertGroup.addComponent(otherButton);
     251                firstLineVertGroup.addComponent(delimiterTextField);
     252                verticalSeqGroup.addGroup(firstLineVertGroup).addPreferredGap(ComponentPlacement.UNRELATED);
     253
     254                ParallelGroup secondLineVertGroup = layout.createParallelGroup(Alignment.BASELINE);
     255                secondLineVertGroup.addComponent(commentLabel);
     256                secondLineVertGroup.addComponent(commentTextField);
     257
     258                secondLineVertGroup.addComponent(startFromLabel);
     259                secondLineVertGroup.addComponent(startFromSpinner);
     260
     261                secondLineVertGroup.addComponent(firstRowHeaderCheckbox);
     262                verticalSeqGroup.addGroup(secondLineVertGroup);
     263
    265264        }
    266265
Note: See TracChangeset for help on using the changeset viewer.