Changeset 4215 in josm


Ignore:
Timestamp:
2011-07-08T22:50:35+02:00 (13 years ago)
Author:
stoecker
Message:

fix #6547 - patch by Hojoe - reduce space usage in relation editor

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r4191 r4215  
    3333import javax.swing.AbstractAction;
    3434import javax.swing.BorderFactory;
     35import javax.swing.DefaultCellEditor;
    3536import javax.swing.JComponent;
    3637import javax.swing.JLabel;
     
    4041import javax.swing.JSplitPane;
    4142import javax.swing.JTabbedPane;
     43import javax.swing.JTextField;
    4244import javax.swing.JToolBar;
    4345import javax.swing.KeyStroke;
     
    276278        memberTable.addMouseListener(new MemberTableDblClickAdapter());
    277279        memberTableModel.addMemberModelListener(memberTable);
     280        // setup a cell editor with a small border
     281        final JTextField cellEditorTextField = new JTextField();
     282        cellEditorTextField.setBorder(BorderFactory.createEmptyBorder(1,1,1,1));
     283        cellEditorTextField.addFocusListener(
     284            new FocusAdapter() {
     285                @Override public void focusGained(FocusEvent e) {
     286                    cellEditorTextField.selectAll();
     287                }
     288            }
     289        );
     290        DefaultCellEditor cellEditor = new DefaultCellEditor(cellEditorTextField);
     291        cellEditor.setClickCountToStart(1);
     292        memberTable.getColumnModel().getColumn(0).setCellEditor(cellEditor);
     293        memberTable.setRowHeight(cellEditorTextField.getPreferredSize().height);
    278294
    279295        final JScrollPane scrollPane = new JScrollPane(memberTable);
     
    344360        );
    345361        tfRole.setEnabled(memberTable.getSelectedRowCount() > 0);
    346         memberTable.setRowHeight(tfRole.getPreferredSize().height);
    347362        SideButton btnApply = new SideButton(setRoleAction);
    348363        btnApply.setPreferredSize(new Dimension(20,20));
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagCellEditor.java

    r4191 r4215  
    55
    66import javax.swing.AbstractCellEditor;
     7import javax.swing.BorderFactory;
    78import javax.swing.JTable;
    89import javax.swing.table.TableCellEditor;
     
    3334    public TagCellEditor() {
    3435        editor = new AutoCompletingTextField();
     36        editor.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    3537    }
    3638
Note: See TracChangeset for help on using the changeset viewer.