下面列出了javax.swing.JPopupMenu#setDefaultLightWeightPopupEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void restored() {
// Menus are lightweight, GLCanvas is heavyweight. This means that menus will appear under canvases.
// Fix this by making menus heavyweight.
// See http://java.sun.com/products/jfc/tsc/articles/mixing/
// See http://java.sun.com/developer/technicalArticles/GUI/mixing_components/index.html
// Google for jogl lightweight
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
}
/**
* Sets some sensible defaults for swing.
* IMPORTANT! Needs to be called before main frame creation
*/
public static void setupDefaults()
{
// Force heavy-weight popups/tooltips.
// Prevents them from being obscured by the game applet.
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
ToolTipManager.sharedInstance().setInitialDelay(300);
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
UIManager.put("Button.foreground", Color.WHITE);
UIManager.put("MenuItem.foreground", Color.WHITE);
UIManager.put("Panel.background", ColorScheme.DARK_GRAY_COLOR);
UIManager.put("ScrollBarUI", CustomScrollBarUI.class.getName());
UIManager.put("TextField.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
UIManager.put("TextField.selectionForeground", Color.WHITE);
UIManager.put("FormattedTextField.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
UIManager.put("FormattedTextField.selectionForeground", Color.WHITE);
UIManager.put("TextArea.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
UIManager.put("TextArea.selectionForeground", Color.WHITE);
// Do not render shadows under popups/tooltips.
// Fixes black boxes under popups that are above the game applet.
System.setProperty("jgoodies.popupDropShadowEnabled", "false");
// Do not fill in background on repaint. Reduces flickering when
// the applet is resized.
System.setProperty("sun.awt.noerasebackground", "true");
}
/**
* The entry point of this application
*
* @param args The command line arguments
*/
public static void main(String[] args)
{
System.setProperty("sun.awt.noerasebackground", "true");
Map<String, String> argsMap = parseArguments(args);
initLogging();
processLoggingArgs(argsMap);
setPlatformLookAndFeel();
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
SwingUtilities.invokeLater(() -> createAndShowGui(argsMap));
}
/**
* This default implementation only setup the tool tip durations. Subclasses might override this
* method.
*/
protected void setupGUI() throws Exception {
System.setProperty(BookmarkIO.PROPERTY_BOOKMARKS_DIR, FileSystemService.getUserRapidMinerDir().getAbsolutePath());
System.setProperty(BookmarkIO.PROPERTY_BOOKMARKS_FILE, ".bookmarks");
try {
if (SystemInfoUtilities.getOperatingSystem() == OperatingSystem.OSX) {
// to support OS Xs menu bar shown in the OS X menu bar,
// we have to load the default system look and feel
// to exchange the MenuBarUI from RapidLookAndFeel with the
// default OS X look and feel UI class.
// See here for more information:
// http://www.pushing-pixels.org/2008/07/13/swing-applications-and-mac-os-x-menu-bar.html
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Map<String, Object> macUIDefaults = new HashMap<>();
macUIDefaults.put("MenuBarUI", UIManager.get("MenuBarUI"));
UIManager.setLookAndFeel(new RapidLookAndFeel(macUIDefaults));
// tooltips are painted behind heavyweight windows (e.g. the native Chromium browser window) on OS X
// despite the call above of ToolTipManager#setLightWeightPopupEnabled(false);
// so we force a heavyweight popup factory for OS X
PopupFactory.setSharedInstance(new HeavyweightOSXPopupFactory());
} else {
UIManager.setLookAndFeel(new RapidLookAndFeel());
}
} catch (Exception e) {
LogService.getRoot().log(Level.WARNING, I18N.getMessage(LogService.getRoot().getResourceBundle(),
"com.rapidminer.gui.RapidMinerGUI.setting_up_modern_look_and_feel_error"), e);
}
// needed because of native browser window which otherwise renders above all popup menus
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
}
public WordCloudFrame(WordGraph wordGraph, LayoutResult layout, ColorScheme colorScheme)
{
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
initPanel(wordGraph, layout, colorScheme);
setTitle("WordCloud");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setExtendedState(JFrame.MAXIMIZED_BOTH);
setVisible(true);
}
public WordCloudFrame(JPanel panel)
{
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
add(panel);
setJMenuBar(new WordCloudMenuBar(panel));
setTitle("WordCloud");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setExtendedState(JFrame.MAXIMIZED_BOTH);
setVisible(true);
}
public NewJFrame() {
try {
NewJFrame.gui = true;
deleting.setEnabled(true);
this.setTitle(version + " - No bucket selected.");
initComponents();
setLocationRelativeTo(null);
genericEngine = new ImageIcon(this.getClass().getResource("engine.png"));
UIManager.setLookAndFeel(
UIManager.getCrossPlatformLookAndFeelClassName());
UIManager.put("TabbedPane.selected", Color.white);
UIManager.put("TabbedPane.background", Color.white);
UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));
UIManager.put("TabbedPane.borderHightlightColor", java.awt.Color.white);
UIManager.put("TabbedPane.borderHightlightColor", java.awt.Color.white);
UIManager.put("TabbedPane.darkShadow", java.awt.Color.white);
UIManager.put("TabbedPane.light", java.awt.Color.white);
UIManager.put("TabbedPane.selectHighlight", java.awt.Color.white);
UIManager.put("TabbedPane.darkShadow", java.awt.Color.white);
UIManager.put("TabbedPane.focus", java.awt.Color.white);
UIManager.put("ScrollBar.background", java.awt.Color.white);
UIManager.put("ScrollBar.thumbHighlight", new ColorUIResource(Color.white));
UIManager.put("ScrollBar.thumbDarkShadow", new ColorUIResource(Color.white));
UIManager.put("ScrollBar.highlight", new ColorUIResource(Color.white));
UIManager.put("ScrollBar.trackHighlight", new ColorUIResource(Color.white));
UIManager.getLookAndFeelDefaults().put("Panel.background", Color.white);
UIManager.getLookAndFeelDefaults().put("Panel.foreground", Color.white);
this.setIconImage(new ImageIcon(getClass()
.getResource("cloud.jpg")).getImage());
if (os.toLowerCase().contains("mac")) {
InputMap im = (InputMap) UIManager.get("TextField.focusInputMap");
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.META_DOWN_MASK), DefaultEditorKit.copyAction);
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.META_DOWN_MASK), DefaultEditorKit.pasteAction);
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.META_DOWN_MASK), DefaultEditorKit.cutAction);
InputMap im2 = (InputMap) UIManager.get("TextArea.focusInputMap");
im2.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.META_DOWN_MASK), DefaultEditorKit.copyAction);
im2.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.META_DOWN_MASK), DefaultEditorKit.pasteAction);
im2.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.META_DOWN_MASK), DefaultEditorKit.cutAction);
}
this.jTextField3.setText("https://s3.amazonaws.com");
this.jTextField4.setText("443");
this.jTabbedPane1.setToolTipTextAt(1, "Explore");
this.jTabbedPane1.setToolTipTextAt(2, "Upload a file");
this.jTabbedPane1.setToolTipTextAt(3, "Sync to and from S3");
this.jTabbedPane1.setToolTipTextAt(4, "Text Editor");
this.jScrollPane1.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER);
this.jCheckBox1.setSelected(true);
this.jPanel9.setVisible(false);
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
Thread UpdateThread = new Thread(new Update(this, true, true));
UpdateThread.start();
UpdateThread.join();
File config = new File(config_file);
if (config.exists()) {
this.jButton9.doClick();
}
} catch (Exception ex) {
}
}