By default left/right swipe on touch screens causes Chromium engine to navigate back/forward. To disable this default behavior use the --overscroll-history-navigation=0 Chromium switcher as shown in the following example:(默认情况下,在触摸屏上向左/向右滑动会导致Chromium引擎向后/向前导航。要禁用此默认行为,请使用--overscroll-history-navigation = 0 Chromium切换器,如以下示例所示:)
import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.BrowserPreferences; import com.teamdev.jxbrowser.chromium.swing.BrowserView; import javax.swing.*; import java.awt.*; public class BrowserSample { public static void main(String[] args) { // Disables back/forward on left/right swipe on touch screens. BrowserPreferences.setChromiumSwitches("--overscroll-history-navigation=0"); Browser browser = new Browser(); BrowserView view = new BrowserView(browser); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(view, BorderLayout.CENTER); frame.setSize(700, 500); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.loadURL("http://google.com"); } }