⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optionpanel.java

📁 思维导图(Mind Mapping)以放射性思考(Radiant Thinking)为基础的收放自如方式
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	        return spinner.getValue().toString();	    }	    	    public void layout(DefaultFormBuilder builder) {//	        JLabel label = builder//	        .append(OptionPanel.getText(getLabel()), slider);	        JLabel label = builder	        .append(OptionPanel.getText(getLabel()), spinner);	        label.setToolTipText(OptionPanel.getText(getDescription()));	    }	    	}	private static class ColorProperty extends JButton implements			PropertyControl, PropertyBean, ActionListener {		String description;		String label;		Color color;		final JPopupMenu menu = new JPopupMenu();        private final String defaultColor;		/**		 * @param description		 * @param label		 * @param defaultColor TODO		 */		public ColorProperty(String description, String label, String defaultColor) {			super();			this.description = description;			this.label = label;            this.defaultColor = defaultColor;			addActionListener(this);			color = Color.BLACK;		}		public String getDescription() {			return description;		}		public String getLabel() {			return label;		}		public void setValue(String value) {			setColorValue(Tools.xmlToColor(value));		}		public String getValue() {			return Tools.colorToXml(getColorValue());		}		public void layout(DefaultFormBuilder builder) {			JLabel label = builder					.append(OptionPanel.getText(getLabel()), this);			label.setToolTipText(OptionPanel.getText(getDescription()));			// add "reset to standard" popup:		    		    // Create and add a menu item			//FIXME: Translate me!		    JMenuItem item = new JMenuItem(fmMain.getResourceString("OptionPanel.ColorProperty.ResetColor"));		    item.addActionListener(new ActionListener(){                public void actionPerformed(ActionEvent e) {                    setValue(defaultColor);                }});		    menu.add(item);		    		    // Set the component to show the popup menu		    this.addMouseListener(new MouseAdapter() {		        public void mousePressed(MouseEvent evt) {		            if (evt.isPopupTrigger()) {		                menu.show(evt.getComponent(), evt.getX(), evt.getY());		            }		        }		        public void mouseReleased(MouseEvent evt) {		            if (evt.isPopupTrigger()) {		                menu.show(evt.getComponent(), evt.getX(), evt.getY());		            }		        }		    });		}		public void actionPerformed(ActionEvent arg0) {			Color result = Controller.showCommonJColorChooserDialog(					getRootPane(), getLabel(), getColorValue());			if (result != null) {				setColorValue(result);			}		}		/**		 * @param result		 */		private void setColorValue(Color result) {			color = result;			setBackground(result);			setText(Tools.colorToXml(result));		}		/**		 * @return		 */		private Color getColorValue() {			return color;		}	}	private static class KeyProperty extends JButton implements			PropertyControl, PropertyBean {		String description;		String label;		/**		 * @param description		 * @param label		 */		public KeyProperty(final JDialog frame, String description, String label) {			super();			this.description = description;			this.label = label;			addActionListener(new ActionListener() {				public void actionPerformed(ActionEvent arg0) {					//FIXME: Determine bindings.					Vector allKeybindings = new Vector();					GrabKeyDialog dialog = new GrabKeyDialog(fmMain, frame,							new GrabKeyDialog.KeyBinding(getLabel(),									getLabel(), getValue(), false),							allKeybindings, null);					if (dialog.isOK()) {						setValue(dialog.getShortcut());					}				}			});		}		public String getDescription() {			return description;		}		public String getLabel() {			return label;		}		public void setValue(String value) {			setText(value);			setToolTipText(getText());		}		public String getValue() {			return getText();		}		public void layout(DefaultFormBuilder builder) {			JLabel label = builder					.append(OptionPanel.getText(getLabel()), this);			label.setToolTipText(OptionPanel.getText(getDescription()));		}	}	private static class BooleanProperty extends JCheckBox implements			PropertyControl, PropertyBean {		String description;		String label;		/**		 * @param description		 * @param label		 */		public BooleanProperty(String description, String label) {			super();			this.description = description;			this.label = label;		}		public String getDescription() {			return description;		}		public String getLabel() {			return label;		}		public void setValue(String value) {			if (value == null					|| !(value.toLowerCase().equals("true") || value							.toLowerCase().equals("false"))) {				throw new IllegalArgumentException("Cannot set a boolean to "						+ value);			}			setSelected(value.toLowerCase().equals("true"));		}		public String getValue() {			return isSelected() ? "true" : "false";		}		public void layout(DefaultFormBuilder builder) {			JLabel label = builder					.append(OptionPanel.getText(getLabel()), this);			label.setToolTipText(OptionPanel.getText(getDescription()));		}	}	private static class ComboProperty extends JComboBox implements			PropertyControl, PropertyBean {		String description;		String label;		private Vector possibleValues;		/**		 * @param description		 * @param label		 */		public ComboProperty(String description, String label,				String[] possibles) {			super();			this.description = description;			this.label = label;			fillPossibleValues(possibles);			Vector possibleTranslations = new Vector();			for (Iterator i = possibleValues.iterator(); i.hasNext();) {				String key = (String) i.next();				possibleTranslations.add(OptionPanel.getText(key));			}			setModel(new DefaultComboBoxModel(possibleTranslations));		}		public ComboProperty(String description, String label,				String[] possibles, Vector possibleTranslations) {			this.description = description;			this.label = label;			fillPossibleValues(possibles);			setModel(new DefaultComboBoxModel(possibleTranslations));		}		/**		 * @param possibles		 */		private void fillPossibleValues(String[] possibles) {			this.possibleValues = new Vector();			possibleValues.addAll(Arrays.asList(possibles));		}		public String getDescription() {			return description;		}		public String getLabel() {			return label;		}		public void setValue(String value) {			if (possibleValues.contains(value)) {				super.setSelectedIndex(possibleValues.indexOf(value));			} else {				throw new IllegalArgumentException("Unknown value:" + value);			}		}		public String getValue() {			return (String) possibleValues.get(super.getSelectedIndex());		}		public void layout(DefaultFormBuilder builder) {			JLabel label = builder					.append(OptionPanel.getText(getLabel()), this);			label.setToolTipText(OptionPanel.getText(getDescription()));		}	}	//	private Vector getControls() {		Vector controls = new Vector();		/***********************************************************************		 * Language		 * ****************************************************************		 */		controls.add(new NewTabProperty("Environment"));		controls.add(new SeparatorProperty("language"));		//TODO: Search class path for translations.		controls.add(new ComboProperty(		"language.tooltip", FreeMind.RESOURCE_LANGUAGE, new String[] {				"automatic", "cs", "de", "dk", "en", "es", "fr", "hu", "it",				"ja", "kr", "lt", "nl", "no", "pl", "pt_BR", "pt_PT", "ru", "sl",				"zh", "zh_CN" })); //  automatic		//INTERNAL PROPERTY.		//		controls		//				.add(new StringProperty(		//						"The Modes which Freemind will load on startup, full Class names,		// comma, identifier, separated by a comma.",		//						"modes_since_0_8_0")); //		// freemind.modes.browsemode.BrowseMode,Browse,freemind.modes.mindmapmode.MindMapMode,MindMap,freemind.modes.filemode.FileMode,File		//		//		controls.add(new StringProperty(		//				"The initial mode that is loaded on startup", "initial_mode")); //		// MindMap		//		//		controls		//				.add(new StringProperty(		//						"This is the place where the users properties file is located. It is		// ignored by the applet (set Parameters in the html file instead). You		// can write '~' to indicate the users home directory. Of course this		// works only in the default 'freemind.properties', which is included in		// the jar file, not for the users freemind.props out of the jar file.",		//						"properties_folder")); // .freemind		controls.add(new NextLineProperty());		controls.add(new SeparatorProperty("files"));		controls.add(new StringProperty(null, "last_opened_list_length")); //  25		controls				.add(new BooleanProperty(				"experimental_file_locking_on.tooltip",						"experimental_file_locking_on")); //  false		controls.add(new NextLineProperty());		controls.add(new StringProperty(null, "userproperties")); //  user.properties		//FIXME: Remove autoproperties from Freemind.		//		controls.add(new StringProperty(null, "autoproperties")); //		// auto.properties		controls.add(new StringProperty(null, "patternsfile")); //  patterns.xml		//FIXME: Which one? controls.add(new StringProperty(		//				"The URL of the documentation mindmap (.mm)", "docmapurl")); //		// ./doc/freemind.mm		controls.add(new StringProperty(null, "docmapurl_since_version_0_7_0")); //  ./doc/freemind.mm		//		//		 The Browse Mode		//		controls.add(new StringProperty(		"browsemode_initial_map.tooltip", "browsemode_initial_map")); //  ./doc/freemind.mm		controls.add(new NextLineProperty());		controls.add(new SeparatorProperty("automatic_save"));		controls.add(new StringProperty(		"time_for_automatic_save.tooltip", "time_for_automatic_save")); // 60000		//		controls.add(new BooleanProperty(		"delete_automatic_saves_at_exit.tooltip",				"delete_automatic_saves_at_exit")); // true		controls.add(new StringProperty(		"number_of_different_files_for_automatic_save.tooltip",				"number_of_different_files_for_automatic_save")); // 10		controls.add(new StringProperty(		"path_to_automatic_saves.tooltip", "path_to_automatic_saves")); // freemind_home		/***********************************************************************		 * Defaults		 * ****************************************************************		 */		controls.add(new NewTabProperty("Defaults"));		controls.add(new SeparatorProperty("default_styles"));		controls.add(new ComboProperty("standardnodestyle.tooltip",                FreeMind.RESOURCES_NODE_STYLE,                new String[] { MindMapNode.STYLE_FORK,                        MindMapNode.STYLE_BUBBLE, MindMapNode.STYLE_AS_PARENT,                        MindMapNode.STYLE_COMBINED })); //  as_parent		controls.add(new ComboProperty(		"standardrootnodestyle.tooltip", FreeMind.RESOURCES_ROOT_NODE_STYLE, new String[] {		        MindMapNode.STYLE_FORK,                MindMapNode.STYLE_BUBBLE,                MindMapNode.STYLE_COMBINED })); //  fork		controls.add(new NextLineProperty());		controls.add(new SeparatorProperty("default_colors"));		controls.add(new ColorProperty(		"standardnodecolor.tooltip", FreeMind.RESOURCES_NODE_COLOR, "#000000")); //  #000000		controls.add(new ColorProperty(		"standardselectednodecolor.tooltip", FreeMind.RESOURCES_SELECTED_NODE_COLOR, "#D2D2D2")); //  #D2D2D2		controls.add(new ColorProperty(		"standardedgecolor.tooltip", FreeMind.RESOURCES_EDGE_COLOR, "#808080")); //  #808080		controls.add(new ColorProperty(		"standardlinkcolor.tooltip", FreeMind.RESOURCES_LINK_COLOR, "#b0b0b0")); //  #b0b0b0		controls.add(new ColorProperty(		"standardbackgroundcolor.tooltip", FreeMind.RESOURCES_BACKGROUND_COLOR, "#ffffff")); //  #ffffff		controls.add(new ColorProperty(		"standardcloudcolor.tooltip", FreeMind.RESOURCES_CLOUD_COLOR, "#f0f0f0")); //  #f0f0f0		controls.add(new NextLineProperty());		controls.add(new SeparatorProperty("default_fonts"));		controls.add(new StringProperty(		"defaultfont.tooltip", "defaultfont")); //  SansSerif		controls.add(new StringProperty(null, "defaultfontstyle")); //  0		controls.add(new StringProperty(null, "defaultfontsize")); //  12		controls.add(new StringProperty("max_node_width.tooltip",				"max_node_width")); //  600		controls.add(new NextLineProperty());		controls.add(new SeparatorProperty("other_defaults"));		controls.add(new ComboProperty(		"standardedgestyle.tooltip", FreeMind.RESOURCES_EDGE_STYLE, new String[] {				"bezier", "linear" })); //  bezier//		controls.add(new ComboProperty(////		"standardcloudestyle.tooltip", "standardcloudestyle",//				new String[] { "bezier" })); //  bezier////		controls.add(new ComboProperty(////		"standardlinkestyle.tooltip", "standardlinkestyle",//				new String[] { "bezier" })); //  bezier		/***********************************************************************		 * Appearance		 * ****************************************************************		 */		controls.add(new NewTabProperty("Appearance"));		controls.add(new SeparatorProperty("look_and_feel"));		LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();		String[] lafNames = new String[lafInfo.length + 5];		Vector translatedLafNames = new Vector();		lafNames[0] = "default";		translatedLafNames.add(getText("default"));		lafNames[1] = "metal";		translatedLafNames.add(getText("metal"));		lafNames[2] = "windows";		translatedLafNames.add(getText("windows"));		lafNames[3] = "motif";		translatedLafNames.add(getText("motif"));		lafNames[4] = "gtk";		translatedLafNames.add(getText("gtk"));		lafNames[5] = "nothing";		translatedLafNames.add(getText("nothing"));		for (int i = 0; i < lafInfo.length; i++) {			LookAndFeelInfo info = lafInfo[i];			String className = info.getClassName();			lafNames[i + 5] = className;			translatedLafNames.add(info.getName());		}		controls.add(new ComboProperty("lookandfeel.tooltip",				FreeMind.RESOURCE_LOOKANDFEEL, lafNames, translatedLafNames)); //  default		/* ***************************************************************** */		controls.add(new NextLineProperty());		controls.add(new SeparatorProperty("anti_alias"));		controls.add(new ComboProperty("antialias.tooltip",				FreeMind.RESOURCE_ANTIALIAS, new String[] { "antialias_edges",						"antialias_all", "antialias_none" })); //  true

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -