Changeset 9778 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-02-10T20:47:11+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r9760 r9778 176 176 177 177 JScrollPane sp = new JScrollPane(p); 178 // putting JTable directly in a JScrollPane works nicely, but with 179 // JPanel wrapper, the default scroll increment is too small 180 sp.getVerticalScrollBar().setUnitIncrement(16); 178 GuiHelper.setDefaultIncrement(sp); 181 179 createLayout(sp, false, Arrays.asList( 182 180 new SideButton(onoffAction, false), -
trunk/src/org/openstreetmap/josm/gui/preferences/audio/AudioPreference.java
r9078 r9778 17 17 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 18 18 import org.openstreetmap.josm.gui.widgets.JosmTextField; 19 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 19 20 import org.openstreetmap.josm.tools.GBC; 20 21 … … 56 57 @Override 57 58 public void addGui(PreferenceTabbedPane gui) { 58 JPanel audio = new JPanel(new GridBagLayout());59 JPanel audio = new VerticallyScrollablePanel(new GridBagLayout()); 59 60 60 61 // audioMenuVisible -
trunk/src/org/openstreetmap/josm/gui/preferences/display/DrawingPreference.java
r9078 r9778 22 22 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 23 23 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 24 import org.openstreetmap.josm.gui.util.GuiHelper; 24 25 import org.openstreetmap.josm.tools.GBC; 25 26 … … 64 65 JScrollPane scrollpane = new JScrollPane(panel); 65 66 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 67 GuiHelper.setDefaultIncrement(scrollpane); 66 68 gui.getDisplayPreference().addSubTab(this, tr("GPS Points"), scrollpane); 67 69 panel = new JPanel(new GridBagLayout()); … … 167 169 scrollpane = new JScrollPane(panel); 168 170 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 171 GuiHelper.setDefaultIncrement(scrollpane); 169 172 gui.getDisplayPreference().addSubTab(this, tr("OSM Data"), scrollpane); 170 173 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
r9078 r9778 32 32 import org.openstreetmap.josm.gui.widgets.FileChooserManager; 33 33 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 34 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 34 35 import org.openstreetmap.josm.tools.GBC; 35 36 import org.openstreetmap.josm.tools.date.DateUtils; … … 54 55 */ 55 56 private JosmComboBox<LookAndFeelInfo> lafCombo; 56 JPanel panel;57 VerticallyScrollablePanel panel; 57 58 private final JCheckBox showSplashScreen = new JCheckBox(tr("Show splash screen at startup")); 58 59 private final JCheckBox showID = new JCheckBox(tr("Show object ID in selection lists")); … … 99 100 }); 100 101 101 panel = new JPanel(new GridBagLayout());102 panel = new VerticallyScrollablePanel(new GridBagLayout()); 102 103 panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 103 104 … … 147 148 panel.add(lafCombo, GBC.eol().fill(GBC.HORIZONTAL)); 148 149 149 JScrollPane scrollpane = new JScrollPane(panel);150 JScrollPane scrollpane = panel.getVerticalScrollPane(); 150 151 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 151 152 gui.getDisplayPreference().addSubTab(this, tr("Look and Feel"), scrollpane); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java
r8568 r9778 61 61 62 62 showBounds.setEnabled(false); 63 add( new JScrollPane(showBounds), GBC.eop().fill());63 add(showBounds, GBC.eop().fill()); 64 64 65 65 add(new JLabel(tr("3. Select image format")), GBC.eol()); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r9414 r9778 121 121 122 122 p.add(new JPanel(), GBC.eol().fill(GBC.BOTH)); 123 return new JScrollPane(p);123 return GuiHelper.setDefaultIncrement(new JScrollPane(p)); 124 124 } 125 125 -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r9543 r9778 36 36 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 37 37 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 38 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 38 39 import org.openstreetmap.josm.tools.GBC; 39 40 … … 292 293 * This is the panel holding all projection preferences 293 294 */ 294 private final JPanel projPanel = new JPanel(new GridBagLayout());295 private final VerticallyScrollablePanel projPanel = new VerticallyScrollablePanel(new GridBagLayout()); 295 296 296 297 /** … … 346 347 projPanel.add(GBC.glue(1, 1), GBC.std().fill(GBC.HORIZONTAL).weight(1.0, 1.0)); 347 348 348 JScrollPane scrollpane = new JScrollPane(projPanel); 349 gui.getMapPreference().addSubTab(this, tr("Map Projection"), scrollpane); 349 gui.getMapPreference().addSubTab(this, tr("Map Projection"), projPanel.getVerticalScrollPane()); 350 350 351 351 selectedProjectionChanged(pc); -
trunk/src/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreference.java
r9543 r9778 34 34 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 35 35 import org.openstreetmap.josm.gui.util.GuiHelper; 36 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 36 37 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 37 38 import org.openstreetmap.josm.io.remotecontrol.RemoteControl; … … 81 82 public void addGui(final PreferenceTabbedPane gui) { 82 83 83 JPanel remote = new JPanel(new GridBagLayout());84 JPanel remote = new VerticallyScrollablePanel(new GridBagLayout()); 84 85 85 86 final JLabel descLabel = new JLabel("<html>" -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreference.java
r8510 r9778 27 27 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 28 28 import org.openstreetmap.josm.gui.util.GuiHelper; 29 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 29 30 import org.openstreetmap.josm.tools.GBC; 30 31 … … 55 56 @Override 56 57 public void addGui(PreferenceTabbedPane gui) { 57 JPanel testPanel = new JPanel(new GridBagLayout());58 JPanel testPanel = new VerticallyScrollablePanel(new GridBagLayout()); 58 59 testPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 59 60 -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r9576 r9778 37 37 import javax.swing.JPanel; 38 38 import javax.swing.JScrollPane; 39 import javax.swing.Scrollable; 39 40 import javax.swing.SwingUtilities; 40 41 import javax.swing.Timer; … … 341 342 342 343 /** 344 * Set the default unit increment for a {@code JScrollPane}. 345 * 346 * This fixes slow mouse wheel scrolling when the content of the {@code JScrollPane} 347 * is a {@code JPanel} or other component that does not implement the {@link Scrollable} 348 * interface. 349 * The default unit increment is 1 pixel. Multiplied by the number of unit increments 350 * per mouse wheel "click" (platform dependent, usually 3), this makes a very 351 * sluggish mouse wheel experience. 352 * This methods sets the unit increment to a larger, more reasonable value. 353 * @param sp the scroll pane 354 * @return the scroll pane (same object) with fixed unit increment 355 * @throws IllegalArgumentException if the component inside of the scroll pane 356 * implements the {@code Scrollable} interface ({@code JTree}, {@code JLayer}, 357 * {@code JList}, {@code JTextComponent} and {@code JTable}) 358 */ 359 public static JScrollPane setDefaultIncrement(JScrollPane sp) { 360 if (sp.getViewport().getView() instanceof Scrollable) { 361 throw new IllegalArgumentException(); 362 } 363 sp.getVerticalScrollBar().setUnitIncrement(10); 364 sp.getHorizontalScrollBar().setUnitIncrement(10); 365 return sp; 366 } 367 368 /** 343 369 * Returns extended modifier key used as the appropriate accelerator key for menu shortcuts. 344 370 * It is advised everywhere to use {@link Toolkit#getMenuShortcutKeyMask()} to get the cross-platform modifier, but:
Note:
See TracChangeset
for help on using the changeset viewer.