List of usage examples for javax.swing UIManager getSystemLookAndFeelClassName
public static String getSystemLookAndFeelClassName()
LookAndFeel
class that implements the native system look and feel if there is one, otherwise the name of the default cross platform LookAndFeel
class. From source file:hermes.browser.HermesBrowser.java
/** * Initialisation of GUI components, must be run on the Swing dispatch * thread./* w w w. j av a2s. c o m*/ * * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException * @throws UnsupportedLookAndFeelException * @throws HermesException */ private void initUI() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, HermesException { if (System.getProperty("swing.defaultlaf") == null) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); /** * http://hermesjms.com/jira/browse/HJMS-16 I've not implemented * this fully as the L&F class name is not all we need to * persist, JIDE seems to add in lots of extension stuff and I * don't see how to persist/restor them yet. if * (TextUtils.isEmpty(getConfig().getLookAndFeel())) { * UIManager. * setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } * else { UIManager.setLookAndFeel(getConfig().getLookAndFeel()) * ; } */ } catch (Throwable e) { log.error("cannot load l&f, trying metal: " + e.getMessage(), e); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } else { UIManager.setLookAndFeel(System.getProperty("swing.defaultlaf")); } if (getConfig().isEnableJython() && jythonFrame == null) { jythonFrame = new JythonDockableFrame(); getDockingManager().addFrame(jythonFrame); } if (!getConfig().isEnableJython() && jythonFrame != null) { getDockingManager().removeFrame(jythonFrame.getKey()); jythonFrame = null; } CellEditorManager.registerEditor(Domain.class, new DomainCellEditor()); CellEditorManager.registerEditor(SelectorImpl.class, new SelectorImplCellEditor()); CellEditorManager.registerEditor(File.class, new DirectoryCellEditor(), DirectoryCellEditor.CONTEXT); CellEditorManager.registerEditor(String.class, new ClasspathIdCellEdtitor(), ClasspathIdCellEdtitor.CONTEXT); CellEditorManager.registerEditor(Hermes.class, new HermesCellEditor()); ObjectComparatorManager.registerComparator(Date.class, new DateComparator()); ObjectComparatorManager.registerComparator(Integer.class, new IntegerComparator()); ObjectComparatorManager.registerComparator(Long.class, new LongComparator()); DefaultSyntaxKit.initKit(); browserPane = new MainDocumentPane(); // Shows us the memory usage and lets the user GC MemoryStatusBarItem memoryStatusBar = new MemoryStatusBarItem(); memoryStatusBar.setPreferredWidth(100); // General informative messages go here.. progressStatus = new ProgressStatusBarItem(); statusBar = new StatusBar(); statusBar.add(progressStatus, JideBoxLayout.VARY); statusBar.add(new TimeStatusBarItem(), JideBoxLayout.FLEXIBLE); statusBar.add(memoryStatusBar, JideBoxLayout.FLEXIBLE); // The tools panel includes the running tasks, Jython console and log // console. actionsPane = new ActionsPanel(); toolsPane = new DockableToolPanel(); toolsPane.addToolPanel("Tasks", new JideScrollPane(actionsPane)); toolsPane.addToolPanel("Log", new Log4JOutputViewer("")); browserTreePane = new BrowserTreeDockableFrame(); browserTreePane.setLoader(loader); // Get the menu bar initialised... setJMenuBar(new MenuBar(this)); setIconImage(IconCache.getIcon("hermes.icon").getImage()); // // Layout management initialisation getDockingManager().setUsePref(false); getDockingManager().setProfileKey(USER_PROFILE_NAME); getDockingManager().setInitSplitPriority(DefaultDockingManager.SPLIT_SOUTH_NORTH_EAST_WEST); getDockingManager().getWorkspace().add(browserPane, BorderLayout.CENTER); getDockingManager().addFrame(browserTreePane); getDockingManager().addFrame(toolsPane); getDockableBarManager().addDockableBar(new MainToolBar()); getDockableBarManager().addDockableBar(new MessageToolBar()); getDockableBarManager().addDockableBar(new ConfigurationToolBar()); getDockableBarManager().addDockableBar(new JNDIToolBar()); getContentPane().add(statusBar, BorderLayout.AFTER_LAST_LINE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); toFront(); setStatusMessage("Ready"); SplashScreen.hide(); // // Raise the swing thread to max priority SwingUtilities.invokeLater(new Runnable() { public void run() { Thread.currentThread().setPriority(Thread.MAX_PRIORITY); } }); }
From source file:edu.stanford.epadd.launcher.Splash.java
/** we need a system tray icon for management. * http://docs.oracle.com/javase/6/docs/api/java/awt/SystemTray.html */ public static void setupSystemTrayIcon() { // Set the app name in the menu bar for mac. // c.f. http://stackoverflow.com/questions/8918826/java-os-x-lion-set-application-name-doesnt-work System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ePADD"); try {/*from ww w .j av a 2s . c o m*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { throw new RuntimeException(e); } TrayIcon trayIcon = null; if (SystemTray.isSupported()) { tellUser("Adding ePADD to the system tray"); SystemTray tray = SystemTray.getSystemTray(); URL u = ePADD.class.getClassLoader().getResource("muse-icon.png"); // note: this better be 16x16, Windows doesn't resize! Mac os does. out.println("ePADD icon resource is " + u); Image image = Toolkit.getDefaultToolkit().getImage(u); out.println("Image = " + image); // create menu items and their listeners ActionListener openMuseControlsListener = new ActionListener() { public void actionPerformed(ActionEvent e) { try { launchBrowser(BASE_URL); // no + "info" for epadd like in muse } catch (Exception e1) { e1.printStackTrace(); } } }; ActionListener QuitMuseListener = new ActionListener() { public void actionPerformed(ActionEvent e) { out.println("*** Received quit from system tray. Stopping the Tomcat embedded web server."); try { shutdownSessions(); server.stop(); } catch (Exception ex) { throw new RuntimeException(ex); } System.exit(0); // we need to explicitly system.exit because we now use Swing (due to system tray, etc). } }; // create a popup menu PopupMenu popup = new PopupMenu(); MenuItem defaultItem = new MenuItem("Open ePADD window"); defaultItem.addActionListener(openMuseControlsListener); popup.add(defaultItem); MenuItem quitItem = new MenuItem("Quit ePADD"); quitItem.addActionListener(QuitMuseListener); popup.add(quitItem); /// ... add other items // construct a TrayIcon String message = "ePADD menu"; // on windows - the tray menu is a little non-intuitive, needs a right click (plain click seems unused) if (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0) message = "Right click for ePADD menu"; trayIcon = new TrayIcon(image, message, popup); System.out.println("tray Icon = " + trayIcon); // set the TrayIcon properties // trayIcon.addActionListener(openMuseControlsListener); try { tray.add(trayIcon); } catch (AWTException e) { out.println(e); } // ... } else { // disable tray option in your application or // perform other actions // ... } System.out.println("Done!"); // ... // some time later // the application state has changed - update the image if (trayIcon != null) { // trayIcon.setImage(updatedImage); } // ... }
From source file:net.sf.jabref.JabRefPreferences.java
private JabRefPreferences() { try {//from w w w . ja va2s . c om if (new File("jabref.xml").exists()) { importPreferences("jabref.xml"); } } catch (JabRefException e) { LOGGER.warn("Could not import preferences from jabref.xml: " + e.getMessage(), e); } // load user preferences prefs = Preferences.userNodeForPackage(JabRefMain.class); defaults.put(TEXMAKER_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("texmaker", "Texmaker")); defaults.put(WIN_EDT_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("WinEdt", "WinEdt Team\\WinEdt")); defaults.put(LATEX_EDITOR_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("LEd", "LEd")); defaults.put(TEXSTUDIO_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("texstudio", "TeXstudio")); defaults.put(BIBLATEX_DEFAULT_MODE, false); if (OS.OS_X) { defaults.put(EMACS_PATH, "emacsclient"); defaults.put(EMACS_23, true); defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-n -e"); defaults.put(FONT_FAMILY, "SansSerif"); defaults.put(WIN_LOOK_AND_FEEL, UIManager.getSystemLookAndFeelClassName()); } else if (OS.WINDOWS) { defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.looks.windows.WindowsLookAndFeel"); defaults.put(EMACS_PATH, "emacsclient.exe"); defaults.put(EMACS_23, true); defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-n -e"); defaults.put(FONT_FAMILY, "Arial"); } else { // Linux defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); defaults.put(FONT_FAMILY, "SansSerif"); defaults.put(EMACS_PATH, "gnuclient"); defaults.put(EMACS_23, false); defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-batch -eval"); } defaults.put(PUSH_TO_APPLICATION, "TeXstudio"); defaults.put(RECENT_FILES, ""); defaults.put(EXTERNAL_FILE_TYPES, ""); defaults.put(KEY_PATTERN_REGEX, ""); defaults.put(KEY_PATTERN_REPLACEMENT, ""); // Proxy defaults.put(PROXY_USE, Boolean.FALSE); defaults.put(PROXY_HOSTNAME, ""); defaults.put(PROXY_PORT, "80"); defaults.put(PROXY_USE_AUTHENTICATION, Boolean.FALSE); defaults.put(PROXY_USERNAME, ""); defaults.put(PROXY_PASSWORD, ""); defaults.put(USE_DEFAULT_LOOK_AND_FEEL, Boolean.TRUE); defaults.put(LYXPIPE, USER_HOME + File.separator + ".lyx/lyxpipe"); defaults.put(VIM, "vim"); defaults.put(VIM_SERVER, "vim"); defaults.put(POS_X, 0); defaults.put(POS_Y, 0); defaults.put(SIZE_X, 1024); defaults.put(SIZE_Y, 768); defaults.put(WINDOW_MAXIMISED, Boolean.FALSE); defaults.put(AUTO_RESIZE_MODE, JTable.AUTO_RESIZE_ALL_COLUMNS); defaults.put(PREVIEW_PANEL_HEIGHT, 200); defaults.put(ENTRY_EDITOR_HEIGHT, 400); defaults.put(TABLE_COLOR_CODES_ON, Boolean.FALSE); defaults.put(NAMES_AS_IS, Boolean.FALSE); // "Show names unchanged" defaults.put(NAMES_FIRST_LAST, Boolean.FALSE); // "Show 'Firstname Lastname'" defaults.put(NAMES_NATBIB, Boolean.TRUE); // "Natbib style" defaults.put(ABBR_AUTHOR_NAMES, Boolean.TRUE); // "Abbreviate names" defaults.put(NAMES_LAST_ONLY, Boolean.TRUE); // "Show last names only" // system locale as default defaults.put(LANGUAGE, Locale.getDefault().getLanguage()); // Sorting preferences defaults.put(TABLE_PRIMARY_SORT_FIELD, "author"); defaults.put(TABLE_PRIMARY_SORT_DESCENDING, Boolean.FALSE); defaults.put(TABLE_SECONDARY_SORT_FIELD, "year"); defaults.put(TABLE_SECONDARY_SORT_DESCENDING, Boolean.TRUE); defaults.put(TABLE_TERTIARY_SORT_FIELD, "title"); defaults.put(TABLE_TERTIARY_SORT_DESCENDING, Boolean.FALSE); defaults.put(REFORMAT_FILE_ON_SAVE_AND_EXPORT, Boolean.FALSE); // export order defaults.put(EXPORT_IN_ORIGINAL_ORDER, Boolean.FALSE); defaults.put(EXPORT_IN_SPECIFIED_ORDER, Boolean.FALSE); // export order: if EXPORT_IN_SPECIFIED_ORDER, then use following criteria defaults.put(EXPORT_PRIMARY_SORT_FIELD, "bibtexkey"); defaults.put(EXPORT_PRIMARY_SORT_DESCENDING, Boolean.FALSE); defaults.put(EXPORT_SECONDARY_SORT_FIELD, "author"); defaults.put(EXPORT_SECONDARY_SORT_DESCENDING, Boolean.FALSE); defaults.put(EXPORT_TERTIARY_SORT_FIELD, "title"); defaults.put(EXPORT_TERTIARY_SORT_DESCENDING, Boolean.TRUE); defaults.put(NEWLINE, System.lineSeparator()); defaults.put(SIDE_PANE_COMPONENT_NAMES, ""); defaults.put(SIDE_PANE_COMPONENT_PREFERRED_POSITIONS, ""); defaults.put(COLUMN_NAMES, "entrytype;author/editor;title;year;journal/booktitle;bibtexkey"); defaults.put(COLUMN_WIDTHS, "75;300;470;60;130;100"); defaults.put(PersistenceTableColumnListener.ACTIVATE_PREF_KEY, PersistenceTableColumnListener.DEFAULT_ENABLED); defaults.put(XMP_PRIVACY_FILTERS, "pdf;timestamp;keywords;owner;note;review"); defaults.put(USE_XMP_PRIVACY_FILTER, Boolean.FALSE); defaults.put(NUMBER_COL_WIDTH, GUIGlobals.NUMBER_COL_LENGTH); defaults.put(WORKING_DIRECTORY, USER_HOME); defaults.put(EXPORT_WORKING_DIRECTORY, USER_HOME); // Remembers working directory of last import defaults.put(IMPORT_WORKING_DIRECTORY, USER_HOME); defaults.put(FILE_WORKING_DIRECTORY, USER_HOME); defaults.put(AUTO_OPEN_FORM, Boolean.TRUE); defaults.put(BACKUP, Boolean.TRUE); defaults.put(OPEN_LAST_EDITED, Boolean.TRUE); defaults.put(LAST_EDITED, ""); defaults.put(LAST_FOCUSED, ""); defaults.put(STRINGS_POS_X, 0); defaults.put(STRINGS_POS_Y, 0); defaults.put(STRINGS_SIZE_X, 600); defaults.put(STRINGS_SIZE_Y, 400); defaults.put(DUPLICATES_POS_X, 0); defaults.put(DUPLICATES_POS_Y, 0); defaults.put(DUPLICATES_SIZE_X, 800); defaults.put(DUPLICATES_SIZE_Y, 600); defaults.put(MERGEENTRIES_POS_X, 0); defaults.put(MERGEENTRIES_POS_Y, 0); defaults.put(MERGEENTRIES_SIZE_X, 800); defaults.put(MERGEENTRIES_SIZE_Y, 600); defaults.put(PREAMBLE_POS_X, 0); defaults.put(PREAMBLE_POS_Y, 0); defaults.put(PREAMBLE_SIZE_X, 600); defaults.put(PREAMBLE_SIZE_Y, 400); defaults.put(DEFAULT_SHOW_SOURCE, Boolean.FALSE); defaults.put(DEFAULT_AUTO_SORT, Boolean.FALSE); defaults.put(SEARCH_CASE_SENSITIVE, Boolean.FALSE); defaults.put(SEARCH_MODE_FILTER, Boolean.TRUE); defaults.put(SEARCH_REG_EXP, Boolean.FALSE); defaults.put(SEARCH_PANE_POS_X, 0); defaults.put(SEARCH_PANE_POS_Y, 0); defaults.put(MERGE_ENTRIES_DIFF_MODE, 2); defaults.put(EDITOR_EMACS_KEYBINDINGS, Boolean.FALSE); defaults.put(EDITOR_EMACS_KEYBINDINGS_REBIND_CA, Boolean.TRUE); defaults.put(EDITOR_EMACS_KEYBINDINGS_REBIND_CF, Boolean.TRUE); defaults.put(AUTO_COMPLETE, Boolean.TRUE); AutoCompletePreferences.putDefaults(defaults); defaults.put(GROUP_FLOAT_SELECTIONS, Boolean.TRUE); defaults.put(GROUP_INTERSECT_SELECTIONS, Boolean.TRUE); defaults.put(GROUP_INVERT_SELECTIONS, Boolean.FALSE); defaults.put(GROUP_SHOW_OVERLAPPING, Boolean.FALSE); defaults.put(GROUP_SELECT_MATCHES, Boolean.FALSE); defaults.put(GROUPS_DEFAULT_FIELD, "keywords"); defaults.put(GROUP_SHOW_ICONS, Boolean.TRUE); defaults.put(GROUP_SHOW_DYNAMIC, Boolean.TRUE); defaults.put(GROUP_EXPAND_TREE, Boolean.TRUE); defaults.put(GROUP_AUTO_SHOW, Boolean.TRUE); defaults.put(GROUP_AUTO_HIDE, Boolean.TRUE); defaults.put(GROUP_SHOW_NUMBER_OF_ELEMENTS, Boolean.FALSE); defaults.put(AUTO_ASSIGN_GROUP, Boolean.TRUE); defaults.put(GROUP_KEYWORD_SEPARATOR, ", "); defaults.put(EDIT_GROUP_MEMBERSHIP_MODE, Boolean.FALSE); defaults.put(HIGHLIGHT_GROUPS_MATCHING, ""); defaults.put(TOOLBAR_VISIBLE, Boolean.TRUE); defaults.put(DEFAULT_ENCODING, StandardCharsets.UTF_8.name()); defaults.put(GROUPS_VISIBLE_ROWS, 8); defaults.put(DEFAULT_OWNER, System.getProperty("user.name")); defaults.put(MEMORY_STICK_MODE, Boolean.FALSE); defaults.put(RENAME_ON_MOVE_FILE_TO_FILE_DIR, Boolean.TRUE); // The general fields stuff is made obsolete by the CUSTOM_TAB_... entries. defaults.put(GENERAL_FIELDS, "crossref;keywords;file;doi;url;urldate;" + "pdf;comment;owner"); defaults.put(FONT_STYLE, java.awt.Font.PLAIN); defaults.put(FONT_SIZE, 12); defaults.put(OVERRIDE_DEFAULT_FONTS, Boolean.FALSE); defaults.put(MENU_FONT_SIZE, 11); defaults.put(TABLE_ROW_PADDING, GUIGlobals.TABLE_ROW_PADDING); defaults.put(TABLE_SHOW_GRID, Boolean.FALSE); // Main table color settings: defaults.put(TABLE_BACKGROUND, "255:255:255"); defaults.put(TABLE_REQ_FIELD_BACKGROUND, "230:235:255"); defaults.put(TABLE_OPT_FIELD_BACKGROUND, "230:255:230"); defaults.put(TABLE_TEXT, "0:0:0"); defaults.put(GRID_COLOR, "210:210:210"); defaults.put(GRAYED_OUT_BACKGROUND, "210:210:210"); defaults.put(GRAYED_OUT_TEXT, "40:40:40"); defaults.put(VERY_GRAYED_OUT_BACKGROUND, "180:180:180"); defaults.put(VERY_GRAYED_OUT_TEXT, "40:40:40"); defaults.put(MARKED_ENTRY_BACKGROUND0, "255:255:180"); defaults.put(MARKED_ENTRY_BACKGROUND1, "255:220:180"); defaults.put(MARKED_ENTRY_BACKGROUND2, "255:180:160"); defaults.put(MARKED_ENTRY_BACKGROUND3, "255:120:120"); defaults.put(MARKED_ENTRY_BACKGROUND4, "255:75:75"); defaults.put(MARKED_ENTRY_BACKGROUND5, "220:255:220"); defaults.put(VALID_FIELD_BACKGROUND_COLOR, "255:255:255"); defaults.put(INVALID_FIELD_BACKGROUND_COLOR, "255:0:0"); defaults.put(ACTIVE_FIELD_EDITOR_BACKGROUND_COLOR, "220:220:255"); defaults.put(FIELD_EDITOR_TEXT_COLOR, "0:0:0"); defaults.put(INCOMPLETE_ENTRY_BACKGROUND, "250:175:175"); defaults.put(CTRL_CLICK, Boolean.FALSE); defaults.put(DISABLE_ON_MULTIPLE_SELECTION, Boolean.FALSE); defaults.put(URL_COLUMN, Boolean.TRUE); defaults.put(PREFER_URL_DOI, Boolean.FALSE); defaults.put(FILE_COLUMN, Boolean.TRUE); defaults.put(ARXIV_COLUMN, Boolean.FALSE); defaults.put(EXTRA_FILE_COLUMNS, Boolean.FALSE); defaults.put(LIST_OF_FILE_COLUMNS, ""); // OpenOffice/LibreOffice if (OS.WINDOWS) { defaults.put(JabRefPreferences.OO_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH); defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH + OpenOfficePreferences.WINDOWS_EXECUTABLE_SUBPATH + OpenOfficePreferences.WINDOWS_EXECUTABLE); defaults.put(JabRefPreferences.OO_JARS_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH + OpenOfficePreferences.WINDOWS_JARS_SUBPATH); } else if (OS.OS_X) { defaults.put(JabRefPreferences.OO_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH); defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH + OpenOfficePreferences.OSX_EXECUTABLE_SUBPATH + OpenOfficePreferences.OSX_EXECUTABLE); defaults.put(JabRefPreferences.OO_JARS_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH + OpenOfficePreferences.OSX_JARS_SUBPATH); } else { // Linux defaults.put(JabRefPreferences.OO_PATH, "/opt/openoffice.org3"); defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, "/usr/lib/openoffice/program/soffice"); defaults.put(JabRefPreferences.OO_JARS_PATH, "/opt/openoffice.org/basis3.0"); } defaults.put(JabRefPreferences.OO_SYNC_WHEN_CITING, false); defaults.put(JabRefPreferences.OO_SHOW_PANEL, false); defaults.put(JabRefPreferences.OO_USE_ALL_OPEN_BASES, true); defaults.put(JabRefPreferences.OO_BIBLIOGRAPHY_STYLE_FILE, StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH); defaults.put(JabRefPreferences.OO_EXTERNAL_STYLE_FILES, ""); defaults.put(STYLES_POS_X, 0); defaults.put(STYLES_POS_Y, 0); defaults.put(STYLES_SIZE_X, 600); defaults.put(STYLES_SIZE_Y, 400); defaults.put(SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED, SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY, SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY, SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING, SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE, SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED, SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_READ, SpecialFieldsUtils.PREF_SHOWCOLUMN_READ_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS, SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS, SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS_DEFAULT); defaults.put(USE_OWNER, Boolean.FALSE); defaults.put(OVERWRITE_OWNER, Boolean.FALSE); defaults.put(DIALOG_WARNING_FOR_DUPLICATE_KEY, Boolean.TRUE); defaults.put(DIALOG_WARNING_FOR_EMPTY_KEY, Boolean.TRUE); defaults.put(DISPLAY_KEY_WARNING_DIALOG_AT_STARTUP, Boolean.TRUE); defaults.put(AVOID_OVERWRITING_KEY, Boolean.FALSE); defaults.put(WARN_BEFORE_OVERWRITING_KEY, Boolean.TRUE); defaults.put(CONFIRM_DELETE, Boolean.TRUE); defaults.put(GRAY_OUT_NON_HITS, Boolean.TRUE); defaults.put(SEARCH_MODE_FLOAT, Boolean.FALSE); defaults.put(DEFAULT_LABEL_PATTERN, "[authors3][year]"); defaults.put(PREVIEW_ENABLED, Boolean.TRUE); defaults.put(ACTIVE_PREVIEW, 0); defaults.put(PREVIEW_0, "<font face=\"sans-serif\">" + "<b><i>\\bibtextype</i><a name=\"\\bibtexkey\">\\begin{bibtexkey} (\\bibtexkey)</a>" + "\\end{bibtexkey}</b><br>__NEWLINE__" + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}<BR>\\end{author}__NEWLINE__" + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} " + "<i>(\\format[IfPlural(Eds.,Ed.)]{\\editor})</i><BR>\\end{editor}__NEWLINE__" + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}<BR>__NEWLINE__" + "\\begin{chapter} \\format[HTMLChars]{\\chapter}<BR>\\end{chapter}__NEWLINE__" + "\\begin{journal} <em>\\format[HTMLChars]{\\journal}, </em>\\end{journal}__NEWLINE__" // Include the booktitle field for @inproceedings, @proceedings, etc. + "\\begin{booktitle} <em>\\format[HTMLChars]{\\booktitle}, </em>\\end{booktitle}__NEWLINE__" + "\\begin{school} <em>\\format[HTMLChars]{\\school}, </em>\\end{school}__NEWLINE__" + "\\begin{institution} <em>\\format[HTMLChars]{\\institution}, </em>\\end{institution}__NEWLINE__" + "\\begin{publisher} <em>\\format[HTMLChars]{\\publisher}, </em>\\end{publisher}__NEWLINE__" + "\\begin{year}<b>\\year</b>\\end{year}\\begin{volume}<i>, \\volume</i>\\end{volume}" + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}__NEWLINE__" + "\\begin{abstract}<BR><BR><b>Abstract: </b> \\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__" + "\\begin{review}<BR><BR><b>Review: </b> \\format[HTMLChars]{\\review} \\end{review}" + "</dd>__NEWLINE__<p></p></font>"); defaults.put(PREVIEW_1, "<font face=\"sans-serif\">" + "<b><i>\\bibtextype</i><a name=\"\\bibtexkey\">\\begin{bibtexkey} (\\bibtexkey)</a>" + "\\end{bibtexkey}</b><br>__NEWLINE__" + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}<BR>\\end{author}__NEWLINE__" + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} " + "<i>(\\format[IfPlural(Eds.,Ed.)]{\\editor})</i><BR>\\end{editor}__NEWLINE__" + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}<BR>__NEWLINE__" + "\\begin{chapter} \\format[HTMLChars]{\\chapter}<BR>\\end{chapter}__NEWLINE__" + "\\begin{journal} <em>\\format[HTMLChars]{\\journal}, </em>\\end{journal}__NEWLINE__" // Include the booktitle field for @inproceedings, @proceedings, etc. + "\\begin{booktitle} <em>\\format[HTMLChars]{\\booktitle}, </em>\\end{booktitle}__NEWLINE__" + "\\begin{school} <em>\\format[HTMLChars]{\\school}, </em>\\end{school}__NEWLINE__" + "\\begin{institution} <em>\\format[HTMLChars]{\\institution}, </em>\\end{institution}__NEWLINE__" + "\\begin{publisher} <em>\\format[HTMLChars]{\\publisher}, </em>\\end{publisher}__NEWLINE__" + "\\begin{year}<b>\\year</b>\\end{year}\\begin{volume}<i>, \\volume</i>\\end{volume}" + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}" + "</dd>__NEWLINE__<p></p></font>"); // TODO: Currently not possible to edit this setting: defaults.put(PREVIEW_PRINT_BUTTON, Boolean.FALSE); defaults.put(DO_NOT_RESOLVE_STRINGS_FOR, "url"); defaults.put(RESOLVE_STRINGS_ALL_FIELDS, Boolean.FALSE); defaults.put(PUT_BRACES_AROUND_CAPITALS, "");//"title;journal;booktitle;review;abstract"); defaults.put(NON_WRAPPABLE_FIELDS, "pdf;ps;url;doi;file"); defaults.put(GENERATE_KEYS_AFTER_INSPECTION, Boolean.TRUE); defaults.put(MARK_IMPORTED_ENTRIES, Boolean.TRUE); defaults.put(UNMARK_ALL_ENTRIES_BEFORE_IMPORTING, Boolean.TRUE); defaults.put(WARN_ABOUT_DUPLICATES_IN_INSPECTION, Boolean.TRUE); defaults.put(USE_TIME_STAMP, Boolean.FALSE); defaults.put(OVERWRITE_TIME_STAMP, Boolean.FALSE); // default time stamp follows ISO-8601. Reason: https://xkcd.com/1179/ defaults.put(TIME_STAMP_FORMAT, "yyyy-MM-dd"); defaults.put(TIME_STAMP_FIELD, InternalBibtexFields.TIMESTAMP); defaults.put(UPDATE_TIMESTAMP, Boolean.FALSE); defaults.put(GENERATE_KEYS_BEFORE_SAVING, Boolean.FALSE); defaults.put(RemotePreferences.USE_REMOTE_SERVER, Boolean.TRUE); defaults.put(RemotePreferences.REMOTE_SERVER_PORT, 6050); defaults.put(PERSONAL_JOURNAL_LIST, ""); defaults.put(EXTERNAL_JOURNAL_LISTS, ""); defaults.put(CITE_COMMAND, "\\cite"); // obsoleted by the app-specific ones (not any more?) defaults.put(FLOAT_MARKED_ENTRIES, Boolean.TRUE); defaults.put(LAST_USED_EXPORT, ""); defaults.put(SIDE_PANE_WIDTH, -1); defaults.put(IMPORT_INSPECTION_DIALOG_WIDTH, 650); defaults.put(IMPORT_INSPECTION_DIALOG_HEIGHT, 650); defaults.put(SEARCH_DIALOG_WIDTH, 650); defaults.put(SEARCH_DIALOG_HEIGHT, 500); defaults.put(SHOW_FILE_LINKS_UPGRADE_WARNING, Boolean.TRUE); defaults.put(AUTOLINK_EXACT_KEY_ONLY, Boolean.FALSE); defaults.put(NUMERIC_FIELDS, "mittnum;author"); defaults.put(RUN_AUTOMATIC_FILE_SEARCH, Boolean.FALSE); defaults.put(USE_LOCK_FILES, Boolean.TRUE); defaults.put(AUTO_SAVE, Boolean.TRUE); defaults.put(AUTO_SAVE_INTERVAL, 5); defaults.put(PROMPT_BEFORE_USING_AUTOSAVE, Boolean.TRUE); defaults.put(ENFORCE_LEGAL_BIBTEX_KEY, Boolean.TRUE); // Curly brackets ({}) are the default delimiters, not quotes (") as these cause trouble when they appear within the field value: // Currently, JabRef does not escape them defaults.put(VALUE_DELIMITERS2, 1); defaults.put(KEY_GEN_FIRST_LETTER_A, Boolean.TRUE); defaults.put(KEY_GEN_ALWAYS_ADD_LETTER, Boolean.FALSE); defaults.put(EMAIL_SUBJECT, Localization.lang("References")); defaults.put(OPEN_FOLDERS_OF_ATTACHED_FILES, Boolean.FALSE); defaults.put(ALLOW_FILE_AUTO_OPEN_BROWSE, Boolean.TRUE); defaults.put(WEB_SEARCH_VISIBLE, Boolean.FALSE); defaults.put(SELECTED_FETCHER_INDEX, 0); defaults.put(BIB_LOC_AS_PRIMARY_DIR, Boolean.FALSE); defaults.put(DB_CONNECT_SERVER_TYPE, "MySQL"); defaults.put(DB_CONNECT_HOSTNAME, "localhost"); defaults.put(DB_CONNECT_DATABASE, "jabref"); defaults.put(DB_CONNECT_USERNAME, "root"); defaults.put(AKS_AUTO_NAMING_PDFS_AGAIN, Boolean.TRUE); insertCleanupPreset(defaults, CLEANUP_DEFAULT_PRESET); // defaults for DroppedFileHandler UI defaults.put(DroppedFileHandler.DFH_LEAVE, Boolean.FALSE); defaults.put(DroppedFileHandler.DFH_COPY, Boolean.TRUE); defaults.put(DroppedFileHandler.DFH_MOVE, Boolean.FALSE); defaults.put(DroppedFileHandler.DFH_RENAME, Boolean.FALSE); //defaults.put("lastAutodetectedImport", ""); //defaults.put("autoRemoveExactDuplicates", Boolean.FALSE); //defaults.put("confirmAutoRemoveExactDuplicates", Boolean.TRUE); //defaults.put("tempDir", System.getProperty("java.io.tmpdir")); LOGGER.debug("Temporary directory: " + System.getProperty("java.io.tempdir")); //defaults.put("keyPattern", new LabelPattern(KEY_PATTERN)); defaults.put(PREF_IMPORT_ALWAYSUSE, Boolean.FALSE); defaults.put(PREF_IMPORT_DEFAULT_PDF_IMPORT_STYLE, ImportSettingsTab.DEFAULT_STYLE); // use BibTeX key appended with filename as default pattern defaults.put(PREF_IMPORT_FILENAMEPATTERN, ImportSettingsTab.DEFAULT_FILENAMEPATTERNS[1]); customExports = new CustomExportList(new ExportComparator()); customImports = new CustomImportList(this); updateSpecialFieldHandling(); WRAPPED_USERNAME = '[' + get(DEFAULT_OWNER) + ']'; MARKING_WITH_NUMBER_PATTERN = "\\[" + get(DEFAULT_OWNER).replaceAll("\\\\", "\\\\\\\\") + ":(\\d+)\\]"; String defaultExpression = "**/.*[bibtexkey].*\\\\.[extension]"; defaults.put(DEFAULT_REG_EXP_SEARCH_EXPRESSION_KEY, defaultExpression); defaults.put(REG_EXP_SEARCH_EXPRESSION_KEY, defaultExpression); defaults.put(AUTOLINK_USE_REG_EXP_SEARCH_KEY, Boolean.FALSE); defaults.put(USE_IEEE_ABRV, Boolean.FALSE); defaults.put(USE_CONVERT_TO_EQUATION, Boolean.FALSE); defaults.put(USE_CASE_KEEPER_ON_SEARCH, Boolean.TRUE); defaults.put(USE_UNIT_FORMATTER_ON_SEARCH, Boolean.TRUE); }
From source file:edu.harvard.i2b2.eclipse.plugins.admin.utilities.views.PatientCountView.java
private void setPassword() { if (right != null && !right.isDisposed()) { right.dispose();//from w w w . j a v a2 s.com right = null; } right = new Composite(composite, SWT.NONE); GridLayout rightLayout1 = new GridLayout(); GridData rightLData = new GridData(); rightLData.grabExcessHorizontalSpace = true; rightLData.grabExcessVerticalSpace = true; rightLData.horizontalAlignment = GridData.FILL; rightLData.verticalAlignment = GridData.FILL; right.setLayoutData(rightLData); right.setLayout(rightLayout1); GridData composite1LData = new GridData(); composite1LData.grabExcessHorizontalSpace = true; composite1LData.grabExcessVerticalSpace = true; composite1LData.horizontalAlignment = GridData.FILL; composite1LData.verticalAlignment = GridData.FILL; composite1 = new Composite(right, SWT.EMBEDDED); composite1.setLayoutData(composite1LData); /* Create and setting up frame */ ////for mac fix //if ( System.getProperty("os.name").toLowerCase().startsWith("mac")) //SWT_AWT.embeddedFrameClass = "sun.lwawt.macosx.CViewEmbeddedFrame"; Frame runFrame = SWT_AWT.new_Frame(composite1); Panel runPanel = new Panel(new BorderLayout()); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e1) { System.out.println("Error setting native LAF: " + e1); } runFrame.add(runPanel); JRootPane runRoot = new JRootPane(); runPanel.add(runRoot); java.awt.Container oAwtContainer = runRoot.getContentPane(); AdminToolSetPasswordJPanel runTreePanel = new AdminToolSetPasswordJPanel();//PatientMappingJPanel();//PreviousQueryPanel(this); //runTreePanel.setBackground(Color.BLUE); oAwtContainer.add(runTreePanel); //oAwtContainer.setVisible(true); //oAwtContainer.setSize(500, 500); //right.layout(true); //right.setVisible(true); //right.update(); composite.layout(true); //composite.setVisible(true); //composite.update(); }
From source file:net.sf.jabref.preferences.JabRefPreferences.java
private JabRefPreferences() { try {//from w w w .j av a 2s. co m if (new File("jabref.xml").exists()) { importPreferences("jabref.xml"); } } catch (JabRefException e) { LOGGER.warn("Could not import preferences from jabref.xml: " + e.getMessage(), e); } // load user preferences prefs = Preferences.userNodeForPackage(JabRefMain.class); defaults.put(TEXMAKER_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("texmaker", "Texmaker")); defaults.put(WIN_EDT_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("WinEdt", "WinEdt Team\\WinEdt")); defaults.put(LATEX_EDITOR_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("LEd", "LEd")); defaults.put(TEXSTUDIO_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("texstudio", "TeXstudio")); defaults.put(BIBLATEX_DEFAULT_MODE, false); if (OS.OS_X) { defaults.put(EMACS_PATH, "emacsclient"); defaults.put(EMACS_23, true); defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-n -e"); defaults.put(FONT_FAMILY, "SansSerif"); defaults.put(WIN_LOOK_AND_FEEL, UIManager.getSystemLookAndFeelClassName()); } else if (OS.WINDOWS) { defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.looks.windows.WindowsLookAndFeel"); defaults.put(EMACS_PATH, "emacsclient.exe"); defaults.put(EMACS_23, true); defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-n -e"); defaults.put(FONT_FAMILY, "Arial"); } else { // Linux defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); defaults.put(FONT_FAMILY, "SansSerif"); defaults.put(EMACS_PATH, "gnuclient"); defaults.put(EMACS_23, false); defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-batch -eval"); } defaults.put(PUSH_TO_APPLICATION, "TeXstudio"); defaults.put(RECENT_FILES, ""); defaults.put(EXTERNAL_FILE_TYPES, ""); defaults.put(KEY_PATTERN_REGEX, ""); defaults.put(KEY_PATTERN_REPLACEMENT, ""); // Proxy defaults.put(PROXY_USE, Boolean.FALSE); defaults.put(PROXY_HOSTNAME, ""); defaults.put(PROXY_PORT, "80"); defaults.put(PROXY_USE_AUTHENTICATION, Boolean.FALSE); defaults.put(PROXY_USERNAME, ""); defaults.put(PROXY_PASSWORD, ""); defaults.put(USE_DEFAULT_LOOK_AND_FEEL, Boolean.TRUE); defaults.put(LYXPIPE, USER_HOME + File.separator + ".lyx/lyxpipe"); defaults.put(VIM, "vim"); defaults.put(VIM_SERVER, "vim"); defaults.put(POS_X, 0); defaults.put(POS_Y, 0); defaults.put(SIZE_X, 1024); defaults.put(SIZE_Y, 768); defaults.put(WINDOW_MAXIMISED, Boolean.FALSE); defaults.put(AUTO_RESIZE_MODE, JTable.AUTO_RESIZE_ALL_COLUMNS); defaults.put(PREVIEW_PANEL_HEIGHT, 200); defaults.put(ENTRY_EDITOR_HEIGHT, 400); defaults.put(TABLE_COLOR_CODES_ON, Boolean.FALSE); defaults.put(NAMES_AS_IS, Boolean.FALSE); // "Show names unchanged" defaults.put(NAMES_FIRST_LAST, Boolean.FALSE); // "Show 'Firstname Lastname'" defaults.put(NAMES_NATBIB, Boolean.TRUE); // "Natbib style" defaults.put(ABBR_AUTHOR_NAMES, Boolean.TRUE); // "Abbreviate names" defaults.put(NAMES_LAST_ONLY, Boolean.TRUE); // "Show last names only" // system locale as default defaults.put(LANGUAGE, Locale.getDefault().getLanguage()); // Sorting preferences defaults.put(TABLE_PRIMARY_SORT_FIELD, FieldName.AUTHOR); defaults.put(TABLE_PRIMARY_SORT_DESCENDING, Boolean.FALSE); defaults.put(TABLE_SECONDARY_SORT_FIELD, FieldName.YEAR); defaults.put(TABLE_SECONDARY_SORT_DESCENDING, Boolean.TRUE); defaults.put(TABLE_TERTIARY_SORT_FIELD, FieldName.TITLE); defaults.put(TABLE_TERTIARY_SORT_DESCENDING, Boolean.FALSE); defaults.put(REFORMAT_FILE_ON_SAVE_AND_EXPORT, Boolean.FALSE); // export order defaults.put(EXPORT_IN_ORIGINAL_ORDER, Boolean.FALSE); defaults.put(EXPORT_IN_SPECIFIED_ORDER, Boolean.FALSE); // export order: if EXPORT_IN_SPECIFIED_ORDER, then use following criteria defaults.put(EXPORT_PRIMARY_SORT_FIELD, BibEntry.KEY_FIELD); defaults.put(EXPORT_PRIMARY_SORT_DESCENDING, Boolean.FALSE); defaults.put(EXPORT_SECONDARY_SORT_FIELD, FieldName.AUTHOR); defaults.put(EXPORT_SECONDARY_SORT_DESCENDING, Boolean.FALSE); defaults.put(EXPORT_TERTIARY_SORT_FIELD, FieldName.TITLE); defaults.put(EXPORT_TERTIARY_SORT_DESCENDING, Boolean.TRUE); defaults.put(NEWLINE, System.lineSeparator()); defaults.put(SIDE_PANE_COMPONENT_NAMES, ""); defaults.put(SIDE_PANE_COMPONENT_PREFERRED_POSITIONS, ""); defaults.put(COLUMN_NAMES, "entrytype;author/editor;title;year;journal/booktitle;bibtexkey"); defaults.put(COLUMN_WIDTHS, "75;300;470;60;130;100"); defaults.put(PersistenceTableColumnListener.ACTIVATE_PREF_KEY, PersistenceTableColumnListener.DEFAULT_ENABLED); defaults.put(XMP_PRIVACY_FILTERS, "pdf;timestamp;keywords;owner;note;review"); defaults.put(USE_XMP_PRIVACY_FILTER, Boolean.FALSE); defaults.put(NUMBER_COL_WIDTH, 32); defaults.put(WORKING_DIRECTORY, USER_HOME); defaults.put(EXPORT_WORKING_DIRECTORY, USER_HOME); // Remembers working directory of last import defaults.put(IMPORT_WORKING_DIRECTORY, USER_HOME); defaults.put(FILE_WORKING_DIRECTORY, USER_HOME); defaults.put(AUTO_OPEN_FORM, Boolean.TRUE); defaults.put(BACKUP, Boolean.TRUE); defaults.put(OPEN_LAST_EDITED, Boolean.TRUE); defaults.put(LAST_EDITED, ""); defaults.put(LAST_FOCUSED, ""); defaults.put(STRINGS_POS_X, 0); defaults.put(STRINGS_POS_Y, 0); defaults.put(STRINGS_SIZE_X, 600); defaults.put(STRINGS_SIZE_Y, 400); defaults.put(DUPLICATES_POS_X, 0); defaults.put(DUPLICATES_POS_Y, 0); defaults.put(DUPLICATES_SIZE_X, 800); defaults.put(DUPLICATES_SIZE_Y, 600); defaults.put(MERGEENTRIES_POS_X, 0); defaults.put(MERGEENTRIES_POS_Y, 0); defaults.put(MERGEENTRIES_SIZE_X, 800); defaults.put(MERGEENTRIES_SIZE_Y, 600); defaults.put(PREAMBLE_POS_X, 0); defaults.put(PREAMBLE_POS_Y, 0); defaults.put(PREAMBLE_SIZE_X, 600); defaults.put(PREAMBLE_SIZE_Y, 400); defaults.put(DEFAULT_SHOW_SOURCE, Boolean.FALSE); defaults.put(DEFAULT_AUTO_SORT, Boolean.FALSE); defaults.put(SEARCH_CASE_SENSITIVE, Boolean.FALSE); defaults.put(SEARCH_MODE_FILTER, Boolean.TRUE); defaults.put(SEARCH_REG_EXP, Boolean.FALSE); defaults.put(SEARCH_PANE_POS_X, 0); defaults.put(SEARCH_PANE_POS_Y, 0); defaults.put(MERGE_ENTRIES_DIFF_MODE, 2); defaults.put(EDITOR_EMACS_KEYBINDINGS, Boolean.FALSE); defaults.put(EDITOR_EMACS_KEYBINDINGS_REBIND_CA, Boolean.TRUE); defaults.put(EDITOR_EMACS_KEYBINDINGS_REBIND_CF, Boolean.TRUE); defaults.put(AUTO_COMPLETE, Boolean.TRUE); AutoCompletePreferences.putDefaults(defaults); defaults.put(GROUP_FLOAT_SELECTIONS, Boolean.TRUE); defaults.put(GROUP_INTERSECT_SELECTIONS, Boolean.TRUE); defaults.put(GROUP_INVERT_SELECTIONS, Boolean.FALSE); defaults.put(GROUP_SHOW_OVERLAPPING, Boolean.FALSE); defaults.put(GROUPS_DEFAULT_FIELD, FieldName.KEYWORDS); defaults.put(GROUP_SHOW_ICONS, Boolean.TRUE); defaults.put(GROUP_SHOW_DYNAMIC, Boolean.TRUE); defaults.put(GROUP_EXPAND_TREE, Boolean.TRUE); defaults.put(GROUP_AUTO_SHOW, Boolean.TRUE); defaults.put(GROUP_AUTO_HIDE, Boolean.TRUE); defaults.put(GROUP_SHOW_NUMBER_OF_ELEMENTS, Boolean.FALSE); defaults.put(AUTO_ASSIGN_GROUP, Boolean.TRUE); defaults.put(KEYWORD_SEPARATOR, ", "); defaults.put(EDIT_GROUP_MEMBERSHIP_MODE, Boolean.FALSE); defaults.put(HIGHLIGHT_GROUPS_MATCHING, "all"); defaults.put(TOOLBAR_VISIBLE, Boolean.TRUE); defaults.put(DEFAULT_ENCODING, StandardCharsets.UTF_8.name()); defaults.put(GROUPS_VISIBLE_ROWS, 8); defaults.put(DEFAULT_OWNER, System.getProperty("user.name")); defaults.put(MEMORY_STICK_MODE, Boolean.FALSE); defaults.put(RENAME_ON_MOVE_FILE_TO_FILE_DIR, Boolean.TRUE); // The general fields stuff is made obsolete by the CUSTOM_TAB_... entries. defaults.put(GENERAL_FIELDS, "crossref;keywords;file;doi;url;urldate;" + "pdf;comment;owner"); defaults.put(FONT_STYLE, java.awt.Font.PLAIN); defaults.put(FONT_SIZE, 12); defaults.put(OVERRIDE_DEFAULT_FONTS, Boolean.FALSE); defaults.put(MENU_FONT_SIZE, 11); defaults.put(TABLE_ROW_PADDING, 9); defaults.put(TABLE_SHOW_GRID, Boolean.FALSE); // Main table color settings: defaults.put(TABLE_BACKGROUND, "255:255:255"); defaults.put(TABLE_REQ_FIELD_BACKGROUND, "230:235:255"); defaults.put(TABLE_OPT_FIELD_BACKGROUND, "230:255:230"); defaults.put(TABLE_TEXT, "0:0:0"); defaults.put(GRID_COLOR, "210:210:210"); defaults.put(GRAYED_OUT_BACKGROUND, "210:210:210"); defaults.put(GRAYED_OUT_TEXT, "40:40:40"); defaults.put(VERY_GRAYED_OUT_BACKGROUND, "180:180:180"); defaults.put(VERY_GRAYED_OUT_TEXT, "40:40:40"); defaults.put(MARKED_ENTRY_BACKGROUND0, "255:255:180"); defaults.put(MARKED_ENTRY_BACKGROUND1, "255:220:180"); defaults.put(MARKED_ENTRY_BACKGROUND2, "255:180:160"); defaults.put(MARKED_ENTRY_BACKGROUND3, "255:120:120"); defaults.put(MARKED_ENTRY_BACKGROUND4, "255:75:75"); defaults.put(MARKED_ENTRY_BACKGROUND5, "220:255:220"); defaults.put(VALID_FIELD_BACKGROUND_COLOR, "255:255:255"); defaults.put(INVALID_FIELD_BACKGROUND_COLOR, "255:0:0"); defaults.put(ACTIVE_FIELD_EDITOR_BACKGROUND_COLOR, "220:220:255"); defaults.put(FIELD_EDITOR_TEXT_COLOR, "0:0:0"); defaults.put(INCOMPLETE_ENTRY_BACKGROUND, "250:175:175"); defaults.put(CTRL_CLICK, Boolean.FALSE); defaults.put(DISABLE_ON_MULTIPLE_SELECTION, Boolean.FALSE); defaults.put(URL_COLUMN, Boolean.TRUE); defaults.put(PREFER_URL_DOI, Boolean.FALSE); defaults.put(FILE_COLUMN, Boolean.TRUE); defaults.put(ARXIV_COLUMN, Boolean.FALSE); defaults.put(EXTRA_FILE_COLUMNS, Boolean.FALSE); defaults.put(LIST_OF_FILE_COLUMNS, ""); // OpenOffice/LibreOffice if (OS.WINDOWS) { defaults.put(JabRefPreferences.OO_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH); defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH + OpenOfficePreferences.WINDOWS_EXECUTABLE_SUBPATH + OpenOfficePreferences.WINDOWS_EXECUTABLE); defaults.put(JabRefPreferences.OO_JARS_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH + OpenOfficePreferences.WINDOWS_JARS_SUBPATH); } else if (OS.OS_X) { defaults.put(JabRefPreferences.OO_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH); defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH + OpenOfficePreferences.OSX_EXECUTABLE_SUBPATH + OpenOfficePreferences.OSX_EXECUTABLE); defaults.put(JabRefPreferences.OO_JARS_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH + OpenOfficePreferences.OSX_JARS_SUBPATH); } else { // Linux defaults.put(JabRefPreferences.OO_PATH, "/opt/openoffice.org3"); defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, "/usr/lib/openoffice/program/soffice"); defaults.put(JabRefPreferences.OO_JARS_PATH, "/opt/openoffice.org/basis3.0"); } defaults.put(JabRefPreferences.OO_SYNC_WHEN_CITING, false); defaults.put(JabRefPreferences.OO_SHOW_PANEL, false); defaults.put(JabRefPreferences.OO_USE_ALL_OPEN_BASES, true); defaults.put(JabRefPreferences.OO_BIBLIOGRAPHY_STYLE_FILE, StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH); defaults.put(JabRefPreferences.OO_EXTERNAL_STYLE_FILES, ""); defaults.put(STYLES_POS_X, 0); defaults.put(STYLES_POS_Y, 0); defaults.put(STYLES_SIZE_X, 600); defaults.put(STYLES_SIZE_Y, 400); defaults.put(SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED, SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY, SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY, SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING, SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE, SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED, SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_READ, SpecialFieldsUtils.PREF_SHOWCOLUMN_READ_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS, SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS_DEFAULT); defaults.put(SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS, SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS_DEFAULT); defaults.put(USE_OWNER, Boolean.FALSE); defaults.put(OVERWRITE_OWNER, Boolean.FALSE); defaults.put(DIALOG_WARNING_FOR_DUPLICATE_KEY, Boolean.TRUE); defaults.put(DIALOG_WARNING_FOR_EMPTY_KEY, Boolean.TRUE); defaults.put(DISPLAY_KEY_WARNING_DIALOG_AT_STARTUP, Boolean.TRUE); defaults.put(AVOID_OVERWRITING_KEY, Boolean.FALSE); defaults.put(WARN_BEFORE_OVERWRITING_KEY, Boolean.TRUE); defaults.put(CONFIRM_DELETE, Boolean.TRUE); defaults.put(GRAY_OUT_NON_HITS, Boolean.TRUE); defaults.put(SEARCH_MODE_FLOAT, Boolean.FALSE); defaults.put(DEFAULT_LABEL_PATTERN, "[auth][year]"); defaults.put(PREVIEW_ENABLED, Boolean.TRUE); defaults.put(ACTIVE_PREVIEW, 0); defaults.put(PREVIEW_0, "<font face=\"sans-serif\">" + "<b><i>\\bibtextype</i><a name=\"\\bibtexkey\">\\begin{bibtexkey} (\\bibtexkey)</a>" + "\\end{bibtexkey}</b><br>__NEWLINE__" + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}<BR>\\end{author}__NEWLINE__" + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} " + "<i>(\\format[IfPlural(Eds.,Ed.)]{\\editor})</i><BR>\\end{editor}__NEWLINE__" + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}<BR>__NEWLINE__" + "\\begin{chapter} \\format[HTMLChars]{\\chapter}<BR>\\end{chapter}__NEWLINE__" + "\\begin{journal} <em>\\format[HTMLChars]{\\journal}, </em>\\end{journal}__NEWLINE__" // Include the booktitle field for @inproceedings, @proceedings, etc. + "\\begin{booktitle} <em>\\format[HTMLChars]{\\booktitle}, </em>\\end{booktitle}__NEWLINE__" + "\\begin{school} <em>\\format[HTMLChars]{\\school}, </em>\\end{school}__NEWLINE__" + "\\begin{institution} <em>\\format[HTMLChars]{\\institution}, </em>\\end{institution}__NEWLINE__" + "\\begin{publisher} <em>\\format[HTMLChars]{\\publisher}, </em>\\end{publisher}__NEWLINE__" + "\\begin{year}<b>\\year</b>\\end{year}\\begin{volume}<i>, \\volume</i>\\end{volume}" + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}__NEWLINE__" + "\\begin{abstract}<BR><BR><b>Abstract: </b> \\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__" + "\\begin{review}<BR><BR><b>Review: </b> \\format[HTMLChars]{\\review} \\end{review}" + "</dd>__NEWLINE__<p></p></font>"); defaults.put(PREVIEW_1, "<font face=\"sans-serif\">" + "<b><i>\\bibtextype</i><a name=\"\\bibtexkey\">\\begin{bibtexkey} (\\bibtexkey)</a>" + "\\end{bibtexkey}</b><br>__NEWLINE__" + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}<BR>\\end{author}__NEWLINE__" + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} " + "<i>(\\format[IfPlural(Eds.,Ed.)]{\\editor})</i><BR>\\end{editor}__NEWLINE__" + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}<BR>__NEWLINE__" + "\\begin{chapter} \\format[HTMLChars]{\\chapter}<BR>\\end{chapter}__NEWLINE__" + "\\begin{journal} <em>\\format[HTMLChars]{\\journal}, </em>\\end{journal}__NEWLINE__" // Include the booktitle field for @inproceedings, @proceedings, etc. + "\\begin{booktitle} <em>\\format[HTMLChars]{\\booktitle}, </em>\\end{booktitle}__NEWLINE__" + "\\begin{school} <em>\\format[HTMLChars]{\\school}, </em>\\end{school}__NEWLINE__" + "\\begin{institution} <em>\\format[HTMLChars]{\\institution}, </em>\\end{institution}__NEWLINE__" + "\\begin{publisher} <em>\\format[HTMLChars]{\\publisher}, </em>\\end{publisher}__NEWLINE__" + "\\begin{year}<b>\\year</b>\\end{year}\\begin{volume}<i>, \\volume</i>\\end{volume}" + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}" + "</dd>__NEWLINE__<p></p></font>"); // TODO: Currently not possible to edit this setting: defaults.put(PREVIEW_PRINT_BUTTON, Boolean.FALSE); defaults.put(DO_NOT_RESOLVE_STRINGS_FOR, FieldName.URL); defaults.put(RESOLVE_STRINGS_ALL_FIELDS, Boolean.FALSE); defaults.put(NON_WRAPPABLE_FIELDS, "pdf;ps;url;doi;file"); defaults.put(GENERATE_KEYS_AFTER_INSPECTION, Boolean.TRUE); defaults.put(MARK_IMPORTED_ENTRIES, Boolean.TRUE); defaults.put(UNMARK_ALL_ENTRIES_BEFORE_IMPORTING, Boolean.TRUE); defaults.put(WARN_ABOUT_DUPLICATES_IN_INSPECTION, Boolean.TRUE); defaults.put(USE_TIME_STAMP, Boolean.FALSE); defaults.put(OVERWRITE_TIME_STAMP, Boolean.FALSE); // default time stamp follows ISO-8601. Reason: https://xkcd.com/1179/ defaults.put(TIME_STAMP_FORMAT, "yyyy-MM-dd"); defaults.put(TIME_STAMP_FIELD, InternalBibtexFields.TIMESTAMP); defaults.put(UPDATE_TIMESTAMP, Boolean.FALSE); defaults.put(GENERATE_KEYS_BEFORE_SAVING, Boolean.FALSE); defaults.put(RemotePreferences.USE_REMOTE_SERVER, Boolean.TRUE); defaults.put(RemotePreferences.REMOTE_SERVER_PORT, 6050); defaults.put(PERSONAL_JOURNAL_LIST, ""); defaults.put(EXTERNAL_JOURNAL_LISTS, ""); defaults.put(CITE_COMMAND, "\\cite"); // obsoleted by the app-specific ones (not any more?) defaults.put(FLOAT_MARKED_ENTRIES, Boolean.TRUE); defaults.put(LAST_USED_EXPORT, ""); defaults.put(SIDE_PANE_WIDTH, -1); defaults.put(IMPORT_INSPECTION_DIALOG_WIDTH, 650); defaults.put(IMPORT_INSPECTION_DIALOG_HEIGHT, 650); defaults.put(SEARCH_DIALOG_WIDTH, 650); defaults.put(SEARCH_DIALOG_HEIGHT, 500); defaults.put(SHOW_FILE_LINKS_UPGRADE_WARNING, Boolean.TRUE); defaults.put(AUTOLINK_EXACT_KEY_ONLY, Boolean.FALSE); defaults.put(NUMERIC_FIELDS, "mittnum;author"); defaults.put(RUN_AUTOMATIC_FILE_SEARCH, Boolean.FALSE); defaults.put(USE_LOCK_FILES, Boolean.TRUE); defaults.put(AUTO_SAVE, Boolean.TRUE); defaults.put(AUTO_SAVE_INTERVAL, 5); defaults.put(PROMPT_BEFORE_USING_AUTOSAVE, Boolean.TRUE); defaults.put(ENFORCE_LEGAL_BIBTEX_KEY, Boolean.TRUE); // Curly brackets ({}) are the default delimiters, not quotes (") as these cause trouble when they appear within the field value: // Currently, JabRef does not escape them defaults.put(VALUE_DELIMITERS2, 1); defaults.put(KEY_GEN_FIRST_LETTER_A, Boolean.TRUE); defaults.put(KEY_GEN_ALWAYS_ADD_LETTER, Boolean.FALSE); defaults.put(EMAIL_SUBJECT, Localization.lang("References")); defaults.put(OPEN_FOLDERS_OF_ATTACHED_FILES, Boolean.FALSE); defaults.put(ALLOW_FILE_AUTO_OPEN_BROWSE, Boolean.TRUE); defaults.put(WEB_SEARCH_VISIBLE, Boolean.FALSE); defaults.put(SELECTED_FETCHER_INDEX, 0); defaults.put(BIB_LOC_AS_PRIMARY_DIR, Boolean.FALSE); defaults.put(DB_CONNECT_SERVER_TYPE, "MySQL"); defaults.put(DB_CONNECT_HOSTNAME, "localhost"); defaults.put(DB_CONNECT_DATABASE, "jabref"); defaults.put(DB_CONNECT_USERNAME, "root"); defaults.put(AKS_AUTO_NAMING_PDFS_AGAIN, Boolean.TRUE); insertCleanupPreset(defaults, CLEANUP_DEFAULT_PRESET); // defaults for DroppedFileHandler UI defaults.put(DroppedFileHandler.DFH_LEAVE, Boolean.FALSE); defaults.put(DroppedFileHandler.DFH_COPY, Boolean.TRUE); defaults.put(DroppedFileHandler.DFH_MOVE, Boolean.FALSE); defaults.put(DroppedFileHandler.DFH_RENAME, Boolean.FALSE); //defaults.put("lastAutodetectedImport", ""); //defaults.put("autoRemoveExactDuplicates", Boolean.FALSE); //defaults.put("confirmAutoRemoveExactDuplicates", Boolean.TRUE); //defaults.put("tempDir", System.getProperty("java.io.tmpdir")); LOGGER.debug("Temporary directory: " + System.getProperty("java.io.tempdir")); //defaults.put("keyPattern", new LabelPattern(KEY_PATTERN)); defaults.put(PREF_IMPORT_ALWAYSUSE, Boolean.FALSE); defaults.put(PREF_IMPORT_DEFAULT_PDF_IMPORT_STYLE, ImportSettingsTab.DEFAULT_STYLE); // use BibTeX key appended with filename as default pattern defaults.put(PREF_IMPORT_FILENAMEPATTERN, ImportSettingsTab.DEFAULT_FILENAMEPATTERNS[1]); customExports = new CustomExportList(new ExportComparator()); customImports = new CustomImportList(this); updateSpecialFieldHandling(); WRAPPED_USERNAME = '[' + get(DEFAULT_OWNER) + ']'; MARKING_WITH_NUMBER_PATTERN = "\\[" + get(DEFAULT_OWNER).replaceAll("\\\\", "\\\\\\\\") + ":(\\d+)\\]"; String defaultExpression = "**/.*[bibtexkey].*\\\\.[extension]"; defaults.put(DEFAULT_REG_EXP_SEARCH_EXPRESSION_KEY, defaultExpression); defaults.put(REG_EXP_SEARCH_EXPRESSION_KEY, defaultExpression); defaults.put(AUTOLINK_USE_REG_EXP_SEARCH_KEY, Boolean.FALSE); defaults.put(USE_IEEE_ABRV, Boolean.FALSE); defaults.put(USE_CASE_KEEPER_ON_SEARCH, Boolean.TRUE); defaults.put(USE_UNIT_FORMATTER_ON_SEARCH, Boolean.TRUE); defaults.put(MAX_BACK_HISTORY_SIZE, 10); defaults.put(LINE_LENGTH, 65); defaults.put(INDENT, 4); defaults.put(USE_DEFAULT_CONSOLE_APPLICATION, Boolean.TRUE); if (OS.WINDOWS) { defaults.put(CONSOLE_COMMAND, "C:\\Program Files\\ConEmu\\ConEmu64.exe /single /dir \"%DIR\""); } else { defaults.put(CONSOLE_COMMAND, ""); } //versioncheck defaults defaults.put(VersionPreferences.VERSION_IGNORED_UPDATE, ""); }
From source file:edu.harvard.i2b2.eclipse.plugins.admin.utilities.views.PatientCountView.java
private void setKey() { if (right != null && !right.isDisposed()) { right.dispose();/* w ww .j a v a 2s .co m*/ right = null; } right = new Composite(composite, SWT.NONE); GridLayout rightLayout1 = new GridLayout(); GridData rightLData = new GridData(); rightLData.grabExcessHorizontalSpace = true; rightLData.grabExcessVerticalSpace = true; rightLData.horizontalAlignment = GridData.FILL; rightLData.verticalAlignment = GridData.FILL; right.setLayoutData(rightLData); right.setLayout(rightLayout1); GridData composite1LData = new GridData(); composite1LData.grabExcessHorizontalSpace = true; composite1LData.grabExcessVerticalSpace = true; composite1LData.horizontalAlignment = GridData.FILL; composite1LData.verticalAlignment = GridData.FILL; composite1 = new Composite(right, SWT.EMBEDDED); composite1.setLayoutData(composite1LData); /* Create and setting up frame */ ////for mac fix //if ( System.getProperty("os.name").toLowerCase().startsWith("mac")) //SWT_AWT.embeddedFrameClass = "sun.lwawt.macosx.CViewEmbeddedFrame"; Frame runFrame = SWT_AWT.new_Frame(composite1); Panel runPanel = new Panel(new BorderLayout()); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e1) { System.out.println("Error setting native LAF: " + e1); } runFrame.add(runPanel); JRootPane runRoot = new JRootPane(); runPanel.add(runRoot); java.awt.Container oAwtContainer = runRoot.getContentPane(); AdminToolSetKeyJPanel runTreePanel = new AdminToolSetKeyJPanel();//PatientMappingJPanel();//PreviousQueryPanel(this); //runTreePanel.setBackground(Color.BLUE); oAwtContainer.add(runTreePanel); //oAwtContainer.setVisible(true); //oAwtContainer.setSize(500, 500); //right.layout(true); //right.setVisible(true); //right.update(); composite.layout(true); //composite.setVisible(true); //composite.update(); }
From source file:edu.stanford.muse.launcher.Splash.java
/** we need a system tray icon for management. * http://docs.oracle.com/javase/6/docs/api/java/awt/SystemTray.html */ public static void setupSystemTrayIcon() { // Set the app name in the menu bar for mac. // c.f. http://stackoverflow.com/questions/8918826/java-os-x-lion-set-application-name-doesnt-work System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ePADD"); try {/*from w w w.jav a 2 s. co m*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { throw new RuntimeException(e); } TrayIcon trayIcon = null; if (SystemTray.isSupported()) { System.out.println("Adding ePADD to the system tray"); SystemTray tray = SystemTray.getSystemTray(); URL u = TomcatMain.class.getClassLoader().getResource("muse-icon.png"); // note: this better be 16x16, Windows doesn't resize! Mac os does. System.out.println("ePADD icon resource is " + u); Image image = Toolkit.getDefaultToolkit().getImage(u); System.out.println("Image = " + image); // create menu items and their listeners ActionListener openMuseControlsListener = new ActionListener() { public void actionPerformed(ActionEvent e) { try { launchBrowser(BASE_URL + "/info", null); } catch (Exception e1) { e1.printStackTrace(); } } }; ActionListener QuitMuseListener = new ActionListener() { public void actionPerformed(ActionEvent e) { out.println("*** Received quit from system tray. Stopping the Tomcat embedded web server."); try { shutdownSessions(); server.stop(); } catch (Exception ex) { throw new RuntimeException(ex); } System.exit(0); // we need to explicitly system.exit because we now use Swing (due to system tray, etc). } }; // create a popup menu PopupMenu popup = new PopupMenu(); MenuItem defaultItem = new MenuItem("Open ePADD window"); defaultItem.addActionListener(openMuseControlsListener); popup.add(defaultItem); MenuItem quitItem = new MenuItem("Quit ePADD"); quitItem.addActionListener(QuitMuseListener); popup.add(quitItem); /// ... add other items // construct a TrayIcon String message = "ePADD menu"; // on windows - the tray menu is a little non-intuitive, needs a right click (plain click seems unused) if (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0) message = "Right click for ePADD menu"; trayIcon = new TrayIcon(image, message, popup); System.out.println("tray Icon = " + trayIcon); // set the TrayIcon properties // trayIcon.addActionListener(openMuseControlsListener); try { tray.add(trayIcon); } catch (AWTException e) { err.println(e); } // ... } else { // disable tray option in your application or // perform other actions // ... } System.out.println("Done!"); // ... // some time later // the application state has changed - update the image if (trayIcon != null) { // trayIcon.setImage(updatedImage); } // ... }
From source file:gui.TheGui.java
/** * @param args the command line arguments */// www .java2s. c om public static void main(String args[]) { try { /* * Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* * If Nimbus (introduced in Java SE 6) is not available, stay with the * default look and feel. For details see * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { // if ("Nimbus".equals(info.getName())) { // javax.swing.UIManager.setLookAndFeel(info.getClassName()); // } // } } catch (ClassNotFoundException ex) { Logger.getLogger(TheGui.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(TheGui.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(TheGui.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(TheGui.class.getName()).log(Level.SEVERE, null, ex); } //</editor-fold> /* * Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TheGui().setVisible(true); } }); }
From source file:gui.TheGui.java
/** * @param args the command line arguments *//*from w w w .j a va 2 s . c o m*/ public static void main(String args[]) { try { /* * Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* * If Nimbus (introduced in Java SE 6) is not available, stay with * the default look and feel. For details see * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { // if ("Nimbus".equals(info.getName())) { // javax.swing.UIManager.setLookAndFeel(info.getClassName()); // } // } } catch (ClassNotFoundException ex) { Logger.getLogger(TheGui.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(TheGui.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(TheGui.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(TheGui.class.getName()).log(Level.SEVERE, null, ex); } //</editor-fold> /* * Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TheGui().setVisible(true); } }); }
From source file:edu.stanford.epadd.launcher.Splash.java
/** we need a system tray icon for management. * http://docs.oracle.com/javase/6/docs/api/java/awt/SystemTray.html */ public static void setupSystemTrayIcon() { // Set the app name in the menu bar for mac. // c.f. http://stackoverflow.com/questions/8918826/java-os-x-lion-set-application-name-doesnt-work System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ePADD"); try {/* www . j av a 2 s . c om*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { throw new RuntimeException(e); } TrayIcon trayIcon = null; if (SystemTray.isSupported()) { System.out.println("Adding ePADD to the system tray"); SystemTray tray = SystemTray.getSystemTray(); URL u = TomcatMain.class.getClassLoader().getResource("muse-icon.png"); // note: this better be 16x16, Windows doesn't resize! Mac os does. System.out.println("ePADD icon resource is " + u); Image image = Toolkit.getDefaultToolkit().getImage(u); System.out.println("Image = " + image); // create menu items and their listeners ActionListener openMuseControlsListener = new ActionListener() { public void actionPerformed(ActionEvent e) { try { launchBrowser(BASE_URL, null); // no + "info" for epadd like in muse } catch (Exception e1) { e1.printStackTrace(); } } }; ActionListener QuitMuseListener = new ActionListener() { public void actionPerformed(ActionEvent e) { out.println("*** Received quit from system tray. Stopping the Tomcat embedded web server."); try { shutdownSessions(); server.stop(); } catch (Exception ex) { throw new RuntimeException(ex); } System.exit(0); // we need to explicitly system.exit because we now use Swing (due to system tray, etc). } }; // create a popup menu PopupMenu popup = new PopupMenu(); MenuItem defaultItem = new MenuItem("Open ePADD window"); defaultItem.addActionListener(openMuseControlsListener); popup.add(defaultItem); MenuItem quitItem = new MenuItem("Quit ePADD"); quitItem.addActionListener(QuitMuseListener); popup.add(quitItem); /// ... add other items // construct a TrayIcon String message = "ePADD menu"; // on windows - the tray menu is a little non-intuitive, needs a right click (plain click seems unused) if (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0) message = "Right click for ePADD menu"; trayIcon = new TrayIcon(image, message, popup); System.out.println("tray Icon = " + trayIcon); // set the TrayIcon properties // trayIcon.addActionListener(openMuseControlsListener); try { tray.add(trayIcon); } catch (AWTException e) { out.println(e); } // ... } else { // disable tray option in your application or // perform other actions // ... } System.out.println("Done!"); // ... // some time later // the application state has changed - update the image if (trayIcon != null) { // trayIcon.setImage(updatedImage); } // ... }