Changeset 6666 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-01-10T19:24:34+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r6643 r6666 366 366 Dimension scrn = Toolkit.getDefaultToolkit().getScreenSize(); 367 367 368 // Create a JScrollPane around the content, in case there's not 369 // enough space 370 JScrollPane sp = new JScrollPane(content); 371 sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 368 // Create a JScrollPane around the content, in case there's not enough space 369 JScrollPane sp = GuiHelper.embedInVerticalScrollPane(content); 372 370 sp.setBorder(BorderFactory.createRaisedBevelBorder()); 373 371 // Implement max-size content-independent -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
r6565 r6666 15 15 import java.beans.PropertyChangeListener; 16 16 import java.util.Collection; 17 import java.util.List;18 17 import java.util.Observable; 19 18 import java.util.Observer; … … 87 86 protected JScrollPane embeddInScrollPane(JTable table) { 88 87 JScrollPane pane = new JScrollPane(table); 89 pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);90 pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);91 88 if (adjustmentSynchronizer == null) { 92 89 adjustmentSynchronizer = new AdjustmentSynchronizer(); … … 480 477 481 478 public CopyBeforeCurrentLeftAction() { 482 super("copybeforecurrentleft", tr("> before"), 479 super("copybeforecurrentleft", tr("> before"), 483 480 tr("Copy my selected elements before the first selected element in the list of merged elements.")); 484 481 } … … 510 507 511 508 public CopyAfterCurrentLeftAction() { 512 super("copyaftercurrentleft", tr("> after"), 509 super("copyaftercurrentleft", tr("> after"), 513 510 tr("Copy my selected elements after the first selected element in the list of merged elements.")); 514 511 } … … 570 567 571 568 public CopyBeforeCurrentRightAction() { 572 super("copybeforecurrentright", tr("< before"), 569 super("copybeforecurrentright", tr("< before"), 573 570 tr("Copy their selected elements before the first selected element in the list of merged elements.")); 574 571 } … … 596 593 597 594 public CopyAfterCurrentRightAction() { 598 super("copyaftercurrentright", tr("< after"), 595 super("copyaftercurrentright", tr("< after"), 599 596 tr("Copy their selected element after the first selected element in the list of merged elements")); 600 597 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java
r6316 r6666 52 52 protected JScrollPane embeddInScrollPane(JTable table) { 53 53 JScrollPane pane = new JScrollPane(table); 54 pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);55 pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);56 57 54 adjustmentSynchronizer.synchronizeAdjustment(pane.getVerticalScrollBar()); 58 55 return pane; -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java
r6340 r6666 31 31 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 32 32 import org.openstreetmap.josm.gui.help.HelpUtil; 33 import org.openstreetmap.josm.gui.util.GuiHelper; 33 34 import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator; 34 35 import org.openstreetmap.josm.gui.widgets.BoundingBoxSelectionPanel; 35 36 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 37 import org.openstreetmap.josm.gui.widgets.JosmTextField; 36 38 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 37 39 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 38 40 import org.openstreetmap.josm.io.ChangesetQuery; 39 41 import org.openstreetmap.josm.tools.CheckParameterUtil; 40 import org.openstreetmap.josm.gui.widgets.JosmTextField;41 42 42 43 … … 152 153 protected void build() { 153 154 setLayout(new BorderLayout()); 154 JScrollPane spQueryPanel = new JScrollPane(buildQueryPanel());155 JScrollPane spQueryPanel = GuiHelper.embedInVerticalScrollPane(buildQueryPanel()); 155 156 add(spQueryPanel, BorderLayout.CENTER); 156 spQueryPanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);157 spQueryPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); 158 159 }160 157 } 158 159 /** 160 * Constructs a new {@code AdvancedChangesetQueryPanel}. 161 */ 161 162 public AdvancedChangesetQueryPanel() { 162 163 build(); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java
r6267 r6666 11 11 import javax.swing.JSplitPane; 12 12 import javax.swing.JTabbedPane; 13 import javax.swing.JTable;14 13 15 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 33 32 34 33 /** 35 * embedds table in a {@link JScrollPane}36 *37 * @param table the table38 * @return the {@link JScrollPane} with the embedded table39 */40 protected JScrollPane embeddInScrollPane(JTable table) {41 JScrollPane pane = new JScrollPane(table);42 pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);43 pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);44 return pane;45 }46 47 /**48 34 * creates the table which shows the list of versions 49 35 * … … 55 41 56 42 VersionTable versionTable = new VersionTable(model); 57 pnl.add( embeddInScrollPane(versionTable), BorderLayout.CENTER);43 pnl.add(new JScrollPane(versionTable), BorderLayout.CENTER); 58 44 return pnl; 59 45 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryViewerPanel.java
r6207 r6666 31 31 private JScrollPane embedInScrollPane(JTable table) { 32 32 JScrollPane pane = new JScrollPane(table); 33 pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);34 pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);35 33 adjustmentSynchronizer.participateInSynchronizedScrolling(pane.getVerticalScrollBar()); 36 34 return pane; -
trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java
r6336 r6666 55 55 protected JScrollPane embeddInScrollPane(JTable table) { 56 56 JScrollPane pane = new JScrollPane(table); 57 pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);58 pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);59 57 adjustmentSynchronizer.participateInSynchronizedScrolling(pane.getVerticalScrollBar()); 60 58 return pane; -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r6310 r6666 220 220 trn("{0} waypoint", "{0} waypoints", data.waypoints.size(), data.waypoints.size())).append("<br>"); 221 221 222 final JScrollPane sp = new JScrollPane(new HtmlPanel(info.toString()) , JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);222 final JScrollPane sp = new JScrollPane(new HtmlPanel(info.toString())); 223 223 sp.setPreferredSize(new Dimension(sp.getPreferredSize().width, 350)); 224 224 SwingUtilities.invokeLater(new Runnable() { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/CustomizeDrawingAction.java
r6070 r6666 25 25 import org.openstreetmap.josm.gui.layer.Layer.MultiLayerAction; 26 26 import org.openstreetmap.josm.gui.preferences.display.GPXSettingsPanel; 27 import org.openstreetmap.josm.gui.util.GuiHelper; 27 28 import org.openstreetmap.josm.tools.ImageProvider; 28 29 … … 80 81 } 81 82 GPXSettingsPanel panel = new GPXSettingsPanel(layers.get(0).getName(), hasLocal, hasNonlocal); 82 JScrollPane scrollpane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);83 JScrollPane scrollpane = GuiHelper.embedInVerticalScrollPane(panel); 83 84 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 84 85 int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; -
trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java
r6643 r6666 167 167 168 168 JTabbedPane tpProperties = new JTabbedPane(); 169 tpProperties.add( VerticallyScrollablePanel.embed(buildUserNamePasswordPanel()));170 tpProperties.add( VerticallyScrollablePanel.embed(buildGrantsPanel()));171 tpProperties.add( VerticallyScrollablePanel.embed(getAdvancedPropertiesPanel()));169 tpProperties.add(buildUserNamePasswordPanel().getVerticalScrollPane()); 170 tpProperties.add(buildGrantsPanel().getVerticalScrollPane()); 171 tpProperties.add(getAdvancedPropertiesPanel().getVerticalScrollPane()); 172 172 tpProperties.setTitleAt(0, tr("Basic")); 173 173 tpProperties.setTitleAt(1, tr("Granted rights")); -
trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java
r6267 r6666 44 44 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 45 45 import org.openstreetmap.josm.gui.help.HelpUtil; 46 import org.openstreetmap.josm.gui.util.GuiHelper; 46 47 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 47 48 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 170 171 pnlManualAuthorisationUI = new ManualAuthorizationUI(apiUrl); 171 172 172 spAuthorisationProcedureUI = new JScrollPane(new JPanel()); 173 spAuthorisationProcedureUI.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 174 spAuthorisationProcedureUI.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); 173 spAuthorisationProcedureUI = GuiHelper.embedInVerticalScrollPane(new JPanel()); 175 174 spAuthorisationProcedureUI.getVerticalScrollBar().addComponentListener( 176 175 new ComponentListener() { -
trunk/src/org/openstreetmap/josm/gui/preferences/DefaultTabPreferenceSetting.java
r5632 r6666 10 10 import javax.swing.JTabbedPane; 11 11 12 import org.openstreetmap.josm.Main; 12 13 import org.openstreetmap.josm.tools.GBC; 13 14 … … 20 21 private final Map<SubPreferenceSetting, Component> subSettingMap; 21 22 23 /** 24 * Constructs a new {@code DefaultTabPreferenceSetting}. 25 */ 22 26 public DefaultTabPreferenceSetting() { 23 27 this(null, null, null); … … 78 82 a.anchor = GBC.EAST; 79 83 80 JScrollPane scrollPane = new JScrollPane(panel , JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);84 JScrollPane scrollPane = new JScrollPane(panel); 81 85 scrollPane.setBorder(null); 82 86 … … 96 100 } catch (IllegalArgumentException e) { 97 101 // Ignore exception and return false below 102 Main.debug(Main.getErrorMessage(e)); 98 103 } 99 104 } -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r6643 r6666 53 53 import org.openstreetmap.josm.gui.preferences.shortcut.ShortcutPreference; 54 54 import org.openstreetmap.josm.gui.preferences.validator.ValidatorPreference; 55 import org.openstreetmap.josm.gui.preferences.validator.ValidatorTestsPreference; 55 56 import org.openstreetmap.josm.plugins.PluginDownloadTask; 56 57 import org.openstreetmap.josm.plugins.PluginHandler; … … 283 284 public final ServerAccessPreference getServerPreference() { 284 285 return getSetting(ServerAccessPreference.class); 286 } 287 288 /** 289 * Returns the {@code ValidatorPreference} object. 290 * @return the {@code ValidatorPreference} object. 291 * @since 6665 292 */ 293 public final ValidatorPreference getValidatorPreference() { 294 return getSetting(ValidatorPreference.class); 285 295 } 286 296 … … 503 513 settingsFactory.add(new ShortcutPreference.Factory()); 504 514 settingsFactory.add(new ValidatorPreference.Factory()); 515 settingsFactory.add(new ValidatorTestsPreference.Factory()); 505 516 settingsFactory.add(new RemoteControlPreference.Factory()); 506 517 settingsFactory.add(new ImageryPreference.Factory()); -
trunk/src/org/openstreetmap/josm/gui/preferences/map/BackupPreference.java
r6529 r6666 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.gui.widgets.HtmlPanel; 25 26 import org.openstreetmap.josm.gui.widgets.JosmTextField; … … 109 110 110 111 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 111 JScrollPane sp = new JScrollPane(panel); 112 sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 113 sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); 112 JScrollPane sp = GuiHelper.embedInVerticalScrollPane(panel); 114 113 115 114 gui.getMapPreference().addSubTab(this, tr("File backup"), sp, tr("Configure whether to create backup files")); -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r6623 r6666 161 161 model = new PluginPreferencesModel(); 162 162 pnlPluginPreferences = new PluginListPanel(model); 163 spPluginPreferences = new JScrollPane(pnlPluginPreferences); 164 spPluginPreferences.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 165 spPluginPreferences.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); 163 spPluginPreferences = GuiHelper.embedInVerticalScrollPane(pnlPluginPreferences); 166 164 spPluginPreferences.getVerticalScrollBar().addComponentListener( 167 165 new ComponentAdapter(){ -
trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreference.java
r6623 r6666 37 37 gui.getServerPreference().addApiUrlChangeListener(pnlAuthPreferences); 38 38 gui.getServerPreference().addSubTab(this, tr("Authentication"), 39 ServerAccessPreference.wrapVerticallyScrollablePanel(pnlAuthPreferences),39 pnlAuthPreferences.getVerticalScrollPane(), 40 40 tr("Configure your identity and how to authenticate at the OSM server")); 41 41 } -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ProxyPreference.java
r6623 r6666 41 41 pnlProxyPreferences = new ProxyPreferencesPanel(); 42 42 gui.getServerPreference().addSubTab(this, tr("Proxy settings"), 43 ServerAccessPreference.wrapVerticallyScrollablePanel(pnlProxyPreferences),43 pnlProxyPreferences.getVerticalScrollPane(), 44 44 tr("Configure whether to use a proxy server")); 45 45 } -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ServerAccessPreference.java
r6623 r6666 11 11 12 12 import javax.swing.JPanel; 13 import javax.swing.JScrollPane;14 13 import javax.swing.JTabbedPane; 15 14 … … 19 18 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; 20 19 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 21 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;22 20 23 21 /** … … 42 40 /** indicates whether to use the default OSM URL or not */ 43 41 private OsmApiUrlInputPanel pnlApiUrlPreferences; 44 45 /**46 * Embeds a vertically scrollable panel in a {@link JScrollPane}47 * @param panel the panel48 * @return the scroll pane49 */50 public static JScrollPane wrapVerticallyScrollablePanel(VerticallyScrollablePanel panel) {51 JScrollPane sp = new JScrollPane(panel);52 sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);53 sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);54 return sp;55 }56 42 57 43 /** -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorPreference.java
r6636 r6666 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.GridBagLayout; 7 import java.awt.event.ActionEvent; 8 import java.awt.event.ActionListener; 9 import java.util.Collection; 10 import java.util.LinkedList; 6 import javax.swing.JTabbedPane; 11 7 12 import javax.swing.BorderFactory;13 import javax.swing.JCheckBox;14 import javax.swing.JLabel;15 import javax.swing.JPanel;16 17 import org.openstreetmap.josm.Main;18 8 import org.openstreetmap.josm.data.preferences.BooleanProperty; 19 import org.openstreetmap.josm.data.validation.OsmValidator;20 import org.openstreetmap.josm.data.validation.Test;21 9 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 22 10 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; … … 26 14 27 15 /** 28 * Preference settings for the validator 16 * Preference settings for the validator. 29 17 * 30 18 * @author frsantos … … 44 32 private ValidatorPreference() { 45 33 super("validator", tr("Data validator"), 46 tr("An OSM data validator that checks for common errors made by users and editor programs.")); 34 tr("An OSM data validator that checks for common errors made by users and editor programs."), 35 false, new JTabbedPane()); 47 36 } 48 37 … … 74 63 public static final String PREF_FILTER_BY_SELECTION = PREFIX + ".selectionFilter"; 75 64 76 private JCheckBox prefUseIgnore;77 private JCheckBox prefUseLayer;78 private JCheckBox prefOtherUpload;79 private JCheckBox prefOther;80 81 /** The list of all tests */82 private Collection<Test> allTests;83 84 65 @Override 85 public void addGui(PreferenceTabbedPane gui) 86 { 87 JPanel testPanel = new JPanel(new GridBagLayout()); 88 testPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 89 90 prefUseIgnore = new JCheckBox(tr("Use ignore list."), Main.pref.getBoolean(PREF_USE_IGNORE, true)); 91 prefUseIgnore.setToolTipText(tr("Use the ignore list to suppress warnings.")); 92 testPanel.add(prefUseIgnore, GBC.eol()); 93 94 prefUseLayer = new JCheckBox(tr("Use error layer."), Main.pref.getBoolean(PREF_LAYER, true)); 95 prefUseLayer.setToolTipText(tr("Use the error layer to display problematic elements.")); 96 testPanel.add(prefUseLayer, GBC.eol()); 97 98 prefOther = new JCheckBox(tr("Show informational level."), PREF_OTHER.get()); 99 prefOther.setToolTipText(tr("Show the informational tests.")); 100 testPanel.add(prefOther, GBC.eol()); 101 102 prefOtherUpload = new JCheckBox(tr("Show informational level on upload."), Main.pref.getBoolean(PREF_OTHER_UPLOAD, false)); 103 prefOtherUpload.setToolTipText(tr("Show the informational tests in the upload check windows.")); 104 testPanel.add(prefOtherUpload, GBC.eol()); 105 106 ActionListener otherUploadEnabled = new ActionListener() { 107 @Override 108 public void actionPerformed(ActionEvent e) { 109 prefOtherUpload.setEnabled(prefOther.isSelected()); 110 } 111 }; 112 prefOther.addActionListener(otherUploadEnabled); 113 otherUploadEnabled.actionPerformed(null); 114 115 GBC a = GBC.eol().insets(-5,0,0,0); 116 a.anchor = GBC.EAST; 117 testPanel.add( new JLabel(tr("On demand")), GBC.std() ); 118 testPanel.add( new JLabel(tr("On upload")), a ); 119 120 allTests = OsmValidator.getTests(); 121 for (Test test: allTests) { 122 test.addGui(testPanel); 123 } 124 125 createPreferenceTabWithScrollPane(gui, testPanel); 66 public void addGui(PreferenceTabbedPane gui) { 67 gui.createPreferenceTab(this).add(getTabPane(), GBC.eol().fill(GBC.BOTH)); 126 68 } 127 69 128 70 @Override 129 71 public boolean ok() { 130 Collection<String> tests = new LinkedList<String>();131 Collection<String> testsBeforeUpload = new LinkedList<String>();132 133 for (Test test : allTests) {134 test.ok();135 String name = test.getClass().getSimpleName();136 if(!test.enabled)137 tests.add(name);138 if(!test.testBeforeUpload)139 testsBeforeUpload.add(name);140 }141 OsmValidator.initializeTests(allTests);142 143 Main.pref.putCollection(PREF_SKIP_TESTS, tests);144 Main.pref.putCollection(PREF_SKIP_TESTS_BEFORE_UPLOAD, testsBeforeUpload);145 Main.pref.put(PREF_USE_IGNORE, prefUseIgnore.isSelected());146 PREF_OTHER.put(prefOther.isSelected());147 Main.pref.put(PREF_OTHER_UPLOAD, prefOtherUpload.isSelected());148 Main.pref.put(PREF_LAYER, prefUseLayer.isSelected());149 72 return false; 150 73 } -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r6643 r6666 27 27 import javax.swing.ImageIcon; 28 28 import javax.swing.JOptionPane; 29 import javax.swing.JScrollPane; 29 30 import javax.swing.SwingUtilities; 30 31 import javax.swing.Timer; … … 247 248 } 248 249 } 250 251 /** 252 * Embeds the given component into a new vertical-only scrollable {@code JScrollPane}. 253 * @param panel The component to embed 254 * @return the vertical scrollable {@code JScrollPane} 255 * @since 6666 256 */ 257 public static JScrollPane embedInVerticalScrollPane(Component panel) { 258 return new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 259 } 249 260 } -
trunk/src/org/openstreetmap/josm/gui/widgets/VerticallyScrollablePanel.java
r6084 r6666 10 10 import javax.swing.Scrollable; 11 11 12 import org.openstreetmap.josm.gui.util.GuiHelper; 13 12 14 public class VerticallyScrollablePanel extends JPanel implements Scrollable { 13 15 14 static public JScrollPane embed(VerticallyScrollablePanel panel) { 15 JScrollPane sp = new JScrollPane(panel); 16 sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 17 sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); 18 return sp; 19 } 20 16 /** 17 * Constructs a new {@code VerticallyScrollablePanel}. 18 */ 21 19 public VerticallyScrollablePanel() { 22 20 super(); … … 33 31 public VerticallyScrollablePanel(LayoutManager layout) { 34 32 super(layout); 33 } 34 35 /** 36 * Returns a vertical scrollable {@code JScrollPane} containing this panel. 37 * @return the vertical scrollable {@code JScrollPane} 38 * @since 6666 39 */ 40 public final JScrollPane getVerticalScrollPane() { 41 return GuiHelper.embedInVerticalScrollPane(this); 35 42 } 36 43
Note:
See TracChangeset
for help on using the changeset viewer.